Update to 1.15

Due to the massive rendering changes, certain features, such as emissive item rendering and the forge block rendering/lighting pipeline are currently disabled.

Co-authored-by: David Quintana <[email protected]>
Co-authored-by: tterrag <[email protected]>
Co-authored-by: Unnoen <[email protected]>
This commit is contained in:
authored and David Quintana committed 2019-12-17 03:38:12 +01:00
1 parent 9e5ecaaf75
commit 1933d05e36
565 files changed
+11114 -13142

No files matched your search

@@ -61,7 +61,6 @@ import net.minecraft.state.IProperty;
import net.minecraft.state.properties.BedPart;
import net.minecraft.tags.BlockTags;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
@@ -71,7 +70,7 @@ 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.IEnviromentBlockReader;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.IWorldWriter;
@@ -118,7 +117,7 @@ public interface IForgeBlock
* @param pos
* @return The light value
*/
default int getLightValue(BlockState state, IEnviromentBlockReader world, BlockPos pos)
default int getLightValue(BlockState state, ILightReader world, BlockPos pos)
{
return state.getLightValue();
}
@@ -152,7 +151,7 @@ public interface IForgeBlock
* @deprecated This is no longer used for rendering logic.
*/
@Deprecated
default boolean doesSideBlockRendering(BlockState state, IEnviromentBlockReader world, BlockPos pos, Direction face)
default boolean doesSideBlockRendering(BlockState state, ILightReader world, BlockPos pos, Direction face)
{
return state.isOpaqueCube(world, pos);
}
@@ -383,7 +382,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 || Block.isDirt(getBlock())
return (isAir(state, world, pos) || state.isIn(BlockTags.LEAVES)) || this == Blocks.GRASS_BLOCK || state.isIn(net.minecraftforge.common.Tags.Blocks.DIRT)
|| getBlock().isIn(BlockTags.LOGS) || getBlock().isIn(BlockTags.SAPLINGS) || this == Blocks.VINE;
}
@@ -559,7 +558,7 @@ public interface IForgeBlock
*/
default void onPlantGrow(BlockState state, IWorld world, BlockPos pos, BlockPos source)
{
if (Block.isDirt(getBlock()))
if (state.isIn(net.minecraftforge.common.Tags.Blocks.DIRT))
world.setBlockState(pos, Blocks.DIRT.getDefaultState(), 2);
}
@@ -751,15 +750,6 @@ public interface IForgeBlock
return state;
}
/**
* Queries if this block should render in a given layer.
* A custom {@link IBakedModel} can use {@link net.minecraftforge.client.MinecraftForgeClient#getRenderLayer()} to alter the model based on layer.
*/
default boolean canRenderInLayer(BlockState state, BlockRenderLayer layer)
{
return this.getBlock().getRenderLayer() == layer;
}
/**
* Sensitive version of getSoundType
* @param state The state
@@ -881,7 +871,16 @@ public interface IForgeBlock
@Nullable
default PathNodeType getAiPathNodeType(BlockState state, IBlockReader world, BlockPos pos, @Nullable MobEntity entity)
{
return state.isBurning(world, pos) ? PathNodeType.DAMAGE_FIRE : null;
return state.isBurning(world, pos) ? PathNodeType.DANGER_FIRE : null;
}
/**
* @param state The state
* @return true if the block is sticky block which used for pull or push adjacent blocks (use by piston)
*/
default boolean isSlimeBlock(BlockState state)
{
return state.getBlock() == Blocks.SLIME_BLOCK;
}
/**
@@ -890,7 +889,20 @@ public interface IForgeBlock
*/
default boolean isStickyBlock(BlockState state)
{
return state.getBlock() == Blocks.SLIME_BLOCK;
return state.getBlock() == Blocks.SLIME_BLOCK || state.getBlock() == Blocks.field_226907_mc_;
}
/**
* Determines if this block can stick to another block when pushed by a piston.
* @param state My state
* @param other Other block
* @return True to link blocks
*/
default boolean canStickTo(BlockState state, BlockState other)
{
if (state.getBlock() == Blocks.field_226907_mc_ && other.getBlock() == Blocks.SLIME_BLOCK) return false;
if (state.getBlock() == Blocks.SLIME_BLOCK && other.getBlock() == Blocks.field_226907_mc_) return false;
return state.isStickyBlock() || other.isStickyBlock();
}
/**
@@ -45,7 +45,7 @@ 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.IEnviromentBlockReader;
import net.minecraft.world.ILightReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
@@ -84,7 +84,7 @@ public interface IForgeBlockState
/**
* Get a light value for this block, taking into account the given state and coordinates, normal ranges are between 0 and 15
*/
default int getLightValue(IEnviromentBlockReader world, BlockPos pos)
default int getLightValue(ILightReader world, BlockPos pos)
{
return getBlockState().getBlock().getLightValue(getBlockState(), world, pos);
}
@@ -116,7 +116,7 @@ public interface IForgeBlockState
* @deprecated This is no longer used for rendering logic.
*/
@Deprecated
default boolean doesSideBlockRendering(IEnviromentBlockReader world, BlockPos pos, Direction face)
default boolean doesSideBlockRendering(ILightReader world, BlockPos pos, Direction face)
{
return getBlockState().getBlock().doesSideBlockRendering(getBlockState(), world, pos, face);
}
@@ -632,23 +632,6 @@ public interface IForgeBlockState
return getBlockState().getBlock().isToolEffective(getBlockState(), tool);
}
/**
* Can return IExtendedBlockState
*/
default BlockState getExtendedState(IBlockReader world, BlockPos pos)
{
return getBlockState().getBlock().getExtendedState(getBlockState(), world, pos);
}
/**
* Queries if this blockstate should render in a given layer.
* A custom {@link IBakedModel} can use {@link net.minecraftforge.client.MinecraftForgeClient#getRenderLayer()} to alter the model based on layer.
*/
default boolean canRenderInLayer(BlockRenderLayer layer)
{
return getBlockState().getBlock().canRenderInLayer(getBlockState(), layer);
}
/**
* Sensitive version of getSoundType
* @param world The world
@@ -735,6 +718,15 @@ public interface IForgeBlockState
return getBlockState().getBlock().canBeConnectedTo(getBlockState(), world, pos, facing);
}
/**
* @param state The state
* @return true if the block is sticky block which used for pull or push adjacent blocks (use by piston)
*/
default boolean isSlimeBlock()
{
return getBlockState().getBlock().isSlimeBlock(getBlockState());
}
/**
* @param state The state
* @return true if the block is sticky block which used for pull or push adjacent blocks (use by piston)
@@ -744,6 +736,16 @@ public interface IForgeBlockState
return getBlockState().getBlock().isStickyBlock(getBlockState());
}
/**
* Determines if this block can stick to another block when pushed by a piston.
* @param other Other block
* @return True to link blocks
*/
default boolean canStickTo(BlockState other)
{
return getBlockState().getBlock().canStickTo(getBlockState(), other);
}
/**
* Chance that fire will spread and consume this block.
* 300 being a 100% chance, 0, being a 0% chance.
@@ -851,6 +853,17 @@ public interface IForgeBlockState
return getBlockState().getBlock().isBurning(getBlockState(), world, pos);
}
/**
* Get the {@code PathNodeType} for this block. Return {@code null} for vanilla behavior.
*
* @return the PathNodeType
*/
@Nullable
default PathNodeType getAiPathNodeType(IBlockReader world, BlockPos pos)
{
return getAiPathNodeType(world, pos, null);
}
/**
* Get the {@code PathNodeType} for this block. Return {@code null} for vanilla behavior.
*
@@ -22,12 +22,14 @@ package net.minecraftforge.common.extensions;
import javax.annotation.Nullable;
import net.minecraft.client.audio.MusicTicker;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biomes;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.dimension.DimensionType;
@@ -114,7 +116,7 @@ public interface IForgeDimension
*
* @see net.minecraft.client.renderer.GameRenderer#updateLightmap(float)
*/
default void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, float[] colors) {}
default void getLightmapColors(float partialTicks, float sunBrightness, float skyLight, float blockLight, Vector3f colors) {}
void resetRainAndThunder();
@@ -149,7 +151,7 @@ public interface IForgeDimension
*/
default SleepResult canSleepAt(net.minecraft.entity.player.PlayerEntity player, BlockPos pos)
{
return (getDimension().canRespawnHere() && getWorld().getBiome(pos) != net.minecraft.world.biome.Biomes.NETHER) ? SleepResult.ALLOW : SleepResult.BED_EXPLODES;
return (getDimension().canRespawnHere() && getWorld().func_226691_t_(pos) != Biomes.NETHER) ? SleepResult.ALLOW : SleepResult.BED_EXPLODES;
}
enum SleepResult
@@ -159,39 +161,9 @@ public interface IForgeDimension
BED_EXPLODES;
}
default Biome getBiome(BlockPos pos)
{
return getWorld().getBiomeBody(pos);
}
default boolean isDaytime()
{
return getWorld().getSkylightSubtracted() < 4;
}
/**
* The current sun brightness factor for this dimension.
* 0.0f means no light at all, and 1.0f means maximum sunlight.
* This will be used for the "calculateSkylightSubtracted"
* which is for Sky light value calculation.
*
* @return The current brightness factor
**/
default float getSunBrightness(float partialTicks)
{
return getWorld().getSunBrightnessBody(partialTicks);
}
@OnlyIn(Dist.CLIENT)
default Vec3d getSkyColor(BlockPos cameraPos, float partialTicks)
{
return getWorld().getSkyColorBody(cameraPos, partialTicks);
}
@OnlyIn(Dist.CLIENT)
default Vec3d getCloudColor(float partialTicks)
{
return getWorld().getCloudColorBody(partialTicks);
return getDimension().getType() == DimensionType.OVERWORLD && getWorld().getSkylightSubtracted() < 4;
}
/**
@@ -204,15 +176,6 @@ public interface IForgeDimension
return Dimension.MOON_PHASE_FACTORS[this.getDimension().getMoonPhase(time)];
}
/**
* Gets the Star Brightness for rendering sky.
* */
@OnlyIn(Dist.CLIENT)
default float getStarBrightness(float partialTicks)
{
return getWorld().getStarBrightnessBody(partialTicks);
}
default void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) { }
default void calculateInitialWeather()
@@ -258,7 +221,7 @@ public interface IForgeDimension
default boolean isHighHumidity(BlockPos pos)
{
return getWorld().getBiome(pos).isHighHumidity();
return getWorld().func_226691_t_(pos).isHighHumidity();
}
default int getHeight()
@@ -271,11 +234,6 @@ public interface IForgeDimension
return getDimension().isNether() ? 128 : 256;
}
default double getHorizon()
{
return getWorld().getWorldInfo().getGenerator().getHorizon(getWorld());
}
default int getSeaLevel()
{
return 63;
@@ -21,11 +21,15 @@ package net.minecraftforge.common.extensions;
import java.util.List;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.gui.DisplayEffectsScreen;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.Potion;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
public interface IForgeEffectInstance {
@@ -33,6 +37,59 @@ public interface IForgeEffectInstance {
return (EffectInstance)this;
}
/**
* If the Potion effect should be displayed in the players inventory
* @return true to display it (default), false to hide it.
*/
default boolean shouldRender() {
return getEffectInstance().getPotion().shouldRender(getEffectInstance());
}
/**
* If the standard PotionEffect text (name and duration) should be drawn when this potion is active.
* @return true to draw the standard text
*/
default boolean shouldRenderInvText() {
return getEffectInstance().getPotion().shouldRenderInvText(getEffectInstance());
}
/**
* If the Potion effect should be displayed in the player's ingame HUD
* @return true to display it (default), false to hide it.
*/
default boolean shouldRenderHUD() {
return getEffectInstance().getPotion().shouldRenderHUD(getEffectInstance());
}
/**
* Called to draw the this Potion onto the player's inventory when it's active.
* This can be used to e.g. render Potion icons from your own texture.
*
* @param gui the gui instance
* @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);
}
/**
* 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 gui the gui instance
* @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);
}
/***
* Returns a list of curative items for the potion effect
* By default, this list is initialized using {@link Potion#getCurativeItems}
@@ -19,14 +19,12 @@
package net.minecraftforge.common.extensions;
import net.minecraft.entity.MoverType;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.item.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.common.IMinecartCollisionHandler;
public interface IForgeEntityMinecart
@@ -54,9 +52,9 @@ public interface IForgeEntityMinecart
*/
default BlockPos getCurrentRailPosition()
{
int x = MathHelper.floor(getMinecart().posX);
int y = MathHelper.floor(getMinecart().posY);
int z = MathHelper.floor(getMinecart().posZ);
int x = MathHelper.floor(getMinecart().func_226277_ct_());
int y = MathHelper.floor(getMinecart().func_226278_cu_());
int z = MathHelper.floor(getMinecart().func_226281_cx_());
BlockPos pos = new BlockPos(x, y - 1, z);
if (getMinecart().world.getBlockState(pos).isIn(BlockTags.RAILS)) pos = pos.down();
return pos;
@@ -27,10 +27,8 @@ 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.Fluids;
import net.minecraft.fluid.IFluidState;
import net.minecraft.tags.Tag;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@@ -109,10 +107,11 @@ public interface IForgeFluid
* Queries if this fluid should render in a given layer.
* A custom {@link IBakedModel} can use {@link net.minecraftforge.client.MinecraftForgeClient#getRenderLayer()} to alter the model based on layer.
*/
/* TODO: reimplement
default boolean canRenderInLayer(IFluidState state, BlockRenderLayer layer)
{
return this.getFluid().getRenderLayer() == layer;
}
}*/
/**
* Retrieves a list of tags names this is known to be associated with.
@@ -26,7 +26,6 @@ import net.minecraft.entity.Entity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.IFluidState;
import net.minecraft.tags.Tag;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.IWorldReader;
@@ -75,8 +74,9 @@ public interface IForgeFluidState
* Queries if this fluidstate should render in a given layer.
* A custom {@link IBakedModel} can use {@link net.minecraftforge.client.MinecraftForgeClient#getRenderLayer()} to alter the model based on layer.
*/
/* TODO: reimplement
default boolean canRenderInLayer(BlockRenderLayer layer)
{
return getFluidState().getFluid().canRenderInLayer(getFluidState(), layer);
}
}*/
}
@@ -660,7 +660,7 @@ public interface IForgeItem
*/
default boolean canContinueUsing(ItemStack oldStack, ItemStack newStack)
{
return oldStack.equals(newStack);
return ItemStack.areItemsEqualIgnoreDurability(oldStack, newStack);
}
/**
@@ -350,6 +350,19 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundNBT>
return getStack().getItem().onDroppedByPlayer(getStack(), player);
}
/**
* Allow the item one last chance to modify its name used for the tool highlight
* useful for adding something extra that can't be removed by a user in the
* displayed name, such as a mode of operation.
*
* @param displayName the name that will be displayed unless it is changed in
* this method.
*/
default String getHighlightTip(String displayName)
{
return getStack().getItem().getHighlightTip(getStack(), displayName);
}
/**
* Get the NBT data to be sent to the client. The Item can control what data is kept in the tag.
*
@@ -119,7 +119,7 @@ public interface IForgeWorldType
default <T extends IArea, C extends IExtendedNoiseRandom<T>> IAreaFactory<T> getBiomeLayer(IAreaFactory<T> parentLayer,
OverworldGenSettings chunkSettings, LongFunction<C> contextFactory)
{
parentLayer = (new BiomeLayer(getWorldType(), chunkSettings)).apply(contextFactory.apply(200L), parentLayer);
parentLayer = (new BiomeLayer(getWorldType(), chunkSettings.getBiomeId())).apply(contextFactory.apply(200L), parentLayer);
parentLayer = AddBambooForestLayer.INSTANCE.apply(contextFactory.apply(1001L), parentLayer);
parentLayer = LayerUtil.repeat(1000L, ZoomLayer.NORMAL, parentLayer, 2, contextFactory);
parentLayer = EdgeBiomeLayer.INSTANCE.apply(contextFactory.apply(1000L), parentLayer);