Fixed all compile errors except the 4 in KeyBinding.

This commit is contained in:
LexManos committed 2018-09-21 15:50:37 -07:00
1 parent a0e217b1dc
commit c191851ec0
31 files changed
+921 -465

No files matched your search

@@ -28,6 +28,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Deque;
import java.util.HashSet;
import java.util.List;
@@ -53,6 +54,7 @@ import net.minecraft.advancements.AdvancementManager;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFarmland;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockWorldState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
@@ -591,13 +593,9 @@ public class ForgeHooks
{
int looting = 0;
if (killer instanceof EntityLivingBase)
{
looting = EnchantmentHelper.getLootingModifier((EntityLivingBase)killer);
}
if (target instanceof EntityLivingBase)
{
looting = getLootingLevel((EntityLivingBase)target, cause, looting);
}
return looting;
}
@@ -657,26 +655,19 @@ public class ForgeHooks
@Nullable
public static EntityItem onPlayerTossEvent(@Nonnull EntityPlayer player, @Nonnull ItemStack item, boolean includeName)
{
player.captureDrops = true;
player.captureDrops(Lists.newArrayList());
EntityItem ret = player.dropItem(item, false, includeName);
player.capturedDrops.clear();
player.captureDrops = false;
player.captureDrops(null);
if (ret == null)
{
return null;
}
ItemTossEvent event = new ItemTossEvent(ret, player);
if (MinecraftForge.EVENT_BUS.post(event))
{
return null;
}
if (!player.world.isRemote)
{
player.getEntityWorld().spawnEntity(event.getEntityItem());
}
return event.getEntityItem();
}
@@ -792,7 +783,7 @@ public class ForgeHooks
if (!entityPlayer.isAllowEdit())
{
if (itemstack.isEmpty() || !itemstack.canDestroy(world.getBlockState(pos).getBlock()))
if (itemstack.isEmpty() || !itemstack.func_206848_a(world.func_205772_D(), new BlockWorldState(world, pos, false)))
preCancelEvent = true;
}
}
@@ -973,32 +964,6 @@ public class ForgeHooks
return ItemStack.EMPTY;
}
public static boolean isInsideOfMaterial(Material material, Entity entity, BlockPos pos)
{
IBlockState state = entity.world.getBlockState(pos);
Block block = state.getBlock();
double eyes = entity.posY + (double)entity.getEyeHeight();
double filled = 1.0f; //If it's not a liquid assume it's a solid block
if (block instanceof IFluidBlock)
{
filled = ((IFluidBlock)block).getFilledPercentage(entity.world, pos);
}
/*else if (block instanceof BlockLiquid)
{
filled = 1.0 - (BlockLiquid.getLiquidHeightPercent(block.getMetaFromState(state)) - (1.0 / 9.0));
}*/
if (filled < 0)
{
return eyes > pos.getY() + (filled + 1);
}
else
{
return eyes < pos.getY() + filled;
}
}
public static boolean onPlayerAttackTarget(EntityPlayer player, Entity target)
{
if (MinecraftForge.EVENT_BUS.post(new AttackEntityEvent(player, target))) return false;
@@ -1215,7 +1180,6 @@ public class ForgeHooks
return ctx.validateEntryName(name);
}
//TODO: Some registry to support custom LootEntry types?
public static LootEntry deserializeJsonLootEntry(String type, JsonObject json, int weight, int quality, LootCondition[] conditions){ return null; }
public static String getLootEntryType(LootEntry entry){ return null; } //Companion to above function
@@ -1318,7 +1282,7 @@ public class ForgeHooks
public static boolean onFarmlandTrample(World world, BlockPos pos, IBlockState state, float fallDistance, Entity entity)
{
if (entity.canTrample(world, state.getBlock(), pos, fallDistance))
if (entity.canTrample(state, pos, fallDistance))
{
BlockEvent.FarmlandTrampleEvent event = new BlockEvent.FarmlandTrampleEvent(world, pos, state, fallDistance, entity);
MinecraftForge.EVENT_BUS.post(event);
@@ -295,7 +295,7 @@ public class CraftingHelper
for(ResourceLocation key : manager.func_199003_a("recipes", filename -> filename.equals("_constants.json")))
{
String path = key.getPath();
if (!path.equals("rrecipes/_constants.json")) //Top level only
if (!path.equals("recipes/_constants.json")) //Top level only
continue;
try (IResource iresource = manager.func_199002_a(key))
@@ -670,7 +670,6 @@ public interface IForgeBlock
return false;
}
/**
* Determines the amount of enchanting power this block can provide to an enchanting table.
* @param world The World
@@ -728,98 +727,51 @@ public interface IForgeBlock
return state.isTopSolid();
}
/**
* If this block should be notified of weak changes.
* Weak changes are changes 1 block away through a solid block.
* Similar to comparators.
*
* @param world The current world
* @param pos Block position in world
* @return true To be notified of changes
*/
default boolean getWeakChanges(IBlockState state, IWorldReader world, BlockPos pos)
{
return false;
}
/**
* Queries the class of tool required to harvest this block, if null is returned
* we assume that anything can harvest this block.
*/
ToolType getHarvestTool(IBlockState state);
/**
* Queries the harvest level of this item stack for the specified tool class,
* Returns -1 if this tool is not of the specified type
*
* @return Harvest level, or -1 if not the specified tool type.
*/
int getHarvestLevel(IBlockState state);
/**
* Checks if the specified tool type is efficient on this block,
* meaning that it digs at full speed.
*/
default boolean isToolEffective(IBlockState state, ToolType tool)
{
if (tool == ToolType.PICKAXE && (this.getBlock() == Blocks.REDSTONE_ORE || this.getBlock() == Blocks.REDSTONE_LAMP || this.getBlock() == Blocks.OBSIDIAN))
return false;
return tool == getHarvestTool(state);
}
/**
* Can return IExtendedBlockState
*/
default IBlockState getExtendedState(IBlockState state, IBlockReader world, BlockPos pos)
{
return state;
}
/**
* Called when the entity is inside this block, may be used to determined if the entity can breathing,
* display material overlays, or if the entity can swim inside a block.
* If this block should be notified of weak changes.
* Weak changes are changes 1 block away through a solid block.
* Similar to comparators.
*
* @param world that is being tested.
* @param blockpos position thats being tested.
* @param entity that is being tested.
* @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height.
* @param materialIn to test for.
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
* @return null for default behavior, true if the entity is within the material, false if it was not.
* @param world The current world
* @param pos Block position in world
* @return true To be notified of changes
*/
@Nullable
default Boolean isEntityInsideMaterial(IBlockState state, IWorldReader world, BlockPos blockpos, Entity entity, double yToTest, Material materialIn, boolean testingHead)
default boolean getWeakChanges(IBlockState state, IWorldReader world, BlockPos pos)
{
return null;
return false;
}
/**
* Called when boats or fishing hooks are inside the block to check if they are inside
* the material requested.
*
* @param world world that is being tested.
* @param pos block thats being tested.
* @param boundingBox box to test, generally the bounds of an entity that are besting tested.
* @param materialIn to check for.
* @return null for default behavior, true if the box is within the material, false if it was not.
* Queries the class of tool required to harvest this block, if null is returned
* we assume that anything can harvest this block.
*/
@Nullable
default Boolean isAABBInsideMaterial(IBlockState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn)
ToolType getHarvestTool(IBlockState state);
/**
* Queries the harvest level of this item stack for the specified tool class,
* Returns -1 if this tool is not of the specified type
*
* @return Harvest level, or -1 if not the specified tool type.
*/
int getHarvestLevel(IBlockState state);
/**
* Checks if the specified tool type is efficient on this block,
* meaning that it digs at full speed.
*/
default boolean isToolEffective(IBlockState state, ToolType tool)
{
return null;
if (tool == ToolType.PICKAXE && (this.getBlock() == Blocks.REDSTONE_ORE || this.getBlock() == Blocks.REDSTONE_LAMP || this.getBlock() == Blocks.OBSIDIAN))
return false;
return tool == getHarvestTool(state);
}
/**
* Called when entities are moving to check if they are inside a liquid
*
* @param world world that is being tested.
* @param pos block thats being tested.
* @param boundingBox box to test, generally the bounds of an entity that are besting tested.
* @return null for default behavior, true if the box is within the material, false if it was not.
* Can return IExtendedBlockState
*/
@Nullable
default Boolean isAABBInsideLiquid(IBlockState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox)
default IBlockState getExtendedState(IBlockState state, IBlockReader world, BlockPos pos)
{
return null;
return state;
}
/**
@@ -641,54 +641,6 @@ public interface IForgeBlockState
return getBlockState().getBlock().getExtendedState(getBlockState(), world, pos);
}
/**
* Called when the entity is inside this block, may be used to determined if the entity can breathing,
* display material overlays, or if the entity can swim inside a block.
*
* @param world that is being tested.
* @param pos position thats being tested.
* @param entity that is being tested.
* @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height.
* @param material to test for.
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
* @return null for default behavior, true if the entity is within the material, false if it was not.
*/
@Nullable
default Boolean isEntityInsideMaterial(IWorldReader world, BlockPos pos, Entity entity, double yToTest, Material material, boolean testingHead)
{
return getBlockState().getBlock().isEntityInsideMaterial(getBlockState(), world, pos, entity, yToTest, material, testingHead);
}
/**
* Called when boats or fishing hooks are inside the block to check if they are inside
* the material requested.
*
* @param world world that is being tested.
* @param pos block thats being tested.
* @param boundingBox box to test, generally the bounds of an entity that are besting tested.
* @param material to check for.
* @return null for default behavior, true if the box is within the material, false if it was not.
*/
@Nullable
default Boolean isAABBInsideMaterial(IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox, Material material)
{
return getBlockState().getBlock().isAABBInsideMaterial(getBlockState(), world, pos, boundingBox, material);
}
/**
* Called when entities are moving to check if they are inside a liquid
*
* @param world world that is being tested.
* @param pos block thats being tested.
* @param boundingBox box to test, generally the bounds of an entity that are besting tested.
* @return null for default behavior, true if the box is within the material, false if it was not.
*/
@Nullable
default Boolean isAABBInsideLiquid(IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox)
{
return getBlockState().getBlock().isAABBInsideLiquid(getBlockState(), world, pos, boundingBox);
}
/**
* Queries if this block should render in a given layer.
* ISmartBlockModel can use {@link net.minecraftforge.client.MinecraftForgeClient#getRenderLayer()} to alter their model based on layer.
@@ -19,9 +19,32 @@
package net.minecraftforge.common.extensions;
import java.util.Collection;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLeashKnot;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.entity.item.EntityBoat;
import net.minecraft.entity.item.EntityEnderCrystal;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.item.EntityPainting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemSpawnEgg;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IWorldReader;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
import net.minecraftforge.common.util.INBTSerializable;
public interface IForgeEntity extends ICapabilitySerializable<NBTTagCompound>
{
@@ -42,4 +65,107 @@ public interface IForgeEntity extends ICapabilitySerializable<NBTTagCompound>
}
return getEntity().writeToNBT(ret);
}
boolean canUpdate();
void canUpdate(boolean value);
@Nullable
Collection<EntityItem> captureDrops();
Collection<EntityItem> captureDrops(@Nullable Collection<EntityItem> captureDrops);
/**
* Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position.
* @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation.
*/
default boolean shouldRiderSit()
{
return true;
}
/**
* Called when a user uses the creative pick block button on this entity.
*
* @param target The full target the player is looking at
* @return A ItemStack to add to the player's inventory, empty ItemStack if nothing should be added.
*/
default ItemStack getPickedResult(RayTraceResult target)
{
if (this instanceof EntityPainting)
{
return new ItemStack(Items.PAINTING);
}
else if (this instanceof EntityLeashKnot)
{
return new ItemStack(Items.LEAD);
}
else if (this instanceof EntityItemFrame)
{
ItemStack held = ((EntityItemFrame)this).getDisplayedItem();
if (held.isEmpty())
return new ItemStack(Items.ITEM_FRAME);
else
return held.copy();
}
else if (this instanceof EntityMinecart)
{
return ((EntityMinecart)this).getCartItem();
}
else if (this instanceof EntityBoat)
{
return new ItemStack(((EntityBoat)this).getItemBoat());
}
else if (this instanceof EntityArmorStand)
{
return new ItemStack(Items.ARMOR_STAND);
}
else if (this instanceof EntityEnderCrystal)
{
return new ItemStack(Items.END_CRYSTAL);
}
else
{
ItemSpawnEgg egg = ItemSpawnEgg.func_200889_b(getEntity().func_200600_R());
if (egg != null) return new ItemStack(egg);
}
return ItemStack.EMPTY;
}
default boolean shouldRenderInPass(int pass)
{
return pass == 0;
}
/**
* If a rider of this entity can interact with this entity. Should return true on the
* ridden entity if so.
*
* @return if the entity can be interacted with from a rider
*/
default boolean canRiderInteract()
{
return false;
}
/**
* If the rider should be dismounted from the entity when the entity goes under water
*
* @param rider The entity that is riding
* @return if the entity should be dismounted when under water
*/
default boolean shouldDismountInWater(Entity rider)
{
return this instanceof EntityLivingBase;
}
/**
* Checks if this {@link Entity} can trample a {@link Block}.
*
* @param block The block being tested
* @param pos The block pos
* @param fallDistance The fall distance
* @return {@code true} if this entity can trample, {@code false} otherwise
*/
boolean canTrample(IBlockState state, BlockPos pos, float fallDistance);
}
@@ -0,0 +1,101 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.extensions;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState;
import net.minecraft.tags.Tag;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.IWorldReader;
public interface IForgeFluid
{
default Fluid getFluid()
{
return (Fluid) this;
}
/**
* Called when the entity is inside this block, may be used to determined if the entity can breathing,
* display material overlays, or if the entity can swim inside a block.
*
* @param world that is being tested.
* @param pos position thats being tested.
* @param entity that is being tested.
* @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height.
* @param tag Fluid category
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
*/
default boolean isEntityInside(IFluidState state, IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag<Fluid> tag, boolean testingHead)
{
return state.func_206884_a(tag) && yToTest - pos.getY() < state.func_206885_f() + 0.1F;
}
/**
* Called when boats or fishing hooks are inside the block to check if they are inside
* the material requested.
*
* @param world world that is being tested.
* @param pos block thats being tested.
* @param boundingBox box to test, generally the bounds of an entity that are besting tested.
* @param materialIn to check for.
* @return null for default behavior, true if the box is within the material, false if it was not.
*/
@Nullable
default Boolean isAABBInsideMaterial(IFluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn)
{
return null;
}
/**
* Called when entities are moving to check if they are inside a liquid
*
* @param world world that is being tested.
* @param pos block thats being tested.
* @param boundingBox box to test, generally the bounds of an entity that are besting tested.
* @return null for default behavior, true if the box is within the material, false if it was not.
*/
@Nullable
default Boolean isAABBInsideLiquid(IFluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox)
{
return null;
}
/**
* Location sensitive version of getExplosionResistance
*
* @param world The current world
* @param pos Block position in world
* @param exploder The entity that caused the explosion, can be null
* @param explosion The explosion
* @return The amount of the explosion absorbed.
*/
default float getExplosionResistance(IFluidState state, IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
{
return state.func_210200_l();
}
}
@@ -0,0 +1,71 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.extensions;
import javax.annotation.Nullable;
import net.minecraft.entity.Entity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState;
import net.minecraft.tags.Tag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.IWorldReader;
public interface IForgeFluidState
{
default IFluidState getFluidState()
{
return (IFluidState)this;
}
/**
* Called when the entity is inside this block, may be used to determined if the entity can breathing,
* display material overlays, or if the entity can swim inside a block.
*
* @param world that is being tested.
* @param pos position thats being tested.
* @param entity that is being tested.
* @param yToTest, primarily for testingHead, which sends the the eye level of the entity, other wise it sends a y that can be tested vs liquid height.
* @param material to test for.
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
*/
@Nullable
default boolean isEntityInside(IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag<Fluid> tag, boolean testingHead)
{
return getFluidState().func_206886_c().isEntityInside(getFluidState(), world, pos, entity, yToTest, tag, testingHead);
}
/**
* Location sensitive version of getExplosionResistance
*
* @param world The current world
* @param pos Block position in world
* @param exploder The entity that caused the explosion, can be null
* @param explosion The explosion
* @return The amount of the explosion absorbed.
*/
default float getExplosionResistance(IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
{
return getFluidState().func_206886_c().getExplosionResistance(getFluidState(), world, pos, exploder, explosion);
}
}
@@ -105,7 +105,7 @@ public interface IForgeItem
*
* @return Return PASS to allow vanilla handling, any other to skip normal code.
*/
default EnumActionResult onItemUseFirst(ItemUseContext context)
default EnumActionResult onItemUseFirst(ItemStack stack, ItemUseContext context)
{
return EnumActionResult.PASS;
}
@@ -23,10 +23,16 @@ import java.util.Set;
import javax.annotation.Nullable;
import net.minecraft.block.state.BlockWorldState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.stats.StatList;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
@@ -93,4 +99,29 @@ public interface IForgeItemStack extends ICapabilitySerializable<NBTTagCompound>
return getStack().getItem().getToolTypes(getStack());
}
default EnumActionResult onItemUseFirst(ItemUseContext context)
{
EntityPlayer entityplayer = context.func_195999_j();
BlockPos blockpos = context.func_195995_a();
BlockWorldState blockworldstate = new BlockWorldState(context.func_195991_k(), blockpos, false);
if (entityplayer != null && !entityplayer.capabilities.allowEdit && !getStack().func_206847_b(context.func_195991_k().func_205772_D(), blockworldstate)) {
return EnumActionResult.PASS;
} else {
Item item = getStack().getItem();
EnumActionResult enumactionresult = item.onItemUseFirst(getStack(), context);
if (entityplayer != null && enumactionresult == EnumActionResult.SUCCESS) {
entityplayer.addStat(StatList.OBJECT_USE_STATS.func_199076_b(item));
}
return enumactionresult;
}
}
default NBTTagCompound serializeNBT()
{
NBTTagCompound ret = new NBTTagCompound();
getStack().writeToNBT(ret);
return ret;
}
}
@@ -1,54 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.event.entity.minecart;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
/**
* MinecartCollisionEvent is fired when a minecart collides with an Entity.
* This event is fired whenever a minecraft collides in
* {@link EntityMinecart#applyEntityCollision(Entity)}.
*
* {@link #collider} contains the Entity the Minecart collided with.
*
* This event is not {@link Cancelable}.
*
* This event does not have a result. {@link HasResult}
*
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public class MinecartCollisionEvent extends MinecartEvent
{
private final Entity collider;
public MinecartCollisionEvent(EntityMinecart minecart, Entity collider)
{
super(minecart);
this.collider = collider;
}
public Entity getCollider()
{
return collider;
}
}
@@ -1,50 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.event.entity.minecart;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityEvent;
import net.minecraftforge.eventbus.api.Event;
/**
* MinecartEvent is fired whenever an event involving minecart entities occurs. <br>
* If a method utilizes this {@link net.minecraftforge.eventbus.api.Event} as its parameter, the method will <br>
* receive every child event of this class.<br>
* <br>
* {@link #minecart} contains the minecart entity involved with this event.<br>
* <br>
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.<br>
**/
public class MinecartEvent extends EntityEvent
{
private final EntityMinecart minecart;
public MinecartEvent(EntityMinecart minecart)
{
super(minecart);
this.minecart = minecart;
}
public EntityMinecart getMinecart()
{
return minecart;
}
}
@@ -1,63 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.event.entity.minecart;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import javax.annotation.Nonnull;
/**
* MinecartInteractEvent is fired when a player interacts with a minecart. <br>
* This event is fired whenever a player interacts with a minecart in
* {@link EntityMinecart#processInitialInteract(EntityPlayer, EnumHand)}.
* <br>
* <br>
* {@link #player} contains the EntityPlayer that is involved with this minecart interaction.<br>
* <br>
* This event is {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
* If this event is canceled, the player does not interact with the minecart.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@net.minecraftforge.eventbus.api.Cancelable
public class MinecartInteractEvent extends MinecartEvent
{
private final EntityPlayer player;
private final EnumHand hand;
public MinecartInteractEvent(EntityMinecart minecart, EntityPlayer player, EnumHand hand)
{
super(minecart);
this.player = player;
this.hand = hand;
}
public EntityPlayer getPlayer() { return player; }
@Nonnull
public ItemStack getItem() { return player.getHeldItem(hand); }
public EnumHand getHand() { return hand; }
}
@@ -1,54 +0,0 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2018.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.event.entity.minecart;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.Cancelable;
/**
* MinecartUpdateEvent is fired when a minecart is updated.<br>
* This event is fired whenever a minecart is updated in
* {@link EntityMinecart#onUpdate()}.<br>
* <br>
* {@link #pos} contains the coordinate of the track the entity is on {if applicable}.<br>
* <br>
* This event is not {@link net.minecraftforge.eventbus.api.Cancelable}.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public class MinecartUpdateEvent extends MinecartEvent
{
private final BlockPos pos;
public MinecartUpdateEvent(EntityMinecart minecart, BlockPos pos)
{
super(minecart);
this.pos = pos;
}
public BlockPos getPos()
{
return pos;
}
}