public class ForgeHooks
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
ForgeHooks.DummyBlockReader |
private static class |
ForgeHooks.LootTableContext |
Modifier and Type | Field and Description |
---|---|
private static org.apache.logging.log4j.util.TriConsumer<Block,ToolType,java.lang.Integer> |
blockToolSetter |
private static java.lang.ThreadLocal<PlayerEntity> |
craftingPlayer |
private static ForgeHooks.DummyBlockReader |
DUMMY_WORLD |
private static org.apache.logging.log4j.Marker |
FORGEHOOKS |
private static org.apache.logging.log4j.Logger |
LOGGER |
private static java.lang.ThreadLocal<java.util.Deque<ForgeHooks.LootTableContext>> |
lootContext |
private static java.util.Map<IDataSerializer<?>,DataSerializerEntry> |
serializerEntries |
private static boolean |
toolInit |
(package private) static java.util.regex.Pattern |
URL_PATTERN |
private static java.util.Map<IRegistryDelegate<Item>,java.lang.Integer> |
VANILLA_BURNS |
Constructor and Description |
---|
ForgeHooks() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canContinueUsing(ItemStack from,
ItemStack to) |
static boolean |
canEntityDestroy(World world,
BlockPos pos,
LivingEntity entity) |
static int |
canEntitySpawn(MobEntity entity,
IWorld world,
double x,
double y,
double z,
AbstractSpawner spawner,
SpawnReason spawnReason) |
static boolean |
canHarvestBlock(BlockState state,
PlayerEntity player,
IBlockReader world,
BlockPos pos) |
static boolean |
canToolHarvestBlock(IWorldReader world,
BlockPos pos,
ItemStack stack) |
static FluidAttributes |
createVanillaFluidAttributes(Fluid fluid) |
static <T> void |
deserializeTagAdditions(Tag.Builder<T> builder,
java.util.function.Function<ResourceLocation,java.util.Optional<T>> valueGetter,
com.google.gson.JsonObject json) |
static int |
getBurnTime(ItemStack stack)
Gets the burn time of this itemstack.
|
static ItemStack |
getContainerItem(ItemStack stack) |
static PlayerEntity |
getCraftingPlayer() |
static CriticalHitEvent |
getCriticalHit(PlayerEntity player,
Entity target,
boolean vanillaCritical,
float damageModifier) |
static java.lang.String |
getDefaultCreatorModId(ItemStack itemStack)
Used as the default implementation of
IForgeItem.getCreatorModId(net.minecraft.item.ItemStack) . |
static int |
getLootingLevel(Entity target,
Entity killer,
DamageSource cause) |
static int |
getLootingLevel(LivingEntity target,
DamageSource cause,
int level) |
private static ForgeHooks.LootTableContext |
getLootTableContext() |
static double |
getPlayerVisibilityDistance(PlayerEntity player,
double xzDistance,
double maxXZDistance) |
private static <T,E> T |
getPrivateValue(java.lang.Class<? super E> classToAccess,
E instance,
int fieldIndex) |
static IDataSerializer<?> |
getSerializer(int id,
IntIdentityHashBiMap<IDataSerializer<?>> vanilla) |
static int |
getSerializerId(IDataSerializer<?> serializer,
IntIdentityHashBiMap<IDataSerializer<?>> vanilla) |
(package private) static void |
initTools() |
static boolean |
isLivingOnLadder(BlockState state,
World world,
BlockPos pos,
LivingEntity entity) |
static boolean |
isToolEffective(IWorldReader world,
BlockPos pos,
ItemStack stack) |
static LootTable |
loadLootTable(com.google.gson.Gson gson,
ResourceLocation name,
com.google.gson.JsonObject data,
boolean custom,
LootTableManager lootTableManager) |
static java.util.List<ItemStack> |
modifyLoot(java.util.List<ItemStack> list,
LootContext context)
All loot table drops should be passed to this function so that mod added effects
(e.g.
|
static ITextComponent |
newChatWithLinks(java.lang.String string) |
static ITextComponent |
newChatWithLinks(java.lang.String string,
boolean allowMissingHeader) |
static void |
onAdvancement(ServerPlayerEntity player,
Advancement advancement) |
static boolean |
onAnvilChange(RepairContainer container,
ItemStack left,
ItemStack right,
IInventory outputSlot,
java.lang.String name,
int baseCost) |
static float |
onAnvilRepair(PlayerEntity player,
ItemStack output,
ItemStack left,
ItemStack right) |
static int |
onBlockBreakEvent(World world,
GameType gameType,
ServerPlayerEntity entityPlayer,
BlockPos pos) |
static void |
onCropsGrowPost(World worldIn,
BlockPos pos,
BlockState state) |
static boolean |
onCropsGrowPre(World worldIn,
BlockPos pos,
BlockState state,
boolean def) |
static void |
onDifficultyChange(Difficulty difficulty,
Difficulty oldDifficulty) |
static void |
onEmptyClick(PlayerEntity player,
Hand hand) |
static void |
onEmptyLeftClick(PlayerEntity player) |
static boolean |
onFarmlandTrample(World world,
BlockPos pos,
BlockState state,
float fallDistance,
Entity entity) |
static ActionResultType |
onInteractEntity(PlayerEntity player,
Entity entity,
Hand hand) |
static ActionResultType |
onInteractEntityAt(PlayerEntity player,
Entity entity,
RayTraceResult ray,
Hand hand) |
static ActionResultType |
onInteractEntityAt(PlayerEntity player,
Entity entity,
Vec3d vec3d,
Hand hand) |
static ActionResultType |
onItemRightClick(PlayerEntity player,
Hand hand) |
static PlayerInteractEvent.LeftClickBlock |
onLeftClickBlock(PlayerEntity player,
BlockPos pos,
Direction face) |
static boolean |
onLivingAttack(LivingEntity entity,
DamageSource src,
float amount) |
static float |
onLivingDamage(LivingEntity entity,
DamageSource src,
float amount) |
static boolean |
onLivingDeath(LivingEntity entity,
DamageSource src) |
static boolean |
onLivingDrops(LivingEntity entity,
DamageSource source,
java.util.Collection<ItemEntity> drops,
int lootingLevel,
boolean recentlyHit) |
static float[] |
onLivingFall(LivingEntity entity,
float distance,
float damageMultiplier) |
static float |
onLivingHurt(LivingEntity entity,
DamageSource src,
float amount) |
static void |
onLivingJump(LivingEntity entity) |
static LivingKnockBackEvent |
onLivingKnockBack(LivingEntity target,
Entity attacker,
float strength,
double ratioX,
double ratioZ) |
static void |
onLivingSetAttackTarget(LivingEntity entity,
LivingEntity target) |
static boolean |
onLivingUpdate(LivingEntity entity) |
static int |
onNoteChange(World world,
BlockPos pos,
BlockState state,
int old,
int _new) |
static boolean |
onPickBlock(RayTraceResult target,
PlayerEntity player,
World world)
Called when a player uses 'pick block', calls new Entity and Block hooks.
|
static ActionResultType |
onPlaceItemIntoWorld(ItemUseContext context) |
static boolean |
onPlayerAttack(LivingEntity entity,
DamageSource src,
float amount) |
static boolean |
onPlayerAttackTarget(PlayerEntity player,
Entity target) |
static ItemEntity |
onPlayerTossEvent(PlayerEntity player,
ItemStack item,
boolean includeName) |
static PlayerInteractEvent.RightClickBlock |
onRightClickBlock(PlayerEntity player,
Hand hand,
BlockPos pos,
Direction face) |
static ITextComponent |
onServerChatEvent(ServerPlayNetHandler net,
java.lang.String raw,
ITextComponent comp) |
static boolean |
onTravelToDimension(Entity entity,
DimensionType dimension) |
static java.lang.String |
readLootEntryName(com.google.gson.JsonObject json,
java.lang.String type) |
static java.lang.String |
readPoolName(com.google.gson.JsonObject json) |
static void |
setBlockToolSetter(org.apache.logging.log4j.util.TriConsumer<Block,ToolType,java.lang.Integer> setter) |
static void |
setCraftingPlayer(PlayerEntity player) |
static void |
updateBurns() |
private static final org.apache.logging.log4j.Logger LOGGER
private static final org.apache.logging.log4j.Marker FORGEHOOKS
private static boolean toolInit
static final java.util.regex.Pattern URL_PATTERN
private static java.lang.ThreadLocal<PlayerEntity> craftingPlayer
private static java.lang.ThreadLocal<java.util.Deque<ForgeHooks.LootTableContext>> lootContext
private static org.apache.logging.log4j.util.TriConsumer<Block,ToolType,java.lang.Integer> blockToolSetter
private static final ForgeHooks.DummyBlockReader DUMMY_WORLD
private static final java.util.Map<IDataSerializer<?>,DataSerializerEntry> serializerEntries
private static final java.util.Map<IRegistryDelegate<Item>,java.lang.Integer> VANILLA_BURNS
public static boolean canContinueUsing(@Nonnull ItemStack from, @Nonnull ItemStack to)
public static boolean canHarvestBlock(@Nonnull BlockState state, @Nonnull PlayerEntity player, @Nonnull IBlockReader world, @Nonnull BlockPos pos)
public static boolean canToolHarvestBlock(IWorldReader world, BlockPos pos, @Nonnull ItemStack stack)
public static boolean isToolEffective(IWorldReader world, BlockPos pos, @Nonnull ItemStack stack)
static void initTools()
public static boolean onPickBlock(RayTraceResult target, PlayerEntity player, World world)
public static void onDifficultyChange(Difficulty difficulty, Difficulty oldDifficulty)
public static void onLivingSetAttackTarget(LivingEntity entity, LivingEntity target)
public static boolean onLivingUpdate(LivingEntity entity)
public static boolean onLivingAttack(LivingEntity entity, DamageSource src, float amount)
public static boolean onPlayerAttack(LivingEntity entity, DamageSource src, float amount)
public static LivingKnockBackEvent onLivingKnockBack(LivingEntity target, Entity attacker, float strength, double ratioX, double ratioZ)
public static float onLivingHurt(LivingEntity entity, DamageSource src, float amount)
public static float onLivingDamage(LivingEntity entity, DamageSource src, float amount)
public static boolean onLivingDeath(LivingEntity entity, DamageSource src)
public static boolean onLivingDrops(LivingEntity entity, DamageSource source, java.util.Collection<ItemEntity> drops, int lootingLevel, boolean recentlyHit)
@Nullable public static float[] onLivingFall(LivingEntity entity, float distance, float damageMultiplier)
public static int getLootingLevel(Entity target, @Nullable Entity killer, DamageSource cause)
public static int getLootingLevel(LivingEntity target, DamageSource cause, int level)
public static double getPlayerVisibilityDistance(PlayerEntity player, double xzDistance, double maxXZDistance)
public static boolean isLivingOnLadder(@Nonnull BlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull LivingEntity entity)
public static void onLivingJump(LivingEntity entity)
@Nullable public static ItemEntity onPlayerTossEvent(@Nonnull PlayerEntity player, @Nonnull ItemStack item, boolean includeName)
@Nullable public static ITextComponent onServerChatEvent(ServerPlayNetHandler net, java.lang.String raw, ITextComponent comp)
public static ITextComponent newChatWithLinks(java.lang.String string)
public static ITextComponent newChatWithLinks(java.lang.String string, boolean allowMissingHeader)
public static int onBlockBreakEvent(World world, GameType gameType, ServerPlayerEntity entityPlayer, BlockPos pos)
public static ActionResultType onPlaceItemIntoWorld(@Nonnull ItemUseContext context)
public static boolean onAnvilChange(RepairContainer container, @Nonnull ItemStack left, @Nonnull ItemStack right, IInventory outputSlot, java.lang.String name, int baseCost)
public static float onAnvilRepair(PlayerEntity player, @Nonnull ItemStack output, @Nonnull ItemStack left, @Nonnull ItemStack right)
public static void setCraftingPlayer(PlayerEntity player)
public static PlayerEntity getCraftingPlayer()
public static boolean onPlayerAttackTarget(PlayerEntity player, Entity target)
public static boolean onTravelToDimension(Entity entity, DimensionType dimension)
public static ActionResultType onInteractEntityAt(PlayerEntity player, Entity entity, RayTraceResult ray, Hand hand)
public static ActionResultType onInteractEntityAt(PlayerEntity player, Entity entity, Vec3d vec3d, Hand hand)
public static ActionResultType onInteractEntity(PlayerEntity player, Entity entity, Hand hand)
public static ActionResultType onItemRightClick(PlayerEntity player, Hand hand)
public static PlayerInteractEvent.LeftClickBlock onLeftClickBlock(PlayerEntity player, BlockPos pos, Direction face)
public static PlayerInteractEvent.RightClickBlock onRightClickBlock(PlayerEntity player, Hand hand, BlockPos pos, Direction face)
public static void onEmptyClick(PlayerEntity player, Hand hand)
public static void onEmptyLeftClick(PlayerEntity player)
private static ForgeHooks.LootTableContext getLootTableContext()
@Nullable public static LootTable loadLootTable(com.google.gson.Gson gson, ResourceLocation name, com.google.gson.JsonObject data, boolean custom, LootTableManager lootTableManager)
public static FluidAttributes createVanillaFluidAttributes(Fluid fluid)
public static java.lang.String readPoolName(com.google.gson.JsonObject json)
public static java.lang.String readLootEntryName(com.google.gson.JsonObject json, java.lang.String type)
public static boolean onCropsGrowPre(World worldIn, BlockPos pos, BlockState state, boolean def)
public static void onCropsGrowPost(World worldIn, BlockPos pos, BlockState state)
@Nullable public static CriticalHitEvent getCriticalHit(PlayerEntity player, Entity target, boolean vanillaCritical, float damageModifier)
public static void onAdvancement(ServerPlayerEntity player, Advancement advancement)
@Nullable public static java.lang.String getDefaultCreatorModId(@Nonnull ItemStack itemStack)
IForgeItem.getCreatorModId(net.minecraft.item.ItemStack)
. Call that method instead.public static boolean onFarmlandTrample(World world, BlockPos pos, BlockState state, float fallDistance, Entity entity)
public static void setBlockToolSetter(org.apache.logging.log4j.util.TriConsumer<Block,ToolType,java.lang.Integer> setter)
private static <T,E> T getPrivateValue(java.lang.Class<? super E> classToAccess, @Nullable E instance, int fieldIndex)
public static int onNoteChange(World world, BlockPos pos, BlockState state, int old, int _new)
public static int canEntitySpawn(MobEntity entity, IWorld world, double x, double y, double z, AbstractSpawner spawner, SpawnReason spawnReason)
public static <T> void deserializeTagAdditions(Tag.Builder<T> builder, java.util.function.Function<ResourceLocation,java.util.Optional<T>> valueGetter, com.google.gson.JsonObject json)
@Nullable public static IDataSerializer<?> getSerializer(int id, IntIdentityHashBiMap<IDataSerializer<?>> vanilla)
public static int getSerializerId(IDataSerializer<?> serializer, IntIdentityHashBiMap<IDataSerializer<?>> vanilla)
public static boolean canEntityDestroy(World world, BlockPos pos, LivingEntity entity)
public static int getBurnTime(ItemStack stack)
public static void updateBurns()
public static java.util.List<ItemStack> modifyLoot(java.util.List<ItemStack> list, LootContext context)
list
- The loot generatedcontext
- The loot context that generated that loot