Setup and import of 1.16 YEET

This commit is contained in:
cpw committed 2020-06-25 17:55:38 -04:00
1 parent 56397043bb
commit 6d15febdb3
931 files changed
+18847 -9127

No files matched your search

@@ -0,0 +1,76 @@
package net.minecraftforge.common.extensions;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.BlockState;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.state.properties.RailShape;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import javax.annotation.Nullable;
public interface IAbstractRailBlock
{
default AbstractBlock getAbstractBlock()
{
return (AbstractBlock)this;
}
/**
* Return true if the rail can make corners.
* Used by placement logic.
* @param world The world.
* @param pos Block's position in world
* @return True if the rail can make corners.
*/
boolean isFlexibleRail(BlockState state, IBlockReader world, BlockPos pos);
/**
* Returns true if the rail can make up and down slopes.
* Used by placement logic.
* @param world The world.
* @param pos Block's position in world
* @return True if the rail can make slopes.
*/
default boolean canMakeSlopes(BlockState state, IBlockReader world, BlockPos pos)
{
return true;
}
/**
* Return the rail's direction.
* Can be used to make the cart think the rail is a different shape,
* for example when making diamond junctions or switches.
* The cart parameter will often be null unless it it called from EntityMinecart.
*
* @param world The world.
* @param pos Block's position in world
* @param state The BlockState
* @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
* @return The direction.
*/
RailShape getRailDirection(BlockState state, IBlockReader world, BlockPos pos, @Nullable AbstractMinecartEntity cart);
/**
* Returns the max speed of the rail at the specified position.
* @param world The world.
* @param cart The cart on the rail, may be null.
* @param pos Block's position in world
* @return The max speed of the current rail.
*/
default float getRailMaxSpeed(BlockState state, World world, BlockPos pos, net.minecraft.entity.item.minecart.AbstractMinecartEntity cart)
{
return 0.4f;
}
/**
* This function is called by any minecart that passes over this rail.
* It is called once per update tick that the minecart is on the rail.
* @param world The world.
* @param cart The cart on the rail.
* @param pos Block's position in world
*/
default void onMinecartPass(BlockState state, World world, BlockPos pos, net.minecraft.entity.item.minecart.AbstractMinecartEntity cart){}
}
@@ -26,18 +26,8 @@ import java.util.function.Predicate;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.BedBlock;
import net.minecraft.block.FarmlandBlock;
import net.minecraft.block.FenceGateBlock;
import net.minecraft.block.FireBlock;
import net.minecraft.block.HorizontalBlock;
import net.minecraft.block.IBeaconBeamColorProvider;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.StainedGlassBlock;
import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.block.BlockState;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.enchantment.EnchantmentHelper;
@@ -50,13 +40,12 @@ import net.minecraft.entity.boss.dragon.EnderDragonEntity;
import net.minecraft.entity.boss.WitherEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.WitherSkullEntity;
import net.minecraft.fluid.IFluidState;
import net.minecraft.block.Blocks;
import net.minecraft.fluid.FluidState;
import net.minecraft.potion.Effects;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.pathfinding.PathNodeType;
import net.minecraft.state.IProperty;
import net.minecraft.state.Property;
import net.minecraft.state.properties.BedPart;
import net.minecraft.tags.BlockTags;
import net.minecraft.tileentity.TileEntity;
@@ -66,20 +55,14 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.IWorldWriter;
import net.minecraft.world.World;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.*;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.dimension.EndDimension;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.ToolType;
@SuppressWarnings("deprecation")
@@ -212,7 +195,7 @@ public interface IForgeBlock
* @param fluid The current fluid state at current position
* @return True if the block is actually destroyed.
*/
default boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid)
default boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid)
{
getBlock().onBlockHarvested(world, pos, state, player);
return world.setBlockState(pos, fluid.getBlockState(), world.isRemote ? 11 : 3);
@@ -259,7 +242,7 @@ public interface IForgeBlock
* @param sleeper The sleeper or camera entity, null in some cases.
* @return The spawn position
*/
default Optional<Vec3d> getBedSpawnPosition(EntityType<?> entityType, BlockState state, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
default Optional<Vector3d> getBedSpawnPosition(EntityType<?> entityType, BlockState state, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
{
if (world instanceof World)
{
@@ -347,7 +330,7 @@ public interface IForgeBlock
*/
default boolean canBeReplacedByLeaves(BlockState state, IWorldReader world, BlockPos pos)
{
return isAir(state, world, pos) || state.isIn(BlockTags.LEAVES);
return isAir(state, world, pos) || state.func_235714_a_(BlockTags.LEAVES);
}
/**
@@ -360,7 +343,7 @@ public interface IForgeBlock
*/
default boolean canBeReplacedByLogs(BlockState state, IWorldReader world, BlockPos pos)
{
return (isAir(state, world, pos) || state.isIn(BlockTags.LEAVES)) || this == Blocks.GRASS_BLOCK || state.isIn(net.minecraftforge.common.Tags.Blocks.DIRT)
return (isAir(state, world, pos) || state.func_235714_a_(BlockTags.LEAVES)) || this == Blocks.GRASS_BLOCK || state.func_235714_a_(Tags.Blocks.DIRT)
|| getBlock().isIn(BlockTags.LOGS) || getBlock().isIn(BlockTags.SAPLINGS) || this == Blocks.VINE;
}
@@ -536,7 +519,7 @@ public interface IForgeBlock
*/
default void onPlantGrow(BlockState state, IWorld world, BlockPos pos, BlockPos source)
{
if (state.isIn(net.minecraftforge.common.Tags.Blocks.DIRT))
if (state.func_235714_a_(Tags.Blocks.DIRT))
world.setBlockState(pos, Blocks.DIRT.getDefaultState(), 2);
}
@@ -632,7 +615,7 @@ public interface IForgeBlock
@Nullable
default Direction[] getValidRotations(BlockState state, IBlockReader world, BlockPos pos)
{
for (IProperty<?> prop : state.getProperties())
for (Property<?> prop : state.func_235904_r_())
{
if ((prop.getName().equals("facing") || prop.getName().equals("rotation")) && prop.getValueClass() == Direction.class)
{
@@ -668,14 +651,14 @@ public interface IForgeBlock
@SuppressWarnings("unchecked")
default boolean recolorBlock(BlockState state, IWorld world, BlockPos pos, Direction facing, DyeColor color)
{
for (IProperty<?> prop : state.getProperties())
for (Property<?> prop : state.func_235904_r_())
{
if (prop.getName().equals("color") && prop.getValueClass() == DyeColor.class)
{
DyeColor current = (DyeColor)state.get(prop);
if (current != color && prop.getAllowedValues().contains(color))
{
world.setBlockState(pos, state.with(((IProperty<DyeColor>)prop), color), 3);
world.setBlockState(pos, state.with(((Property<DyeColor>)prop), color), 3);
return true;
}
}
@@ -801,7 +784,7 @@ public interface IForgeBlock
* @return The new fog color.
*/
@OnlyIn(Dist.CLIENT)
default Vec3d getFogColor(BlockState state, IWorldReader world, BlockPos pos, Entity entity, Vec3d originalColor, float partialTicks)
default Vector3d getFogColor(BlockState state, IWorldReader world, BlockPos pos, Entity entity, Vector3d originalColor, float partialTicks)
{
if (state.getMaterial() == Material.WATER)
{
@@ -817,11 +800,11 @@ public interface IForgeBlock
f12 = f12 * 0.3F + 0.6F;
}
}
return new Vec3d(0.02F + f12, 0.02F + f12, 0.2F + f12);
return new Vector3d(0.02F + f12, 0.02F + f12, 0.2F + f12);
}
else if (state.getMaterial() == Material.LAVA)
{
return new Vec3d(0.6F, 0.1F, 0.0F);
return new Vector3d(0.6F, 0.1F, 0.0F);
}
return originalColor;
}
@@ -837,7 +820,7 @@ public interface IForgeBlock
* @param viewpoint the viewpoint
* @return the block state that should be 'seen'
*/
default BlockState getStateAtViewpoint(BlockState state, IBlockReader world, BlockPos pos, Vec3d viewpoint)
default BlockState getStateAtViewpoint(BlockState state, IBlockReader world, BlockPos pos, Vector3d viewpoint)
{
return state;
}
@@ -983,15 +966,9 @@ public interface IForgeBlock
* @param side The face that the fire is coming from
* @return True if this block sustains fire, meaning it will never go out.
*/
default boolean isFireSource(BlockState state, IBlockReader world, BlockPos pos, Direction side)
default boolean isFireSource(BlockState state, IWorldReader world, BlockPos pos, Direction side)
{
if (side != Direction.UP)
return false;
if (getBlock() == Blocks.NETHERRACK || getBlock() == Blocks.MAGMA_BLOCK)
return true;
if (world instanceof IWorldReader && ((IWorldReader)world).getDimension() instanceof EndDimension && getBlock() == Blocks.BEDROCK)
return true;
return false;
return state.func_235714_a_(world.func_230315_m_().func_241515_q_());
}
/**
@@ -1006,7 +983,7 @@ public interface IForgeBlock
{
if (entity instanceof EnderDragonEntity)
{
return !BlockTags.DRAGON_IMMUNE.contains(this.getBlock());
return !BlockTags.DRAGON_IMMUNE.func_230235_a_(this.getBlock());
}
else if ((entity instanceof WitherEntity) ||
(entity instanceof WitherSkullEntity))
@@ -1029,7 +1006,7 @@ public interface IForgeBlock
* @return A result that suits your block
*/
@Nullable
default RayTraceResult getRayTraceResult(BlockState state, World world, BlockPos pos, Vec3d start, Vec3d end, RayTraceResult original)
default RayTraceResult getRayTraceResult(BlockState state, World world, BlockPos pos, Vector3d start, Vector3d end, RayTraceResult original)
{
return original;
}
@@ -1081,8 +1058,8 @@ public interface IForgeBlock
* @param fluidState The state of the fluid
* @return Whether the fluid overlay texture should be used
*/
default boolean shouldDisplayFluidOverlay(BlockState state, ILightReader world, BlockPos pos, IFluidState fluidState)
default boolean shouldDisplayFluidOverlay(BlockState state, IBlockDisplayReader world, BlockPos pos, FluidState fluidState)
{
return state.getBlock() == Blocks.GLASS || state.getBlock() instanceof StainedGlassBlock;
return state.getBlock() instanceof BreakableBlock || state.getBlock() instanceof StainedGlassBlock;
}
}
@@ -26,14 +26,13 @@ import javax.annotation.Nullable;
import net.minecraft.block.*;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.entity.Entity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.EntitySpawnPlacementRegistry.PlacementType;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.IFluidState;
import net.minecraft.fluid.FluidState;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -42,13 +41,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.*;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -162,7 +156,7 @@ public interface IForgeBlockState
* @param fluid The current fluid and block state for the position in the world.
* @return True if the block is actually destroyed.
*/
default boolean removedByPlayer(World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid)
default boolean removedByPlayer(World world, BlockPos pos, PlayerEntity player, boolean willHarvest, FluidState fluid)
{
return getBlockState().getBlock().removedByPlayer(getBlockState(), world, pos, player, willHarvest, fluid);
}
@@ -204,7 +198,7 @@ public interface IForgeBlockState
* @param sleeper The sleeper or camera entity, null in some cases.
* @return The spawn position
*/
default Optional<Vec3d> getBedSpawnPosition(EntityType<?> type, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
default Optional<Vector3d> getBedSpawnPosition(EntityType<?> type, IWorldReader world, BlockPos pos, @Nullable LivingEntity sleeper)
{
return getBlockState().getBlock().getBedSpawnPosition(type, getBlockState(), world, pos, sleeper);
}
@@ -673,7 +667,7 @@ public interface IForgeBlockState
* @return The new fog color.
*/
@OnlyIn(Dist.CLIENT)
default Vec3d getFogColor(IWorldReader world, BlockPos pos, Entity entity, Vec3d originalColor, float partialTicks)
default Vector3d getFogColor(IWorldReader world, BlockPos pos, Entity entity, Vector3d originalColor, float partialTicks)
{
return getBlockState().getBlock().getFogColor(getBlockState(), world, pos, entity, originalColor, partialTicks);
}
@@ -688,7 +682,7 @@ public interface IForgeBlockState
* @param viewpoint the viewpoint
* @return the block state that should be 'seen'
*/
default BlockState getStateAtViewpoint(IBlockReader world, BlockPos pos, Vec3d viewpoint)
default BlockState getStateAtViewpoint(IBlockReader world, BlockPos pos, Vector3d viewpoint)
{
return getBlockState().getBlock().getStateAtViewpoint(getBlockState(), world, pos, viewpoint);
}
@@ -816,7 +810,7 @@ public interface IForgeBlockState
* @param side The face that the fire is coming from
* @return True if this block sustains fire, meaning it will never go out.
*/
default boolean isFireSource(IBlockReader world, BlockPos pos, Direction side)
default boolean isFireSource(IWorldReader world, BlockPos pos, Direction side)
{
return getBlockState().getBlock().isFireSource(getBlockState(), world, pos, side);
}
@@ -920,7 +914,7 @@ public interface IForgeBlockState
* @param fluidState The state of the fluid
* @return Whether the fluid overlay texture should be used
*/
default boolean shouldDisplayFluidOverlay(ILightReader world, BlockPos pos, IFluidState fluidState)
default boolean shouldDisplayFluidOverlay(IBlockDisplayReader world, BlockPos pos, FluidState fluidState)
{
return getBlockState().getBlock().shouldDisplayFluidOverlay(getBlockState(), world, pos, fluidState);
}
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.extensions;
/*package net.minecraftforge.common.extensions;
import javax.annotation.Nullable;
@@ -59,7 +59,7 @@ public interface IForgeDimension
* always called before the world load event.
*
* @return initial holder for capabilities on the world
*/
* /
default net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities()
{
return null;
@@ -73,7 +73,7 @@ public interface IForgeDimension
* to nether multiplies coordinates by 1/8.
*
* @return The movement factor
*/
* /
default double getMovementFactor()
{
if (getDimension() instanceof NetherDimension)
@@ -115,7 +115,7 @@ public interface IForgeDimension
* @param colors The color values that will be used: [r, g, b].
*
* @see net.minecraft.client.renderer.GameRenderer#updateLightmap(float)
*/
* /
default void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, Vector3f colors) {}
void resetRainAndThunder();
@@ -134,7 +134,7 @@ public interface IForgeDimension
* Called on the client to get the music type to play when in this world type.
* At the time of calling, the client player and world are guaranteed to be non-null
* @return null to use vanilla logic, otherwise a MusicType to play in this world
*/
* /
@Nullable
@OnlyIn(Dist.CLIENT)
default MusicTicker.MusicType getMusicType()
@@ -148,7 +148,7 @@ public interface IForgeDimension
* @param player The player that is attempting to sleep
* @param pos The location where the player tries to sleep at (the position of the clicked on bed for example)
* @return the result of a player trying to sleep at the given location
*/
* /
default SleepResult canSleepAt(net.minecraft.entity.player.PlayerEntity player, BlockPos pos)
{
return (getDimension().canRespawnHere() && getWorld().getBiome(pos) != Biomes.NETHER) ? SleepResult.ALLOW : SleepResult.BED_EXPLODES;
@@ -170,7 +170,7 @@ public interface IForgeDimension
* Calculates the current moon phase factor.
* This factor is effective for slimes.
* (This method do not affect the moon rendering)
* */
* * /
default float getCurrentMoonPhaseFactor(long time)
{
return Dimension.MOON_PHASE_FACTORS[this.getDimension().getMoonPhase(time)];
@@ -247,7 +247,7 @@ public interface IForgeDimension
* @param z Z Position
* @param rotation the regular rotation of the marker
* @return True to 'spin' the cursor
*/
* /
default boolean shouldMapSpin(String entity, double x, double z, double rotation)
{
return getDimension().getType() == DimensionType.THE_NETHER;
@@ -258,9 +258,9 @@ public interface IForgeDimension
*
* @param player The player that is respawning
* @return The dimension to respawn the player in
*/
* /
default DimensionType getRespawnDimension(ServerPlayerEntity player)
{
return player.getSpawnDimension();
}
}
}*/
@@ -22,6 +22,7 @@ package net.minecraftforge.common.extensions;
import java.util.ArrayList;
import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.item.ItemStack;
@@ -64,25 +65,27 @@ public interface IForgeEffect {
*
* @param effect the active PotionEffect
* @param gui the gui instance
* @param mStack The MatrixStack
* @param x the x coordinate
* @param y the y coordinate
* @param z the z level
*/
@OnlyIn(Dist.CLIENT)
default void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen<?> gui, int x, int y, float z) { }
default void renderInventoryEffect(EffectInstance effect, DisplayEffectsScreen<?> gui, MatrixStack mStack, int x, int y, float z) { }
/**
* Called to draw the this Potion onto the player's ingame HUD when it's active.
* This can be used to e.g. render Potion icons from your own texture.
* @param effect the active PotionEffect
* @param gui the gui instance
* @param mStack The MatrixStack
* @param x the x coordinate
* @param y the y coordinate
* @param z the z level
* @param alpha the alpha value, blinks when the potion is about to run out
*/
@OnlyIn(Dist.CLIENT)
default void renderHUDEffect(EffectInstance effect, AbstractGui gui, int x, int y, float z, float alpha) { }
default void renderHUDEffect(EffectInstance effect, AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) { }
/**
* Get a fresh list of items that can cure this Potion.
@@ -21,6 +21,7 @@ package net.minecraftforge.common.extensions;
import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.item.ItemStack;
@@ -66,13 +67,14 @@ public interface IForgeEffectInstance {
* This can be used to e.g. render Potion icons from your own texture.
*
* @param gui the gui instance
* @param mStack The MatrixStack
* @param x the x coordinate
* @param y the y coordinate
* @param z the z level
*/
@OnlyIn(Dist.CLIENT)
default void renderInventoryEffect(DisplayEffectsScreen<?> gui, int x, int y, float z) {
getEffectInstance().getPotion().renderInventoryEffect(getEffectInstance(), gui, x, y, z);
default void renderInventoryEffect(DisplayEffectsScreen<?> gui, MatrixStack mStack, int x, int y, float z) {
getEffectInstance().getPotion().renderInventoryEffect(getEffectInstance(), gui, mStack, x, y, z);
}
/**
@@ -80,14 +82,15 @@ public interface IForgeEffectInstance {
* This can be used to e.g. render Potion icons from your own texture.
*
* @param gui the gui instance
* @param mStack The MatrixStack
* @param x the x coordinate
* @param y the y coordinate
* @param z the z level
* @param alpha the alpha value, blinks when the potion is about to run out
*/
@OnlyIn(Dist.CLIENT)
default void renderHUDEffect(AbstractGui gui, int x, int y, float z, float alpha) {
getEffectInstance().getPotion().renderHUDEffect(getEffectInstance(), gui, x, y, z, alpha);
default void renderHUDEffect(AbstractGui gui, MatrixStack mStack, int x, int y, float z, float alpha) {
getEffectInstance().getPotion().renderHUDEffect(getEffectInstance(), gui, mStack, x, y, z, alpha);
}
/***
@@ -56,7 +56,7 @@ public interface IForgeEntityMinecart
int y = MathHelper.floor(getMinecart().getPosY());
int z = MathHelper.floor(getMinecart().getPosZ());
BlockPos pos = new BlockPos(x, y - 1, z);
if (getMinecart().world.getBlockState(pos).isIn(BlockTags.RAILS)) pos = pos.down();
if (getMinecart().world.getBlockState(pos).func_235714_a_(BlockTags.RAILS)) pos = pos.down();
return pos;
}
@@ -27,7 +27,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.entity.Entity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState;
import net.minecraft.fluid.FluidState;
import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
@@ -54,7 +54,7 @@ public interface IForgeFluid
* @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)
default boolean isEntityInside(FluidState state, IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag<Fluid> tag, boolean testingHead)
{
return state.isTagged(tag) && yToTest < (double)(pos.getY() + state.getActualHeight(world, pos) + 0.11111111F);
}
@@ -70,7 +70,7 @@ public interface IForgeFluid
* @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)
default Boolean isAABBInsideMaterial(FluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox, Material materialIn)
{
return null;
}
@@ -84,7 +84,7 @@ public interface IForgeFluid
* @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)
default Boolean isAABBInsideLiquid(FluidState state, IWorldReader world, BlockPos pos, AxisAlignedBB boundingBox)
{
return null;
}
@@ -98,7 +98,7 @@ public interface IForgeFluid
* @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)
default float getExplosionResistance(FluidState state, IWorldReader world, BlockPos pos, @Nullable Entity exploder, Explosion explosion)
{
return state.getExplosionResistance();
}
@@ -24,7 +24,7 @@ import javax.annotation.Nullable;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.entity.Entity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState;
import net.minecraft.fluid.FluidState;
import net.minecraft.tags.Tag;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
@@ -32,9 +32,9 @@ import net.minecraft.world.IWorldReader;
public interface IForgeFluidState
{
default IFluidState getFluidState()
default FluidState getFluidState()
{
return (IFluidState)this;
return (FluidState)this;
}
/**
@@ -45,7 +45,7 @@ public interface IForgeFluidState
* @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 tag 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.
*/
default boolean isEntityInside(IWorldReader world, BlockPos pos, Entity entity, double yToTest, Tag<Fluid> tag, boolean testingHead)
@@ -33,6 +33,7 @@ import net.minecraft.client.renderer.tileentity.ItemStackTileEntityRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.attributes.Attribute;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
@@ -48,6 +49,8 @@ import net.minecraft.util.ActionResultType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -68,7 +71,7 @@ public interface IForgeItem
* ItemStack sensitive version of getItemAttributeModifiers
*/
@SuppressWarnings("deprecation")
default Multimap<String, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack)
default Multimap<Attribute, AttributeModifier> getAttributeModifiers(EquipmentSlotType slot, ItemStack stack)
{
return getItem().getAttributeModifiers(slot);
}
@@ -95,7 +98,7 @@ public interface IForgeItem
* @param displayName the name that will be displayed unless it is changed in
* this method.
*/
default String getHighlightTip(ItemStack item, String displayName)
default ITextComponent getHighlightTip(ItemStack item, ITextComponent displayName)
{
return displayName;
}
@@ -616,7 +619,7 @@ public interface IForgeItem
*/
default boolean isBeaconPayment(ItemStack stack)
{
return Tags.Items.BEACON_PAYMENT.contains(stack.getItem());
return Tags.Items.BEACON_PAYMENT.func_230235_a_(stack.getItem());
}
/**
@@ -703,12 +706,13 @@ public interface IForgeItem
return null;
}
default ImmutableMap<String, ITimeValue> getAnimationParameters(final ItemStack stack, final World world, final LivingEntity entity)
{
com.google.common.collect.ImmutableMap.Builder<String, ITimeValue> builder = ImmutableMap.builder();
getItem().properties.forEach((k,v) -> builder.put(k.toString(), input -> v.call(stack, world, entity)));
return builder.build();
}
//TODO, properties dont exist anymore
// default ImmutableMap<String, ITimeValue> getAnimationParameters(final ItemStack stack, final World world, final LivingEntity entity)
// {
// com.google.common.collect.ImmutableMap.Builder<String, ITimeValue> builder = ImmutableMap.builder();
// getItem().properties.forEach((k,v) -> builder.put(k.toString(), input -> v.call(stack, world, entity)));
// return builder.build();
// }
/**
* Can this Item disable a shield
@@ -39,6 +39,8 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.stats.Stats;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.IFormattableTextComponent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.common.capabilities.ICapabilitySerializable;
@@ -358,7 +360,7 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
* @param displayName the name that will be displayed unless it is changed in
* this method.
*/
default String getHighlightTip(String displayName)
default ITextComponent getHighlightTip(ITextComponent displayName)
{
return getStack().getItem().getHighlightTip(getStack(), displayName);
}
@@ -19,24 +19,25 @@
package net.minecraftforge.common.extensions;
import java.util.Arrays;
import java.util.Collection;
import java.util.Optional;
import java.util.function.Function;
import javax.annotation.Nonnull;
import com.google.gson.JsonArray;
import net.minecraft.tags.Tag;
import net.minecraft.tags.TagCollection;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.data.IOptionalTagEntry;
import net.minecraft.data.TagsProvider;
import net.minecraft.tags.ITag;
public interface IForgeTagBuilder<T>
{
default Tag.Builder<T> addOptional(final TagCollection<T> collection, final ResourceLocation... locations)
default TagsProvider.Builder<T> getBuilder() {
return (TagsProvider.Builder<T>) this;
}
default TagsProvider.Builder<T> addTags(ITag.INamedTag<T>... values) {
TagsProvider.Builder<T> builder = getBuilder();
for (ITag.INamedTag<T> value : values) {
builder.func_240531_a_(value);
}
return builder;
}
/*default Tag.Builder<T> addOptional(final TagCollection<T> collection, final ResourceLocation... locations)
{
return addOptional(collection, Arrays.asList(locations));
}
@@ -104,5 +105,5 @@ public interface IForgeTagBuilder<T>
};
return ((Tag.Builder<T>)this).add(new TagTarget<>(tag));
}
}*/
}
@@ -43,7 +43,14 @@ public interface IForgeTileEntity extends ICapabilitySerializable<CompoundNBT>
@Override
default void deserializeNBT(CompoundNBT nbt)
{
getTileEntity().read(nbt);
//TODO re-evaluate
deserializeNBT(null, nbt);
}
// @Override TODO re-evaluate
default void deserializeNBT(BlockState state, CompoundNBT nbt)
{
getTileEntity().func_230337_a_(state, nbt);
}
@Override
@@ -72,9 +79,9 @@ public interface IForgeTileEntity extends ICapabilitySerializable<CompoundNBT>
*
* @param tag The {@link NBTTagCompound} sent from {@link #getUpdateTag()}
*/
default void handleUpdateTag(CompoundNBT tag)
default void handleUpdateTag(BlockState state, CompoundNBT tag)
{
getTileEntity().read(tag);
getTileEntity().func_230337_a_(state, tag);
}
/**
@@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.extensions;
/*package net.minecraftforge.common.extensions;
import java.util.function.LongFunction;
@@ -50,7 +50,7 @@ public interface IForgeWorldType
/**
* Called when 'Create New World' button is pressed before starting game
*/
* /
default void onGUICreateWorldPress()
{
}
@@ -60,7 +60,7 @@ public interface IForgeWorldType
*
* @param mc The Minecraft instance
* @param gui the createworld GUI
*/
* /
@OnlyIn(Dist.CLIENT)
default void onCustomizeButton(Minecraft mc, CreateWorldScreen gui)
{
@@ -89,7 +89,7 @@ public interface IForgeWorldType
* Get the height to render the clouds for this world type
*
* @return The height to render clouds at
*/
* /
default float getCloudHeight()
{
return 128.0F;
@@ -115,7 +115,7 @@ public interface IForgeWorldType
* the supplied size.
* @return An {@link IAreaFactory} that representing the Biomes to be generated.
* @see {@link GenLayerBiome}
*/
* /
default <T extends IArea, C extends IExtendedNoiseRandom<T>> IAreaFactory<T> getBiomeLayer(IAreaFactory<T> parentLayer,
OverworldGenSettings chunkSettings, LongFunction<C> contextFactory)
{
@@ -125,4 +125,4 @@ public interface IForgeWorldType
parentLayer = EdgeBiomeLayer.INSTANCE.apply(contextFactory.apply(1000L), parentLayer);
return parentLayer;
}
}
}*/