mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 20:12:19 +00:00
Fix #1451 Crash when placing decorative leaf blocks
This commit is contained in:
1 parent
a0d355d0aa
commit
dcf7776cc1
7 files changed
+127
-127
No files matched your search
@@ -11,27 +11,7 @@
|
||||
package forestry.arboriculture.models;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.arboriculture.genetics.Tree;
|
||||
import forestry.core.models.ModelBlockCached;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.arboriculture.ILeafSpriteProvider;
|
||||
@@ -39,9 +19,16 @@ import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.arboriculture.blocks.BlockDecorativeLeaves;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
import forestry.core.models.ModelBlockDefault;
|
||||
import forestry.core.models.ModelBlockCached;
|
||||
import forestry.core.models.baker.ModelBaker;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ModelDecorativeLeaves extends ModelBlockCached<BlockDecorativeLeaves, TreeDefinition> {
|
||||
public ModelDecorativeLeaves() {
|
||||
@@ -59,7 +46,7 @@ public class ModelDecorativeLeaves extends ModelBlockCached<BlockDecorativeLeave
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TreeDefinition getWorldKey(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
protected TreeDefinition getWorldKey(@Nonnull IBlockState state) {
|
||||
Block block = state.getBlock();
|
||||
if (!(block instanceof BlockDecorativeLeaves)) {
|
||||
return null;
|
||||
@@ -92,4 +79,27 @@ public class ModelDecorativeLeaves extends ModelBlockCached<BlockDecorativeLeave
|
||||
// Set the particle sprite
|
||||
baker.setParticleSprite(leafSprite);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected IBakedModel bakeModel(@Nonnull IBlockState state, @Nonnull TreeDefinition key) {
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IModelBaker baker = new ModelBaker();
|
||||
|
||||
Block block = state.getBlock();
|
||||
if (!blockClass.isInstance(block)) {
|
||||
return null;
|
||||
}
|
||||
BlockDecorativeLeaves bBlock = blockClass.cast(block);
|
||||
|
||||
baker.setRenderBounds(Block.FULL_BLOCK_AABB);
|
||||
bakeBlock(bBlock, key, baker, false);
|
||||
|
||||
blockModel = baker.bakeModel(false);
|
||||
onCreateModel(blockModel);
|
||||
return blockModel;
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,19 @@
|
||||
package forestry.arboriculture.models;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Objects;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.arboriculture.blocks.BlockForestryLeaves;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
import forestry.arboriculture.genetics.TreeRoot;
|
||||
import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockPos;
|
||||
import forestry.core.models.ModelBlockCached;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -21,22 +32,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.arboriculture.blocks.BlockForestryLeaves;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
import forestry.arboriculture.genetics.TreeRoot;
|
||||
import forestry.arboriculture.items.ItemBlockLeaves;
|
||||
import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.core.models.ModelBlockDefault;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class ModelLeaves extends ModelBlockCached<BlockForestryLeaves, ModelLeaves.Key> {
|
||||
public static class Key {
|
||||
public final TextureAtlasSprite leafSprite, fruitSprite;
|
||||
@@ -87,7 +84,11 @@ public class ModelLeaves extends ModelBlockCached<BlockForestryLeaves, ModelLeav
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Key getWorldKey(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
protected Key getWorldKey(@Nonnull IBlockState state) {
|
||||
IExtendedBlockState stateExtended = (IExtendedBlockState) state;
|
||||
IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
|
||||
|
||||
TileLeaves tile = TileUtil.getTile(world, pos, TileLeaves.class);
|
||||
boolean fancy = Proxies.render.fancyGraphicsEnabled();
|
||||
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
package forestry.core.models;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public abstract class ModelBlockCached<B extends Block, K> extends ModelBlockDefault<B, K> {
|
||||
private static final Set<ModelBlockCached> CACHE_PROVIDERS = new HashSet<>();
|
||||
|
||||
@@ -38,8 +36,8 @@ public abstract class ModelBlockCached<B extends Block, K> extends ModelBlockDef
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IBakedModel getModel(@Nonnull IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
K key = getWorldKey(state, world, pos);
|
||||
protected IBakedModel getModel(@Nonnull IBlockState state) {
|
||||
K key = getWorldKey(state);
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -47,7 +45,9 @@ public abstract class ModelBlockCached<B extends Block, K> extends ModelBlockDef
|
||||
IBakedModel model = worldCache.getIfPresent(key);
|
||||
if (model == null) {
|
||||
model = bakeModel(state, key);
|
||||
worldCache.put(key, model);
|
||||
if (model != null) {
|
||||
worldCache.put(key, model);
|
||||
}
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,11 @@ import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.api.core.IModelBakerModel;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockPos;
|
||||
import forestry.core.models.baker.ModelBaker;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -23,22 +28,14 @@ import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.api.core.IModelBakerModel;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockPos;
|
||||
import forestry.core.models.baker.ModelBaker;
|
||||
|
||||
public abstract class ModelBlockDefault<B extends Block, K> implements IBakedModel {
|
||||
private ItemOverrideList overrideList;
|
||||
@Nonnull
|
||||
@@ -51,36 +48,36 @@ public abstract class ModelBlockDefault<B extends Block, K> implements IBakedMod
|
||||
this.blockClass = blockClass;
|
||||
}
|
||||
|
||||
protected IBakedModel bakeModel(IBlockState state, K key) {
|
||||
@Nullable
|
||||
protected IBakedModel bakeModel(@Nonnull IBlockState state, @Nonnull K key) {
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if(state instanceof IExtendedBlockState) {
|
||||
IModelBaker baker = new ModelBaker();
|
||||
IExtendedBlockState stateExtended = (IExtendedBlockState) state;
|
||||
IModelBaker baker = new ModelBaker();
|
||||
|
||||
IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
|
||||
Block block = state.getBlock();
|
||||
if (!blockClass.isInstance(block)) {
|
||||
return null;
|
||||
}
|
||||
B bBlock = blockClass.cast(block);
|
||||
|
||||
baker.setRenderBounds(state.getBoundingBox(world, pos));
|
||||
bakeBlock(bBlock, key, baker, false);
|
||||
|
||||
blockModel = baker.bakeModel(false);
|
||||
onCreateModel(blockModel);
|
||||
return blockModel;
|
||||
} else {
|
||||
Block block = state.getBlock();
|
||||
if (!blockClass.isInstance(block)) {
|
||||
return null;
|
||||
}
|
||||
B bBlock = blockClass.cast(block);
|
||||
|
||||
if (state instanceof IExtendedBlockState) {
|
||||
IExtendedBlockState stateExtended = (IExtendedBlockState) state;
|
||||
IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
|
||||
baker.setRenderBounds(state.getBoundingBox(world, pos));
|
||||
}
|
||||
|
||||
bakeBlock(bBlock, key, baker, false);
|
||||
|
||||
blockModel = baker.bakeModel(false);
|
||||
onCreateModel(blockModel);
|
||||
return blockModel;
|
||||
}
|
||||
|
||||
protected IBakedModel getModel(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return bakeModel(state, getWorldKey(state, world, pos));
|
||||
protected IBakedModel getModel(IBlockState state) {
|
||||
return bakeModel(state, getWorldKey(state));
|
||||
}
|
||||
|
||||
protected IBakedModel bakeModel(ItemStack stack, World world, K key) {
|
||||
@@ -110,16 +107,7 @@ public abstract class ModelBlockDefault<B extends Block, K> implements IBakedMod
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
IBakedModel model;
|
||||
|
||||
if (state instanceof IExtendedBlockState) {
|
||||
IExtendedBlockState stateExtended = (IExtendedBlockState) state;
|
||||
IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
|
||||
model = getModel(state, world, pos);
|
||||
} else {
|
||||
model = getModel(state, null, null);
|
||||
}
|
||||
IBakedModel model = getModel(state);
|
||||
|
||||
if (model != null) {
|
||||
return model.getQuads(state, side, rand);
|
||||
@@ -188,7 +176,8 @@ public abstract class ModelBlockDefault<B extends Block, K> implements IBakedMod
|
||||
}
|
||||
|
||||
protected abstract K getInventoryKey(@Nonnull ItemStack stack);
|
||||
protected abstract K getWorldKey(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos);
|
||||
|
||||
protected abstract K getWorldKey(@Nonnull IBlockState state);
|
||||
protected abstract void bakeBlock(@Nonnull B block, @Nonnull K key, @Nonnull IModelBaker baker, boolean inventory);
|
||||
|
||||
private class DefaultItemOverrideList extends ItemOverrideList {
|
||||
|
||||
@@ -12,13 +12,13 @@ package forestry.core.models.baker;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.api.core.IModelBakerModel;
|
||||
import forestry.core.models.ModelManager;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
@@ -28,18 +28,15 @@ import net.minecraft.client.renderer.block.model.FaceBakery;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelRotation;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.api.core.IModelBakerModel;
|
||||
import forestry.core.models.ModelManager;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
/**
|
||||
* A model baker to make custom models in the mod
|
||||
@@ -50,8 +47,8 @@ public class ModelBaker implements IModelBaker {
|
||||
private static final float quadsUV[] = new float[]{0, 0, 1, 1, 0, 0, 1, 1};
|
||||
private final List<ModelBakerFace> faces = new ArrayList<>();
|
||||
private final List<Pair<IBlockState, IBakedModel>> bakedModels = new ArrayList<>();
|
||||
|
||||
protected AxisAlignedBB renderBounds;
|
||||
@Nonnull
|
||||
protected AxisAlignedBB renderBounds = Block.FULL_BLOCK_AABB;
|
||||
|
||||
protected ModelBakerModel currentModel = new ModelBakerModel(ModelManager.getInstance().DEFAULT_BLOCK);
|
||||
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
package forestry.farming.models;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Objects;
|
||||
|
||||
import forestry.arboriculture.models.ModelLeaves;
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockPos;
|
||||
import forestry.core.models.ModelBlockCached;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.farming.blocks.BlockFarm;
|
||||
import forestry.farming.blocks.EnumFarmBlockType;
|
||||
import forestry.farming.tiles.TileFarm;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.core.models.ModelBlockDefault;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.farming.blocks.BlockFarm;
|
||||
import forestry.farming.blocks.EnumFarmBlockType;
|
||||
import forestry.farming.tiles.TileFarm;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class ModelFarmBlock extends ModelBlockCached<BlockFarm, ModelFarmBlock.Key> {
|
||||
public static class Key {
|
||||
public final EnumFarmBlockTexture texture;
|
||||
@@ -63,7 +60,11 @@ public class ModelFarmBlock extends ModelBlockCached<BlockFarm, ModelFarmBlock.K
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Key getWorldKey(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
|
||||
protected Key getWorldKey(@Nonnull IBlockState state) {
|
||||
IExtendedBlockState stateExtended = (IExtendedBlockState) state;
|
||||
IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
|
||||
|
||||
TileFarm farm = TileUtil.getTile(world, pos, TileFarm.class);
|
||||
EnumFarmBlockTexture texture = EnumFarmBlockTexture.BRICK;
|
||||
EnumFarmBlockType type = EnumFarmBlockType.PLAIN;
|
||||
|
||||
@@ -11,29 +11,28 @@
|
||||
package forestry.greenhouse.models;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import forestry.api.core.CamouflageManager;
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflageItemHandler;
|
||||
import forestry.api.core.ICamouflagedTile;
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.propertys.UnlistedBlockPos;
|
||||
import forestry.core.models.ModelBlockDefault;
|
||||
import forestry.core.utils.CamouflageUtil;
|
||||
import forestry.greenhouse.blocks.BlockGreenhouse;
|
||||
import forestry.greenhouse.blocks.BlockGreenhouseType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
// DO NOT CACHE THIS. PLEASE. I BEG YOU. NOT IN THE CURRENT STATE.
|
||||
public class ModelGreenhouse extends ModelBlockDefault<BlockGreenhouse, ModelGreenhouse.Key> {
|
||||
@@ -59,8 +58,11 @@ public class ModelGreenhouse extends ModelBlockDefault<BlockGreenhouse, ModelGre
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Key getWorldKey(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
|
||||
return new Key(state instanceof IExtendedBlockState ? ((IExtendedBlockState) state) : null, world, pos);
|
||||
protected Key getWorldKey(@Nonnull IBlockState state) {
|
||||
IExtendedBlockState stateExtended = (IExtendedBlockState) state;
|
||||
IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
|
||||
return new Key(stateExtended, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user