Home Getting Started With Scripts Using this wiki Commands CTGUI Global functions Bracket Handlers
Event IEventManager
IBlockEvent IEventCancelable IEventHasResult IEventPositionable IMinecartEvent IPotionBrewEvent IProcessableEvent IProjectileImpactEvent IEntityEvent IExplosionEvent ILivingEvent IPlayerEvent ITickEvent AnimalTameEvent ArrowLooseEvent ArrowNockEvent BlockBreakEvent BlockHarvestDropsEvent BlockNeighborNotifyEvent BlockPlaceEvent ClientTickEvent CommandEvent CriticalHitEvent CropGrowPostEvent CropGrowPreEvent EnchantmentLevelSetEvent EnderTeleportEvent EntityJoinWorldEvent EntityLivingAttackedEvent EntityLivingDamageEvent EntityLivingDeathEvent EntityLivingDeathDropsEvent EntityLivingEquipmentChangeEvent EntityLivingFallEvent EntityLivingHealEvent EntityLivingHurtEvent EntityLivingJumpEvent EntityLivingSpawnEvent EntityLivingUpdateEvent EntityMountEvent EntityStruckByLightningEvent EntityTravelToDimensionEvent ExplosionDetonateEvent ExplosionStartEvent FarmlandTrampleEvent ItemExpireEvent ItemFishedEvent ItemTossEvent LivingDestroyBlockEvent LivingEntityUseItemEvent LivingExperienceDropEvent LivingKnockBackEvent LootingLevelEvent MinecartCollisionEvent MinecartInteractEvent MobGriefingEvent PlayerAdvancementEvent PlayerAnvilRepairEvent PlayerAnvilUpdateEvent PlayerAttackEntityEvent PlayerBonemealEvent PlayerBreakSpeedEvent PlayerBrewedPotionEvent PlayerChangedDimensionEvent PlayerCloneEvent PlayerCloseContainerEvent PlayerCraftedEvent PlayerDeathDropsEvent PlayerDestroyItemEvent PlayerFillBucketEvent PlayerInteractBlockEvent PlayerInteractEntityEvent PlayerInteractEvent PlayerItemPickupEvent PlayerLeftClickBlockEvent PlayerLoggedInEvent PlayerLoggedOutEvent PlayerOpenContainerEvent PlayerPickupItemEvent PlayerPickupXpEvent PlayerRespawnEvent PlayerRightClickItemEvent PlayerSetSpawnEvent PlayerSleepInBedEvent PlayerSmeltedEvent PlayerTickEvent PlayerUseHoeEvent PlayerVisibilityEvent PortalSpawnEvent PotionBrewPostEvent PotionBrewPreEvent ProjectileImpactArrowEvent ProjectileImpactFireballEvent ProjectileImpactThrowableEvent RenderTickEvent ServerTickEvent SleepingLocationCheckEvent SleepingTimeCheckEvent WorldTickEvent

PlayerAnvilUpdate

The PlayerAnvilUpdate Event is fired when a player places items in both the left and right slots of a anvil.

  • If the event is canceled, vanilla behavior will not run, and the output will be set to null.
  • If the event is not canceled, but the output is not null, it will set the output and not run vanilla behavior.
  • if the output is null, and the event is not canceled, vanilla behavior will execute.

Event Class

You will need to cast the event in the function header as this class:
crafttweaker.event.PlayerAnvilUpdateEvent
You can, of course, also import the class before and use that name then.

Event interface extensions

PlayerAnvilUpdate Events implement the following interfaces and are able to call all of their methods/getters/setters as well:

ZenGetters & ZenSetters

The following information can be retrieved from the event:

ZenGetterZenSettertypeDescription
ZenGetter
leftItem
ZenSetter
type
IItemStack
Description
The left side of the input.
ZenGetter
rightItem
ZenSetter
type
IItemStack
Description
The right side of the input.
ZenGetter
outputItem
ZenSetter
outputItem
type
IItemStack
Description
Set this to set the output stack.
ZenGetter
itemName
ZenSetter
type
string
Description
The name to set the item, if the user specified one.
ZenGetter
xpCost
ZenSetter
xpCost
type
int
Description
The base cost, set this to change it if output != null.
ZenGetter
materialCost
ZenSetter
materialCost
type
int
Description
The number of items from the right slot to be consumed during the repair. Leave as 0 to consume the entire stack.

ZenGetters/ZenSetters/ZenMethods from extensions

The following information can be retrieved/set during the event:

ZenGetterZenSetterType
ZenGetter
canceled
ZenSetter
canceled
Type
bool

ZenMethods

  • event.cancel(); Method, returns void (nothing). Can cancel the event and stop something from happening