Fix up some issues with Build.gradle, Clean up code and switch to registry events for adding blocks and items.
This commit is contained in:
parent
37b34bfc02
commit
49a097283a
103
build.gradle
103
build.gradle
|
|
@ -27,7 +27,7 @@ repositories {
|
|||
name "fileRepo"
|
||||
dirs "repo"
|
||||
}
|
||||
maven {
|
||||
maven {
|
||||
name 'DVS1 Maven FS'
|
||||
url 'http://dvs1.progwml6.com/files/maven'
|
||||
}
|
||||
|
|
@ -49,8 +49,8 @@ minecraft {
|
|||
// default run configurations.
|
||||
// these can be tweaked, removed, or duplicated as needed.
|
||||
runConfig {
|
||||
name= "Minecraft Client"
|
||||
main= "net.minecraftforge.userdev.UserdevLauncher"
|
||||
name = "Minecraft Client"
|
||||
main = "net.minecraftforge.userdev.UserdevLauncher"
|
||||
ideaModuleName = "${project.name}_main"
|
||||
workingDirectory = project.file("run").canonicalPath
|
||||
environment "target", "fmluserdevclient"
|
||||
|
|
@ -63,8 +63,8 @@ minecraft {
|
|||
}
|
||||
|
||||
runConfig {
|
||||
name= "Minecraft Server"
|
||||
main= "net.minecraftforge.userdev.UserdevLauncher"
|
||||
name = "Minecraft Server"
|
||||
main = "net.minecraftforge.userdev.UserdevLauncher"
|
||||
ideaModuleName = "${project.name}_main"
|
||||
workingDirectory = project.file("run").canonicalPath
|
||||
environment "target", "fmluserdevserver"
|
||||
|
|
@ -87,47 +87,43 @@ def versionInfo = getGitVersion()
|
|||
version = minecraft_version + "-${versionInfo['IronChest.version']}"
|
||||
|
||||
// This wrangles the resources for the jar files- stuff like textures and languages
|
||||
processResources
|
||||
{
|
||||
processResources {
|
||||
// we're omitting the .xcf files - they're development only
|
||||
exclude '**/*.xcf'
|
||||
exclude '**/*.xcf'
|
||||
// we only want to do search/replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'META_INF/mods.toml'
|
||||
|
||||
include 'META-INF/mods.toml'
|
||||
|
||||
// replace version and mcversion
|
||||
expand 'version':project.version, 'mcversion':minecraft_version
|
||||
}
|
||||
|
||||
// copy everything else, thats not the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'META_INF/mods.toml'
|
||||
expand 'version': project.version, 'mcversion': minecraft_version
|
||||
}
|
||||
|
||||
// generate version.properties file from the git version data earlier
|
||||
doLast {
|
||||
def propsFile = new File(destinationDir, 'version.properties')
|
||||
def properties = new Properties()
|
||||
properties.putAll(versionInfo)
|
||||
properties['IronChest.build.mcversion'] = minecraft_version
|
||||
properties.store(propsFile.newWriter(), null)
|
||||
}
|
||||
// copy everything else, thats not the mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'META-INF/mods.toml'
|
||||
}
|
||||
|
||||
// generate version.properties file from the git version data earlier
|
||||
doLast {
|
||||
def propsFile = new File(destinationDir, 'version.properties')
|
||||
def properties = new Properties()
|
||||
properties.putAll(versionInfo)
|
||||
properties['IronChest.build.mcversion'] = minecraft_version
|
||||
properties.store(propsFile.newWriter(), null)
|
||||
}
|
||||
}
|
||||
|
||||
// Configure an upload task. this is setup for uploading to files.minecraftforge.net. There are other examples around
|
||||
uploadArchives {
|
||||
repositories.mavenDeployer {
|
||||
|
||||
dependsOn 'build'
|
||||
|
||||
if (project.hasProperty('forgeMavenPassword'))
|
||||
{
|
||||
if (project.hasProperty('forgeMavenPassword')) {
|
||||
repository(url: "http://files.minecraftforge.net/maven/manage/upload") {
|
||||
authentication(userName: project.getProperty('forgeMavenUser'), password: project.getProperty('forgeMavenPassword')) // the elvis operator. look it up.
|
||||
authentication(userName: project.getProperty('forgeMavenUser'), password: project.getProperty('forgeMavenPassword'))
|
||||
// the elvis operator. look it up.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// local repo folder. Might wanna juset use gradle install if you wanans end it to maven-local
|
||||
repository(url: 'file://localhost/' + project.file('repo').getAbsolutePath())
|
||||
}
|
||||
|
|
@ -175,32 +171,31 @@ uploadArchives {
|
|||
}
|
||||
|
||||
// This is a special task for pulling the version information from git and the environment (for BUILD_NUMBER)
|
||||
def getGitVersion()
|
||||
{
|
||||
def out = [:]
|
||||
def getGitVersion() {
|
||||
def out = [:]
|
||||
|
||||
// call git command.
|
||||
def outStream = new ByteArrayOutputStream()
|
||||
def result = exec {
|
||||
executable = 'git'
|
||||
args = [ 'describe', '--long', "--match=[^(jenkins)]*"]
|
||||
standardOutput = outStream
|
||||
}
|
||||
// call git command.
|
||||
def outStream = new ByteArrayOutputStream()
|
||||
def result = exec {
|
||||
executable = 'git'
|
||||
args = ['describe', '--long', "--match=[^(jenkins)]*"]
|
||||
standardOutput = outStream
|
||||
}
|
||||
|
||||
def fullVersion = outStream.toString().trim()
|
||||
def matcher = fullVersion =~ /(\d+).(\d+)-(\d+)-(.*)/
|
||||
def fullVersion = outStream.toString().trim()
|
||||
def matcher = fullVersion =~ /(\d+).(\d+)-(\d+)-(.*)/
|
||||
|
||||
def maj = matcher[0][1]
|
||||
def min = matcher[0][2]
|
||||
def rev = matcher[0][3]
|
||||
def bn = System.getenv("PROMOTED_NUMBER") ?: System.getenv("BUILD_NUMBER") ?: "1"
|
||||
def maj = matcher[0][1]
|
||||
def min = matcher[0][2]
|
||||
def rev = matcher[0][3]
|
||||
def bn = System.getenv("PROMOTED_NUMBER") ?: System.getenv("BUILD_NUMBER") ?: "1"
|
||||
|
||||
out['IronChest.build.major.number'] = maj.toString()
|
||||
out['IronChest.build.minor.number'] = min.toString()
|
||||
out['IronChest.build.revision.number'] = rev.toString()
|
||||
out['IronChest.build.githash'] = matcher[0][4].toString()
|
||||
out['IronChest.build.number' ] = bn.toString()
|
||||
out['IronChest.version' ] = "${maj}.${min}.${rev}.${bn}".toString()
|
||||
out['IronChest.build.major.number'] = maj.toString()
|
||||
out['IronChest.build.minor.number'] = min.toString()
|
||||
out['IronChest.build.revision.number'] = rev.toString()
|
||||
out['IronChest.build.githash'] = matcher[0][4].toString()
|
||||
out['IronChest.build.number'] = bn.toString()
|
||||
out['IronChest.version'] = "${maj}.${min}.${rev}.${bn}".toString()
|
||||
|
||||
return out
|
||||
return out
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,12 @@
|
|||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
|
||||
mod_version=1.0.0
|
||||
|
||||
# Minecraft Version Information
|
||||
minecraft_version=1.13
|
||||
minecraft_version_toml=13
|
||||
|
||||
# Forge Version Information
|
||||
forge_version=24.0.55-1.13-pre
|
||||
forge_version=24.0.58-1.13-pre
|
||||
forge_version_toml=24
|
||||
forge_group=net.minecraftforge.test
|
||||
|
||||
|
|
|
|||
|
|
@ -12,9 +12,16 @@ package cpw.mods.ironchest;
|
|||
|
||||
import cpw.mods.ironchest.client.ClientProxy;
|
||||
import cpw.mods.ironchest.common.ServerProxy;
|
||||
import cpw.mods.ironchest.common.ai.OcelotsSitOnChestsHandler;
|
||||
import cpw.mods.ironchest.common.blocks.BlockChest;
|
||||
import cpw.mods.ironchest.common.core.IronChestBlocks;
|
||||
import cpw.mods.ironchest.common.core.IronChestItems;
|
||||
import cpw.mods.ironchest.common.tileentity.IronChestEntityType;
|
||||
import cpw.mods.ironchest.common.util.BlockNames;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
|
@ -25,30 +32,70 @@ public class IronChest
|
|||
{
|
||||
public static final String MOD_ID = "ironchest";
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
public static IronChest instance;
|
||||
|
||||
public static ServerProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> ServerProxy::new);
|
||||
|
||||
public IronChestBlocks ironChestBlocks = new IronChestBlocks();
|
||||
|
||||
public IronChestItems ironChestItems = new IronChestItems();
|
||||
|
||||
public IronChestEntityType ironChestEntityType = new IronChestEntityType();
|
||||
|
||||
public IronChest()
|
||||
{
|
||||
instance = this;
|
||||
FMLModLoadingContext.get().getModEventBus().addListener(this::preInit);
|
||||
MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new IronChestBlocks());
|
||||
MinecraftForge.EVENT_BUS.register(new IronChestItems());
|
||||
MinecraftForge.EVENT_BUS.register(new IronChestEntityType());
|
||||
}
|
||||
|
||||
private void preInit(final FMLPreInitializationEvent event)
|
||||
{
|
||||
proxy.preInit();
|
||||
ironChestBlocks.registerBlocks();
|
||||
ironChestBlocks.registerItems();
|
||||
ironChestItems.registerItems();
|
||||
|
||||
if (IronChest.DEBUG)
|
||||
{
|
||||
debugPrints();
|
||||
}
|
||||
|
||||
ironChestEntityType.registerTileEntities();
|
||||
ironChestEntityType.createEntries();
|
||||
}
|
||||
|
||||
private void debugPrints()
|
||||
{
|
||||
EnumFacing[] e = { EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST };
|
||||
|
||||
System.out.println("--------------------------");
|
||||
|
||||
for (EnumFacing facing : e)
|
||||
{
|
||||
IBlockState iBlockState = Block.func_149684_b(BlockNames.IRON_CHEST).getDefaultState().with(BlockChest.FACING, facing);
|
||||
|
||||
System.out.println("iBlockState " + iBlockState);
|
||||
|
||||
int stateID = Block.getStateId(iBlockState);
|
||||
|
||||
System.out.println("stateID " + stateID);
|
||||
|
||||
IBlockState iBlockStateOut = Block.getStateById(stateID);
|
||||
|
||||
System.out.println("iBlockStateOut " + iBlockStateOut);
|
||||
|
||||
Block blockOut = Block.func_149729_e(stateID);
|
||||
|
||||
System.out.println("blockOut " + blockOut);
|
||||
|
||||
System.out.println("--------------------------");
|
||||
}
|
||||
|
||||
System.out.println("--------------------------");
|
||||
|
||||
for (Object i : Block.BLOCK_STATE_IDS)
|
||||
{
|
||||
System.out.println("Test: " + i);
|
||||
}
|
||||
System.out.println("--------------------------");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ public class ClientProxy extends ServerProxy
|
|||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void preInit()
|
||||
{
|
||||
System.out.println("hello");
|
||||
super.preInit();
|
||||
|
||||
for (IronChestType type : IronChestType.values())
|
||||
{
|
||||
if (type.clazz != null)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ package cpw.mods.ironchest.client.renderer;
|
|||
|
||||
import com.google.common.primitives.SignedBytes;
|
||||
import cpw.mods.ironchest.common.blocks.BlockChest;
|
||||
import cpw.mods.ironchest.common.blocks.BlockIronChest;
|
||||
import cpw.mods.ironchest.common.blocks.IronChestType;
|
||||
import cpw.mods.ironchest.common.core.IronChestBlocks;
|
||||
import cpw.mods.ironchest.common.tileentity.TileEntityCrystalChest;
|
||||
|
|
@ -67,7 +66,7 @@ public class TileEntityIronChestRenderer<T extends TileEntity & IChestLid> exten
|
|||
GlStateManager.depthMask(true);
|
||||
IBlockState iblockstate = tileEntityIn.hasWorld() ?
|
||||
tileEntityIn.getBlockState() :
|
||||
(IBlockState) IronChestBlocks.ironChestBlock.getDefaultState().with(BlockIronChest.FACING, EnumFacing.SOUTH);
|
||||
(IBlockState) IronChestBlocks.ironChestBlock.getDefaultState().with(BlockChest.FACING, EnumFacing.NORTH);
|
||||
IronChestType chesttype = IronChestType.IRON;
|
||||
IronChestType typeNew = BlockChest.getTypeFromBlock(iblockstate.getBlock());
|
||||
|
||||
|
|
@ -101,7 +100,7 @@ public class TileEntityIronChestRenderer<T extends TileEntity & IChestLid> exten
|
|||
GlStateManager.translatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
|
||||
GlStateManager.scalef(1.0F, -1.0F, -1.0F);
|
||||
|
||||
float f = iblockstate.get(BlockIronChest.FACING).getHorizontalAngle();
|
||||
float f = iblockstate.get(BlockChest.FACING).getHorizontalAngle();
|
||||
if (Math.abs(f) > 1.0E-5D)
|
||||
{
|
||||
GlStateManager.translatef(0.5F, 0.5F, 0.5F);
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ public class IronChestAIOcelotSit extends EntityAIOcelotSit
|
|||
}
|
||||
else
|
||||
{
|
||||
IBlockState iblockstate = worldIn.getBlockState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
IBlockState iBlockState = worldIn.getBlockState(pos);
|
||||
Block block = iBlockState.getBlock();
|
||||
|
||||
if (block instanceof BlockChest)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import java.util.HashSet;
|
|||
public class OcelotsSitOnChestsHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void changeSittingTaskForOcelots(LivingUpdateEvent evt)
|
||||
public void changeSittingTaskForOcelots(final LivingUpdateEvent evt)
|
||||
{
|
||||
if (evt.getEntityLiving().ticksExisted < 5 && evt.getEntityLiving() instanceof EntityOcelot)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.INameable;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
|
@ -52,19 +53,25 @@ public abstract class BlockChest extends Block implements ITileEntityProvider
|
|||
|
||||
protected static final VoxelShape IRON_CHEST_SHAPE = Block.makeCuboidShape(1.0D, 0.0D, 1.0D, 15.0D, 14.0D, 15.0D);
|
||||
|
||||
public IronChestType type;
|
||||
private final IronChestType type;
|
||||
|
||||
public BlockChest(Builder properties, IronChestType type)
|
||||
public BlockChest(Builder builderIn, IronChestType typeIn)
|
||||
{
|
||||
super(properties);
|
||||
super(builderIn);
|
||||
|
||||
this.setDefaultState(((this.stateContainer.getBaseState()).with(FACING, EnumFacing.NORTH)));
|
||||
this.type = typeIn;
|
||||
|
||||
this.type = type;
|
||||
this.setDefaultState((IBlockState) ((IBlockState) this.stateContainer.getBaseState()).with(FACING, EnumFacing.NORTH));
|
||||
|
||||
this.setRegistryName(new ResourceLocation(type.itemName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(IBlockState state, IBlockReader worldIn, BlockPos pos)
|
||||
{
|
||||
return IRON_CHEST_SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid(IBlockState state)
|
||||
{
|
||||
|
|
@ -98,12 +105,6 @@ public abstract class BlockChest extends Block implements ITileEntityProvider
|
|||
return this.getDefaultState().with(FACING, enumfacing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(IBlockState state, IBlockReader worldIn, BlockPos pos)
|
||||
{
|
||||
return IRON_CHEST_SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
|
|
@ -216,7 +217,13 @@ public abstract class BlockChest extends Block implements ITileEntityProvider
|
|||
@Override
|
||||
public IBlockState rotate(IBlockState state, Rotation rot)
|
||||
{
|
||||
return state.with(FACING, rot.rotate(state.get(FACING)));
|
||||
return (IBlockState) state.with(FACING, rot.rotate((EnumFacing) state.get(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState mirror(IBlockState state, Mirror mirrorIn)
|
||||
{
|
||||
return state.rotate(mirrorIn.toRotation((EnumFacing) state.get(FACING)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -251,5 +258,4 @@ public abstract class BlockChest extends Block implements ITileEntityProvider
|
|||
{
|
||||
return this.type;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,8 +45,6 @@ public enum IronChestType implements IStringSerializable
|
|||
WOOD(0, 0, false, "", null, 0, 0, null);
|
||||
//@formatter:on
|
||||
|
||||
public static final IronChestType VALUES[] = values();
|
||||
|
||||
public final String name;
|
||||
|
||||
public final int size;
|
||||
|
|
@ -95,16 +93,6 @@ public enum IronChestType implements IStringSerializable
|
|||
return this == CRYSTAL;
|
||||
}
|
||||
|
||||
public boolean isValidForCreativeMode()
|
||||
{
|
||||
return this != WOOD;
|
||||
}
|
||||
|
||||
public boolean isExplosionResistant()
|
||||
{
|
||||
return this == OBSIDIAN;
|
||||
}
|
||||
|
||||
public Slot makeSlot(IInventory chestInventory, int index, int x, int y)
|
||||
{
|
||||
return new ValidatingChestSlot(chestInventory, index, x, y, this);
|
||||
|
|
|
|||
|
|
@ -23,90 +23,76 @@ import cpw.mods.ironchest.common.items.ItemChest;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
public class IronChestBlocks
|
||||
{
|
||||
//@formatter:off
|
||||
public static BlockChest ironChestBlock = new BlockIronChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F));
|
||||
public static Item ironChestItemBlock = new ItemChest(ironChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS));
|
||||
public static BlockChest ironChestBlock;
|
||||
|
||||
public static BlockChest goldChestBlock = new BlockGoldChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F));
|
||||
public static Item goldChestItemBlock = new ItemChest(goldChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS));
|
||||
public static Item ironChestItemBlock;
|
||||
|
||||
public static BlockChest diamondChestBlock = new BlockDiamondChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F));
|
||||
public static Item diamondChestItemBlock = new ItemChest(diamondChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS));
|
||||
public static BlockChest goldChestBlock;
|
||||
|
||||
public static BlockChest copperChestBlock = new BlockCopperChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F));
|
||||
public static Item copperChestItemBlock = new ItemChest(copperChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS));
|
||||
public static Item goldChestItemBlock;
|
||||
|
||||
public static BlockChest silverChestBlock = new BlockSilverChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F));
|
||||
public static Item silverChestItemBlock = new ItemChest(silverChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS));
|
||||
public static BlockChest diamondChestBlock;
|
||||
|
||||
public static BlockChest crystalChestBlock = new BlockCrystalChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F));
|
||||
public static Item crystalChestItemBlock = new ItemChest(crystalChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS));
|
||||
|
||||
public static BlockChest obsidianChestBlock = new BlockObsidianChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F));
|
||||
public static Item obsidianChestItemBlock = new ItemChest(obsidianChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS));
|
||||
public static Item diamondChestItemBlock;
|
||||
|
||||
public static BlockChest dirtChestBlock = new BlockDirtChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F));
|
||||
public static Item dirtChestItemBlock = new ItemChest(dirtChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS));
|
||||
//@formatter:on
|
||||
public static BlockChest copperChestBlock;
|
||||
|
||||
public static Item copperChestItemBlock;
|
||||
|
||||
public static BlockChest silverChestBlock;
|
||||
|
||||
public static Item silverChestItemBlock;
|
||||
|
||||
public static BlockChest crystalChestBlock;
|
||||
|
||||
public static Item crystalChestItemBlock;
|
||||
|
||||
public static BlockChest obsidianChestBlock;
|
||||
|
||||
public static Item obsidianChestItemBlock;
|
||||
|
||||
public static BlockChest dirtChestBlock;
|
||||
|
||||
public static Item dirtChestItemBlock;
|
||||
|
||||
public IronChestBlocks()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void registerBlocks()
|
||||
{
|
||||
// Chest Start
|
||||
GameRegistry.findRegistry(Block.class)
|
||||
.registerAll(ironChestBlock, goldChestBlock, diamondChestBlock, copperChestBlock, silverChestBlock, crystalChestBlock, obsidianChestBlock,
|
||||
dirtChestBlock);
|
||||
// Chest End
|
||||
}
|
||||
|
||||
public void registerItems()
|
||||
{
|
||||
// Chest Start
|
||||
GameRegistry.findRegistry(Item.class)
|
||||
.registerAll(ironChestItemBlock, goldChestItemBlock, diamondChestItemBlock, copperChestItemBlock, silverChestItemBlock, crystalChestItemBlock,
|
||||
obsidianChestItemBlock, dirtChestItemBlock);
|
||||
// Chest End
|
||||
}
|
||||
|
||||
/*@SubscribeEvent
|
||||
public static void registerBlocks(final Register<Block> event)
|
||||
{
|
||||
System.out.println("hello from registerBlocks");
|
||||
IForgeRegistry<Block> blockRegistry = event.getRegistry();
|
||||
|
||||
// Chest Start
|
||||
for (IronChestType type : IronChestType.values())
|
||||
{
|
||||
if (type.itemName != null)
|
||||
{
|
||||
blockRegistry.register(new BlockIronChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F), type, type.itemName));
|
||||
}
|
||||
}
|
||||
// Chest End
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItems(final Register<Item> event)
|
||||
public void registerBlocks(final RegistryEvent.Register<Block> event)
|
||||
{
|
||||
IForgeRegistry<Block> blockRegistry = event.getRegistry();
|
||||
|
||||
blockRegistry.register(ironChestBlock = new BlockIronChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
|
||||
blockRegistry.register(goldChestBlock = new BlockGoldChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
|
||||
blockRegistry.register(diamondChestBlock = new BlockDiamondChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
|
||||
blockRegistry.register(copperChestBlock = new BlockCopperChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
|
||||
blockRegistry.register(silverChestBlock = new BlockSilverChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
|
||||
blockRegistry.register(crystalChestBlock = new BlockCrystalChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
|
||||
blockRegistry.register(obsidianChestBlock = new BlockObsidianChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
|
||||
blockRegistry.register(dirtChestBlock = new BlockDirtChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerItems(final RegistryEvent.Register<Item> event)
|
||||
{
|
||||
System.out.println("hello from registerItems");
|
||||
IForgeRegistry<Item> itemRegistry = event.getRegistry();
|
||||
|
||||
// Chest Start
|
||||
for (IronChestType type : IronChestType.values())
|
||||
{
|
||||
if (type != IronChestType.WOOD)
|
||||
{
|
||||
itemRegistry.register(new ItemChest(type.block, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS)));
|
||||
}
|
||||
}
|
||||
// Chest End
|
||||
}*/
|
||||
|
||||
itemRegistry.register(ironChestItemBlock = new ItemChest(ironChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS)));
|
||||
itemRegistry.register(goldChestItemBlock = new ItemChest(goldChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS)));
|
||||
itemRegistry.register(diamondChestItemBlock = new ItemChest(diamondChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS)));
|
||||
itemRegistry.register(copperChestItemBlock = new ItemChest(copperChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS)));
|
||||
itemRegistry.register(silverChestItemBlock = new ItemChest(silverChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS)));
|
||||
itemRegistry.register(crystalChestItemBlock = new ItemChest(crystalChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS)));
|
||||
itemRegistry.register(obsidianChestItemBlock = new ItemChest(obsidianChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS)));
|
||||
itemRegistry.register(dirtChestItemBlock = new ItemChest(dirtChestBlock, (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS)));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,43 +3,53 @@ package cpw.mods.ironchest.common.core;
|
|||
import cpw.mods.ironchest.common.items.ChestChangerType;
|
||||
import cpw.mods.ironchest.common.items.ItemChestChanger;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.event.RegistryEvent.Register;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.item.Item.Builder;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
public class IronChestItems
|
||||
{
|
||||
//@formatter:off
|
||||
public static Item.Builder itemBuilder = (new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS).maxStackSize(1);
|
||||
public static Item ironToGoldUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.IRON_GOLD);
|
||||
public static Item goldToDiamondUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.GOLD_DIAMOND);
|
||||
public static Item copperToSilverUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.COPPER_SILVER);
|
||||
public static Item silverToGoldUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.SILVER_GOLD);
|
||||
public static Item copperToIronUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.COPPER_IRON);
|
||||
public static Item diamondToCrystalUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.DIAMOND_CRYSTAL);
|
||||
public static Item woodToIronUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.WOOD_IRON);
|
||||
public static Item woodToCopperUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.WOOD_COPPER);
|
||||
public static Item diamondToObsidianUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.DIAMOND_OBSIDIAN);
|
||||
//@formatter:on
|
||||
public static Builder itemBuilder;
|
||||
|
||||
public static Item ironToGoldUpgrade;
|
||||
|
||||
public static Item goldToDiamondUpgrade;
|
||||
|
||||
public static Item copperToSilverUpgrade;
|
||||
|
||||
public static Item silverToGoldUpgrade;
|
||||
|
||||
public static Item copperToIronUpgrade;
|
||||
|
||||
public static Item diamondToCrystalUpgrade;
|
||||
|
||||
public static Item woodToIronUpgrade;
|
||||
|
||||
public static Item woodToCopperUpgrade;
|
||||
|
||||
public static Item diamondToObsidianUpgrade;
|
||||
|
||||
public IronChestItems()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void registerItems()
|
||||
{
|
||||
// Chest Start
|
||||
GameRegistry.findRegistry(Item.class)
|
||||
.registerAll(ironToGoldUpgrade, goldToDiamondUpgrade, copperToSilverUpgrade, silverToGoldUpgrade, copperToIronUpgrade, diamondToCrystalUpgrade,
|
||||
woodToIronUpgrade, woodToCopperUpgrade, diamondToObsidianUpgrade);
|
||||
// Chest End
|
||||
}
|
||||
|
||||
public static void registerItems(Register<Item> event)
|
||||
@SubscribeEvent
|
||||
public void registerItems(final RegistryEvent.Register<Item> event)
|
||||
{
|
||||
IForgeRegistry<Item> itemRegistry = event.getRegistry();
|
||||
|
||||
ChestChangerType.buildItems(itemRegistry);
|
||||
itemBuilder = (new Builder()).group(IronChestCreativeTabs.IRON_CHESTS).maxStackSize(1);
|
||||
|
||||
itemRegistry.register(ironToGoldUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.IRON_GOLD));
|
||||
itemRegistry.register(goldToDiamondUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.GOLD_DIAMOND));
|
||||
itemRegistry.register(copperToSilverUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.COPPER_SILVER));
|
||||
itemRegistry.register(silverToGoldUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.SILVER_GOLD));
|
||||
itemRegistry.register(copperToIronUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.COPPER_IRON));
|
||||
itemRegistry.register(diamondToCrystalUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.DIAMOND_CRYSTAL));
|
||||
itemRegistry.register(woodToIronUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.WOOD_IRON));
|
||||
itemRegistry.register(woodToCopperUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.WOOD_COPPER));
|
||||
itemRegistry.register(diamondToObsidianUpgrade = new ItemChestChanger(itemBuilder, ChestChangerType.DIAMOND_OBSIDIAN));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,31 +43,31 @@ public class ContainerIronChest extends Container
|
|||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
|
||||
{
|
||||
ItemStack itemstack = ItemStack.EMPTY;
|
||||
ItemStack itemStack = ItemStack.EMPTY;
|
||||
Slot slot = this.inventorySlots.get(index);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
ItemStack itemStack1 = slot.getStack();
|
||||
itemStack = itemStack1.copy();
|
||||
|
||||
if (index < this.type.size)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, this.type.size, this.inventorySlots.size(), true))
|
||||
if (!this.mergeItemStack(itemStack1, this.type.size, this.inventorySlots.size(), true))
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
else if (!this.type.acceptsStack(itemstack1))
|
||||
else if (!this.type.acceptsStack(itemStack1))
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
else if (!this.mergeItemStack(itemstack1, 0, this.type.size, false))
|
||||
else if (!this.mergeItemStack(itemStack1, 0, this.type.size, false))
|
||||
{
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
if (itemstack1.isEmpty())
|
||||
if (itemStack1.isEmpty())
|
||||
{
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ public class ContainerIronChest extends Container
|
|||
}
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
protected void layoutContainer(IInventory playerInventory, IInventory chestInventory, IronChestType type, int xSize, int ySize)
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@
|
|||
******************************************************************************/
|
||||
package cpw.mods.ironchest.common.items;
|
||||
|
||||
import cpw.mods.ironchest.IronChest;
|
||||
import cpw.mods.ironchest.common.blocks.IronChestType;
|
||||
import cpw.mods.ironchest.common.core.IronChestCreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import static cpw.mods.ironchest.common.blocks.IronChestType.COPPER;
|
||||
|
|
@ -38,44 +40,21 @@ public enum ChestChangerType
|
|||
DIAMOND_OBSIDIAN(DIAMOND, OBSIDIAN, "diamond_obsidian_chest_upgrade");
|
||||
//@formatter:on
|
||||
|
||||
public static final ChestChangerType[] VALUES = values();
|
||||
|
||||
public final IronChestType source;
|
||||
|
||||
public final IronChestType target;
|
||||
|
||||
public final String itemName;
|
||||
|
||||
public ItemChestChanger item;
|
||||
public final ResourceLocation itemName;
|
||||
|
||||
ChestChangerType(IronChestType source, IronChestType target, String itemName)
|
||||
{
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
this.itemName = itemName;
|
||||
this.itemName = new ResourceLocation(IronChest.MOD_ID, itemName);
|
||||
}
|
||||
|
||||
public boolean canUpgrade(IronChestType from)
|
||||
{
|
||||
return from == this.source;
|
||||
}
|
||||
|
||||
public ItemChestChanger buildItem(IForgeRegistry<Item> itemRegistry)
|
||||
{
|
||||
this.item = new ItemChestChanger((new Item.Builder()).group(IronChestCreativeTabs.IRON_CHESTS).maxStackSize(1), this);
|
||||
|
||||
this.item.setRegistryName(this.itemName);
|
||||
|
||||
itemRegistry.register(this.item);
|
||||
|
||||
return this.item;
|
||||
}
|
||||
|
||||
public static void buildItems(IForgeRegistry<Item> itemRegistry)
|
||||
{
|
||||
for (ChestChangerType type : VALUES)
|
||||
{
|
||||
type.buildItem(itemRegistry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ public class ItemChestChanger extends ItemTooltip
|
|||
@Override
|
||||
public EnumActionResult onItemUseFirst(ItemStack stack, ItemUseContext context)
|
||||
{
|
||||
EntityPlayer entityplayer = context.getPlayer();
|
||||
BlockPos blockpos = context.getPos();
|
||||
EntityPlayer entityPlayer = context.getPlayer();
|
||||
BlockPos blockPos = context.getPos();
|
||||
World world = context.getWorld();
|
||||
ItemStack itemstack = context.getItem();
|
||||
ItemStack itemStack = context.getItem();
|
||||
|
||||
if (world.isRemote)
|
||||
{
|
||||
|
|
@ -53,56 +53,55 @@ public class ItemChestChanger extends ItemTooltip
|
|||
|
||||
if (this.type.canUpgrade(IronChestType.WOOD))
|
||||
{
|
||||
if (!(world.getBlockState(blockpos).getBlock() instanceof net.minecraft.block.BlockChest))
|
||||
if (!(world.getBlockState(blockPos).getBlock() instanceof net.minecraft.block.BlockChest))
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//@formatter:off
|
||||
if (world.getBlockState(blockpos).getBlock().getDefaultState() != IronChestType.get(this.type.source))
|
||||
//@formatter:on
|
||||
if (world.getBlockState(blockPos).getBlock().getDefaultState() != IronChestType.get(this.type.source))
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity te = world.getTileEntity(blockpos);
|
||||
TileEntityIronChest newchest = new TileEntityIronChest();
|
||||
TileEntity tileEntity = world.getTileEntity(blockPos);
|
||||
TileEntityIronChest newChest = new TileEntityIronChest();
|
||||
|
||||
ITextComponent customname = null;
|
||||
ITextComponent customName = null;
|
||||
|
||||
NonNullList<ItemStack> chestContents = NonNullList.<ItemStack>withSize(27, ItemStack.EMPTY);
|
||||
EnumFacing chestFacing = EnumFacing.NORTH;
|
||||
|
||||
if (te != null)
|
||||
if (tileEntity != null)
|
||||
{
|
||||
if (te instanceof TileEntityIronChest)
|
||||
if (tileEntity instanceof TileEntityIronChest)
|
||||
{
|
||||
TileEntityIronChest chest = (TileEntityIronChest) te;
|
||||
IBlockState chestState = world.getBlockState(blockpos);
|
||||
TileEntityIronChest chest = (TileEntityIronChest) tileEntity;
|
||||
IBlockState chestState = world.getBlockState(blockPos);
|
||||
|
||||
chestContents = chest.getItems();
|
||||
chestFacing = chestState.get(BlockChest.FACING);
|
||||
customname = chest.getCustomName();
|
||||
newchest = this.type.target.makeEntity();
|
||||
customName = chest.getCustomName();
|
||||
newChest = this.type.target.makeEntity();
|
||||
|
||||
if (newchest == null)
|
||||
if (newChest == null)
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
}
|
||||
else if (te instanceof TileEntityChest)
|
||||
else if (tileEntity instanceof TileEntityChest)
|
||||
{
|
||||
IBlockState chestState = world.getBlockState(blockpos);
|
||||
IBlockState chestState = world.getBlockState(blockPos);
|
||||
chestFacing = chestState.get(net.minecraft.block.BlockChest.FACING);
|
||||
TileEntityChest chest = (TileEntityChest) te;
|
||||
TileEntityChest chest = (TileEntityChest) tileEntity;
|
||||
|
||||
if (TileEntityChest.getPlayersUsing(world, blockpos) > 0)
|
||||
if (TileEntityChest.getPlayersUsing(world, blockPos) > 0)
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
if (!this.type.canUpgrade(IronChestType.WOOD))
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
|
|
@ -110,51 +109,46 @@ public class ItemChestChanger extends ItemTooltip
|
|||
|
||||
chestContents = NonNullList.<ItemStack>withSize(chest.getSizeInventory(), ItemStack.EMPTY);
|
||||
|
||||
for (int i = 0; i < chestContents.size(); i++)
|
||||
for (int slot = 0; slot < chestContents.size(); slot++)
|
||||
{
|
||||
chestContents.set(i, chest.getStackInSlot(i));
|
||||
chestContents.set(slot, chest.getStackInSlot(slot));
|
||||
}
|
||||
|
||||
customname = chest.getCustomName();
|
||||
customName = chest.getCustomName();
|
||||
|
||||
newchest = this.type.target.makeEntity();
|
||||
newChest = this.type.target.makeEntity();
|
||||
}
|
||||
}
|
||||
|
||||
te.updateContainingBlockInfo();
|
||||
tileEntity.updateContainingBlockInfo();
|
||||
|
||||
//if (te instanceof TileEntityChest)
|
||||
//{
|
||||
// ((TileEntityChest) te).checkForAdjacentChests();
|
||||
//}
|
||||
world.removeTileEntity(blockPos);
|
||||
world.removeBlock(blockPos);
|
||||
|
||||
world.removeTileEntity(blockpos);
|
||||
world.removeBlock(blockpos);
|
||||
IBlockState iBlockState = IronChestType.get(this.type.target).with(BlockIronChest.FACING, chestFacing);
|
||||
|
||||
IBlockState iblockstate = IronChestType.get(this.type.target).with(BlockIronChest.FACING, chestFacing);
|
||||
System.out.println(iBlockState);
|
||||
|
||||
System.out.println(iblockstate);
|
||||
world.setTileEntity(blockPos, newChest);
|
||||
world.setBlockState(blockPos, iBlockState, 3);
|
||||
|
||||
world.setTileEntity(blockpos, newchest);
|
||||
world.setBlockState(blockpos, iblockstate, 3);
|
||||
world.notifyBlockUpdate(blockPos, iBlockState, iBlockState, 3);
|
||||
|
||||
world.notifyBlockUpdate(blockpos, iblockstate, iblockstate, 3);
|
||||
TileEntity tileEntity2 = world.getTileEntity(blockPos);
|
||||
|
||||
TileEntity te2 = world.getTileEntity(blockpos);
|
||||
|
||||
if (te2 instanceof TileEntityIronChest)
|
||||
if (tileEntity2 instanceof TileEntityIronChest)
|
||||
{
|
||||
if (customname != null)
|
||||
if (customName != null)
|
||||
{
|
||||
((TileEntityIronChest) te2).setCustomName(customname);
|
||||
((TileEntityIronChest) tileEntity2).setCustomName(customName);
|
||||
}
|
||||
|
||||
((TileEntityIronChest) te2).setItems(chestContents);
|
||||
((TileEntityIronChest) tileEntity2).setItems(chestContents);
|
||||
}
|
||||
|
||||
if (!entityplayer.abilities.isCreativeMode)
|
||||
if (!entityPlayer.abilities.isCreativeMode)
|
||||
{
|
||||
itemstack.shrink(1);
|
||||
itemStack.shrink(1);
|
||||
}
|
||||
|
||||
return EnumActionResult.SUCCESS;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ import net.minecraft.util.ResourceLocation;
|
|||
import net.minecraft.util.SharedConstants;
|
||||
import net.minecraft.util.datafix.DataFixesManager;
|
||||
import net.minecraft.util.datafix.TypeReferences;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
|
@ -59,6 +61,37 @@ public class IronChestEntityType
|
|||
registerTileEntityType(e, register("obsidian_chest", TileEntityType.Builder.create(TileEntityObsidianChest::new)), "obsidian_chest");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTileEntityRegistry(final RegistryEvent.Register<TileEntityType<?>> e)
|
||||
{
|
||||
System.out.println("hello from onTileEntityRegistry");
|
||||
IronChestEntityType.IRON_CHEST = registerTileEntityType(e.getRegistry(),
|
||||
register("iron_chest", TileEntityType.Builder.create(TileEntityIronChest::new)), "iron_chest");
|
||||
IronChestEntityType.GOLD_CHEST = registerTileEntityType(e.getRegistry(),
|
||||
register("gold_chest", TileEntityType.Builder.create(TileEntityGoldChest::new)), "gold_chest");
|
||||
IronChestEntityType.DIAMOND_CHEST = registerTileEntityType(e.getRegistry(),
|
||||
register("diamond_chest", TileEntityType.Builder.create(TileEntityDiamondChest::new)), "diamond_chest");
|
||||
IronChestEntityType.CRYSTAL_CHEST = registerTileEntityType(e.getRegistry(),
|
||||
register("crystal_chest", TileEntityType.Builder.create(TileEntityCrystalChest::new)), "crystal_chest");
|
||||
IronChestEntityType.DIRT_CHEST = registerTileEntityType(e.getRegistry(),
|
||||
register("dirt_chest", TileEntityType.Builder.create(TileEntityDirtChest::new)), "dirt_chest");
|
||||
IronChestEntityType.COPPER_CHEST = registerTileEntityType(e.getRegistry(),
|
||||
register("copper_chest", TileEntityType.Builder.create(TileEntityCopperChest::new)), "copper_chest");
|
||||
IronChestEntityType.SILVER_CHEST = registerTileEntityType(e.getRegistry(),
|
||||
register("silver_chest", TileEntityType.Builder.create(TileEntitySilverChest::new)), "silver_chest");
|
||||
IronChestEntityType.OBSIDIAN_CHEST = registerTileEntityType(e.getRegistry(),
|
||||
register("obsidian_chest", TileEntityType.Builder.create(TileEntityObsidianChest::new)), "obsidian_chest");
|
||||
|
||||
IronChestEntityType.IRON_CHEST = e.getRegistry().getValue(new ResourceLocation("ironchest", "iron_chest"));
|
||||
IronChestEntityType.GOLD_CHEST = e.getRegistry().getValue(new ResourceLocation("ironchest", "gold_chest"));
|
||||
IronChestEntityType.DIAMOND_CHEST = e.getRegistry().getValue(new ResourceLocation("ironchest", "diamond_chest"));
|
||||
IronChestEntityType.CRYSTAL_CHEST = e.getRegistry().getValue(new ResourceLocation("ironchest", "crystal_chest"));
|
||||
IronChestEntityType.DIRT_CHEST = e.getRegistry().getValue(new ResourceLocation("ironchest", "dirt_chest"));
|
||||
IronChestEntityType.COPPER_CHEST = e.getRegistry().getValue(new ResourceLocation("ironchest", "copper_chest"));
|
||||
IronChestEntityType.SILVER_CHEST = e.getRegistry().getValue(new ResourceLocation("ironchest", "silver_chest"));
|
||||
IronChestEntityType.OBSIDIAN_CHEST = e.getRegistry().getValue(new ResourceLocation("ironchest", "obsidian_chest"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void createEntries()
|
||||
{
|
||||
|
|
@ -74,18 +107,19 @@ public class IronChestEntityType
|
|||
IronChestEntityType.OBSIDIAN_CHEST = (TileEntityType<?>) e.getValue(new ResourceLocation("ironchest", "obsidian_chest"));
|
||||
}
|
||||
|
||||
/*@SubscribeEvent
|
||||
public static void onTileEntityRegistry(final Register<TileEntityType<?>> e)
|
||||
/*
|
||||
@SubscribeEvent
|
||||
public void onTileEntityRegistry(final RegistryEvent.Register<TileEntityType<?>> e)
|
||||
{
|
||||
System.out.println("hello from onTileEntityRegistry");
|
||||
registerTileEntityType(e.getRegistry(), register("iron_chest", TileEntityType.Builder.create(TileEntityIronChest::new)), "iron_chest");
|
||||
registerTileEntityType(e.getRegistry(), register("gold_chest", TileEntityType.Builder.create(TileEntityGoldChest::new)), "gold_chest");
|
||||
registerTileEntityType(e.getRegistry(), register("diamond_chest", TileEntityType.Builder.create(TileEntityDiamondChest::new)), "diamond_chest");
|
||||
registerTileEntityType(e.getRegistry(), register("crystal_chest", TileEntityType.Builder.create(TileEntityCrystalChest::new)), "crystal_chest");
|
||||
registerTileEntityType(e.getRegistry(), register("dirt_chest", TileEntityType.Builder.create(TileEntityDirtChest::new)), "dirt_chest");
|
||||
registerTileEntityType(e.getRegistry(), register("copper_chest", TileEntityType.Builder.create(TileEntityCopperChest::new)), "copper_chest");
|
||||
registerTileEntityType(e.getRegistry(), register("silver_chest", TileEntityType.Builder.create(TileEntitySilverChest::new)), "silver_chest");
|
||||
registerTileEntityType(e.getRegistry(), register("obsidian_chest", TileEntityType.Builder.create(TileEntityObsidianChest::new)), "obsidian_chest");
|
||||
IronChestEntityType.IRON_CHEST = registerTileEntityType(e.getRegistry(), register("iron_chest", TileEntityType.Builder.create(TileEntityIronChest::new)), "iron_chest");
|
||||
IronChestEntityType.GOLD_CHEST = registerTileEntityType(e.getRegistry(), register("gold_chest", TileEntityType.Builder.create(TileEntityGoldChest::new)), "gold_chest");
|
||||
IronChestEntityType.DIAMOND_CHEST = registerTileEntityType(e.getRegistry(), register("diamond_chest", TileEntityType.Builder.create(TileEntityDiamondChest::new)), "diamond_chest");
|
||||
IronChestEntityType.CRYSTAL_CHEST = registerTileEntityType(e.getRegistry(), register("crystal_chest", TileEntityType.Builder.create(TileEntityCrystalChest::new)), "crystal_chest");
|
||||
IronChestEntityType.DIRT_CHEST = registerTileEntityType(e.getRegistry(), register("dirt_chest", TileEntityType.Builder.create(TileEntityDirtChest::new)), "dirt_chest");
|
||||
IronChestEntityType.COPPER_CHEST = registerTileEntityType(e.getRegistry(), register("copper_chest", TileEntityType.Builder.create(TileEntityCopperChest::new)), "copper_chest");
|
||||
IronChestEntityType.SILVER_CHEST = registerTileEntityType(e.getRegistry(), register("silver_chest", TileEntityType.Builder.create(TileEntitySilverChest::new)), "silver_chest");
|
||||
IronChestEntityType.OBSIDIAN_CHEST = registerTileEntityType(e.getRegistry(), register("obsidian_chest", TileEntityType.Builder.create(TileEntityObsidianChest::new)), "obsidian_chest");
|
||||
|
||||
IronChestEntityType.IRON_CHEST = e.getRegistry().getValue(new ResourceLocation("ironchest", "iron_chest"));
|
||||
IronChestEntityType.GOLD_CHEST = e.getRegistry().getValue(new ResourceLocation("ironchest", "gold_chest"));
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements IChes
|
|||
super(typeIn);
|
||||
this.chestType = chestTypeIn;
|
||||
this.chestContents = NonNullList.<ItemStack>withSize(chestTypeIn.size, ItemStack.EMPTY);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -124,8 +123,6 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements IChes
|
|||
public void markDirty()
|
||||
{
|
||||
super.markDirty();
|
||||
|
||||
//this.sortTopStacks();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue