Implement GUIs for the chests, change the mod package to com.progwml6, fix issues with the mods.toml and get the gradle set up to run on progs jenkins

This commit is contained in:
alexbegt 2019-02-17 23:58:56 -05:00
parent 642cf07c5d
commit f5e8eb5c78
48 changed files with 491 additions and 460 deletions

31
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,31 @@
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout scm
sh "rm -rf build/libs"
}
}
stage('Build') {
steps {
sh "./gradlew build -PBUILD_NUMBER=${env.BUILD_NUMBER} --no-daemon"
}
}
stage('Archive') {
steps {
archive includes: 'build/libs/*.jar'
junit allowEmptyResults: true, testResults: 'build/test-results/**/*.xml'
}
}
stage('Deploy') {
steps {
sh "./gradlew publishMavenJavaPublicationToMavenRepository -PBUILD_NUMBER=${env.BUILD_NUMBER} -PDEPLOY_DIR=${env.MAVEN_DEPLOY_DIR} --no-daemon"
}
}
}
}

View File

@ -9,27 +9,22 @@ buildscript {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
} }
} }
apply plugin: 'net.minecraftforge.gradle' apply plugin: 'net.minecraftforge.gradle'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'maven' apply plugin: 'maven'
apply plugin: 'eclipse' apply plugin: 'eclipse'
apply plugin: 'maven-publish'
// This is a simple flatdir repository for "uploadArchives" when you don't have a remote repo to target
repositories { repositories {
flatDir {
name "fileRepo"
dirs "repo"
}
maven { maven {
name 'DVS1 Maven FS' name 'DVS1 Maven FS'
url 'http://dvs1.progwml6.com/files/maven' url 'http://dvs1.progwml6.com/files/maven'
} }
} }
// This is our group. I'm cpw.mods group = "com.progwml6.ironchest"
group = "cpw.mods" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
// This is our actual project within the group. Note: FML has "fml" here. But this is ironchest. sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
archivesBaseName = "ironchest"
minecraft { minecraft {
mappings channel: 'snapshot', version: mappings_version mappings channel: 'snapshot', version: mappings_version
@ -55,123 +50,73 @@ minecraft {
} }
dependencies { dependencies {
minecraft 'net.minecraftforge.test:forge:' + minecraft_version + '-' + forge_version minecraft 'net.minecraftforge:forge:' + minecraft_version + '-' + forge_version
} }
// IronChest uses git tagging to mark major versions. This sets up the project version to that version data task buildInfo {
def versionInfo = getGitVersion() def cmd = "git rev-parse --short HEAD"
version = minecraft_version + "-${versionInfo['IronChest.version']}" def proc = cmd.execute()
proc.waitFor()
if (proc.exitValue() == 0) {
ext.revision = proc.text.trim()
} else {
ext.revision = "GITBORK"
}
if (System.getenv().BUILD_NUMBER != null) {
ext.buildNum = System.getenv().BUILD_NUMBER
} else {
ext.buildNum = "DEV.${project.buildInfo.revision}"
}
}
version = "${minecraft_version}-${mod_version}.${project.buildInfo.buildNum}"
// 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) { 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 expand 'version': project.version, 'mcversion': minecraft_version
} }
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
exclude 'META-INF/mods.toml' exclude 'META-INF/mods.toml'
} }
}
// generate version.properties file from the git version data earlier task sourcesJar(type: Jar) {
doLast { from sourceSets.main.allJava
def propsFile = new File(destinationDir, 'version.properties') classifier = 'sources'
def properties = new Properties() }
properties.putAll(versionInfo)
properties['IronChest.build.mcversion'] = minecraft_version artifacts {
properties.store(propsFile.newWriter(), null) archives sourcesJar
}
jar {
manifest {
attributes(["Specification-Title": "Iron Chests",
"Specification-Vendor": "Progwml6",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" :"Progwml6",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],)
} }
} }
// Configure an upload task. this is setup for uploading to files.minecraftforge.net. There are other examples around publishing {
uploadArchives { publications {
repositories.mavenDeployer { mavenJava(MavenPublication) {
dependsOn 'build' artifact jar
artifact sourcesJar
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.
}
} 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())
}
// This is just the pom data for the maven repo
pom {
groupId = project.group
// Force the maven upload to use the <mcversion>-<version> syntax preferred at files
version = "${project.version}"
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description 'IronChest'
url 'https://github.com/progwml6/IronChest'
scm {
url 'https://github.com/progwml6/IronChest'
connection 'scm:git:git://github.com/progwml6/IronChest.git'
developerConnection 'scm:git:git@github.com:progwml6/IronChest.git'
}
issueManagement {
system 'github'
url 'https://github.com/progwml6/IronChest/issues'
}
licenses {
license {
name 'GNU Public License (GPL), Version 3.0'
url 'http://www.gnu.org/licenses/gpl-3.0.txt'
distribution 'repo'
} }
} }
developers { repositories {
developer { if (project.hasProperty('DEPLOY_DIR')) {
id 'cpw' maven { url DEPLOY_DIR }
name 'cpw'
roles { role 'developer' }
}
}
}
} }
} }
} }
// This is a special task for pulling the version information from git and the environment (for BUILD_NUMBER)
def getGitVersion() {
def out = [:]
// 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 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()
return out
}

View File

@ -1,15 +1,19 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties. # Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process. # This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
# Mod Version Information
mod_version=8.0
# Minecraft Version Information # Minecraft Version Information
minecraft_version=1.13 minecraft_version=1.13.2
minecraft_version_toml=13 minecraft_version_toml=13
# Forge Version Information # Forge Version Information
forge_version=24.0.156-1.13-pre forge_version=25.0.23
forge_version_toml=24 forge_version_toml=25
forge_group=net.minecraftforge.test forge_group=net.minecraftforge
# Mappings Information # Mappings Information
mappings_version=20181221-1.13.1 mappings_version=20190215-1.13.1

View File

@ -0,0 +1,49 @@
/*******************************************************************************
* Copyright (c) 2012 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
* <p>
* Contributors:
* cpw - initial API and implementation
******************************************************************************/
package com.progwml6.ironchest;
import com.progwml6.ironchest.client.ClientProxy;
import com.progwml6.ironchest.common.ServerProxy;
import com.progwml6.ironchest.common.ai.OcelotsSitOnChestsHandler;
import com.progwml6.ironchest.common.network.PacketHandler;
import com.progwml6.ironchest.common.gui.GuiHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ExtensionPoint;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@Mod(value = IronChest.MOD_ID)
public class IronChest
{
public static final String MOD_ID = "ironchest";
public static IronChest instance;
public static ServerProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> ServerProxy::new);
public IronChest()
{
instance = this;
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::preInit);
MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.GUIFACTORY, () -> GuiHandler::openGui);
}
private void preInit(final FMLCommonSetupEvent event)
{
proxy.preInit();
PacketHandler.register();
}
}

View File

@ -8,11 +8,11 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.client; package com.progwml6.ironchest.client;
import cpw.mods.ironchest.client.renderer.TileEntityIronChestRenderer; import com.progwml6.ironchest.client.renderer.TileEntityIronChestRenderer;
import cpw.mods.ironchest.common.ServerProxy; import com.progwml6.ironchest.common.ServerProxy;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.common.blocks.IronChestType;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.ClientRegistry;

View File

@ -8,11 +8,10 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.client.gui; package com.progwml6.ironchest.client.gui;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.common.blocks.IronChestType;
import cpw.mods.ironchest.common.gui.ContainerIronChest; import com.progwml6.ironchest.common.gui.ContainerIronChest;
import cpw.mods.ironchest.common.tileentity.TileEntityIronChest;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
@ -28,14 +27,13 @@ public class GUIChest extends GuiContainer
{ {
public enum ResourceList public enum ResourceList
{ {
//@formatter:off
IRON(new ResourceLocation("ironchest", "textures/gui/iron_container.png")), IRON(new ResourceLocation("ironchest", "textures/gui/iron_container.png")),
COPPER(new ResourceLocation("ironchest", "textures/gui/copper_container.png")), COPPER(new ResourceLocation("ironchest", "textures/gui/copper_container.png")),
SILVER(new ResourceLocation("ironchest", "textures/gui/silver_container.png")), SILVER(new ResourceLocation("ironchest", "textures/gui/silver_container.png")),
GOLD(new ResourceLocation("ironchest", "textures/gui/gold_container.png")), GOLD(new ResourceLocation("ironchest", "textures/gui/gold_container.png")),
DIAMOND(new ResourceLocation("ironchest", "textures/gui/diamond_container.png")), DIAMOND(new ResourceLocation("ironchest", "textures/gui/diamond_container.png")),
DIRT(new ResourceLocation("ironchest", "textures/gui/dirt_container.png")); DIRT(new ResourceLocation("ironchest", "textures/gui/dirt_container.png"));
//@formatter:on
public final ResourceLocation location; public final ResourceLocation location;
ResourceList(ResourceLocation loc) ResourceList(ResourceLocation loc)
@ -46,16 +44,14 @@ public class GUIChest extends GuiContainer
public enum GUI public enum GUI
{ {
//@formatter:off IRON(184, 202, ResourceList.IRON, IronChestType.IRON, new ResourceLocation("ironchest:iron")),
IRON(184, 202, ResourceList.IRON, IronChestType.IRON), GOLD(184, 256, ResourceList.GOLD, IronChestType.GOLD, new ResourceLocation("ironchest:gold")),
GOLD(184, 256, ResourceList.GOLD, IronChestType.GOLD), DIAMOND(238, 256, ResourceList.DIAMOND, IronChestType.DIAMOND, new ResourceLocation("ironchest:diamond")),
DIAMOND(238, 256, ResourceList.DIAMOND, IronChestType.DIAMOND), COPPER(184, 184, ResourceList.COPPER, IronChestType.COPPER, new ResourceLocation("ironchest:copper")),
COPPER(184, 184, ResourceList.COPPER, IronChestType.COPPER), SILVER(184, 238, ResourceList.SILVER, IronChestType.SILVER, new ResourceLocation("ironchest:silver")),
SILVER(184, 238, ResourceList.SILVER, IronChestType.SILVER), CRYSTAL(238, 256, ResourceList.DIAMOND, IronChestType.CRYSTAL, new ResourceLocation("ironchest:diamond")),
CRYSTAL(238, 256, ResourceList.DIAMOND, IronChestType.CRYSTAL), OBSIDIAN(238, 256, ResourceList.DIAMOND, IronChestType.OBSIDIAN, new ResourceLocation("ironchest:obsidian")),
OBSIDIAN(238, 256, ResourceList.DIAMOND,IronChestType.OBSIDIAN), DIRTCHEST9000(184, 184, ResourceList.DIRT, IronChestType.DIRTCHEST9000, new ResourceLocation("ironchest:dirt"));
DIRTCHEST9000(184, 184, ResourceList.DIRT, IronChestType.DIRTCHEST9000);
//@formatter:on
private int xSize; private int xSize;
@ -65,12 +61,15 @@ public class GUIChest extends GuiContainer
private IronChestType mainType; private IronChestType mainType;
GUI(int xSize, int ySize, ResourceList guiResourceList, IronChestType mainType) private ResourceLocation guiId;
GUI(int xSize, int ySize, ResourceList guiResourceList, IronChestType mainType, ResourceLocation guiId)
{ {
this.xSize = xSize; this.xSize = xSize;
this.ySize = ySize; this.ySize = ySize;
this.guiResourceList = guiResourceList; this.guiResourceList = guiResourceList;
this.mainType = mainType; this.mainType = mainType;
this.guiId = guiId;
} }
protected Container makeContainer(IInventory playerInventory, IInventory chestInventory, EntityPlayer player) protected Container makeContainer(IInventory playerInventory, IInventory chestInventory, EntityPlayer player)
@ -78,9 +77,9 @@ public class GUIChest extends GuiContainer
return new ContainerIronChest(playerInventory, chestInventory, this.mainType, player, this.xSize, this.ySize); return new ContainerIronChest(playerInventory, chestInventory, this.mainType, player, this.xSize, this.ySize);
} }
public static GUIChest buildGUI(IronChestType type, IInventory playerInventory, TileEntityIronChest chestInventory) public ResourceLocation getGuiId()
{ {
return new GUIChest(values()[chestInventory.getIronChestType().ordinal()], playerInventory, chestInventory); return this.guiId;
} }
} }
@ -90,7 +89,7 @@ public class GUIChest extends GuiContainer
private final IInventory lowerChestInventory; private final IInventory lowerChestInventory;
private GUIChest(GUI type, IInventory playerInventory, IInventory chestInventory) public GUIChest(GUI type, IInventory playerInventory, IInventory chestInventory)
{ {
super(type.makeContainer(playerInventory, chestInventory, Minecraft.getInstance().player)); super(type.makeContainer(playerInventory, chestInventory, Minecraft.getInstance().player));
this.type = type; this.type = type;
@ -112,12 +111,13 @@ public class GUIChest extends GuiContainer
this.renderHoveredToolTip(mouseX, mouseY); this.renderHoveredToolTip(mouseX, mouseY);
} }
/*
@Override @Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
this.fontRenderer.drawString(this.lowerChestInventory.getDisplayName().getString(), 8.0F, 6.0F, 4210752); this.fontRenderer.drawString(this.lowerChestInventory.getDisplayName().getString(), 8.0F, 6.0F, 4210752);
this.fontRenderer.drawString(this.upperChestInventory.getDisplayName().getString(), 8.0F, this.ySize - 96 + 2, 4210752); this.fontRenderer.drawString(this.upperChestInventory.getDisplayName().getString(), 8.0F, this.ySize - 96 + 2, 4210752);
} }*/
/** /**
* Draws the background layer of this container (behind the items). * Draws the background layer of this container (behind the items).

View File

@ -8,18 +8,18 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.client.renderer; package com.progwml6.ironchest.client.renderer;
import cpw.mods.ironchest.common.blocks.BlockChest; import com.progwml6.ironchest.common.blocks.BlockChest;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.common.blocks.IronChestType;
import cpw.mods.ironchest.common.tileentity.TileEntityCopperChest; import com.progwml6.ironchest.common.tileentity.TileEntityCopperChest;
import cpw.mods.ironchest.common.tileentity.TileEntityCrystalChest; import com.progwml6.ironchest.common.tileentity.TileEntityCrystalChest;
import cpw.mods.ironchest.common.tileentity.TileEntityDiamondChest; import com.progwml6.ironchest.common.tileentity.TileEntityDiamondChest;
import cpw.mods.ironchest.common.tileentity.TileEntityDirtChest; import com.progwml6.ironchest.common.tileentity.TileEntityDirtChest;
import cpw.mods.ironchest.common.tileentity.TileEntityGoldChest; import com.progwml6.ironchest.common.tileentity.TileEntityGoldChest;
import cpw.mods.ironchest.common.tileentity.TileEntityIronChest; import com.progwml6.ironchest.common.tileentity.TileEntityIronChest;
import cpw.mods.ironchest.common.tileentity.TileEntityObsidianChest; import com.progwml6.ironchest.common.tileentity.TileEntityObsidianChest;
import cpw.mods.ironchest.common.tileentity.TileEntitySilverChest; import com.progwml6.ironchest.common.tileentity.TileEntitySilverChest;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer; import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;

View File

@ -8,13 +8,13 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.client.renderer; package com.progwml6.ironchest.client.renderer;
import com.google.common.primitives.SignedBytes; import com.google.common.primitives.SignedBytes;
import cpw.mods.ironchest.common.blocks.BlockChest; import com.progwml6.ironchest.common.blocks.BlockChest;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.common.blocks.IronChestType;
import cpw.mods.ironchest.common.tileentity.TileEntityCrystalChest; import com.progwml6.ironchest.common.tileentity.TileEntityCrystalChest;
import cpw.mods.ironchest.common.tileentity.TileEntityIronChest; import com.progwml6.ironchest.common.tileentity.TileEntityIronChest;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
@ -67,9 +67,7 @@ public class TileEntityIronChestRenderer<T extends TileEntity & IChestLid> exten
TileEntityIronChest tileEntity = (TileEntityIronChest) tileEntityIn; TileEntityIronChest tileEntity = (TileEntityIronChest) tileEntityIn;
IBlockState iBlockState = tileEntity.hasWorld() ? IBlockState iBlockState = tileEntity.hasWorld() ? tileEntity.getBlockState() : (IBlockState) tileEntity.getBlockToUse().getDefaultState().with(BlockChest.FACING, EnumFacing.NORTH);
tileEntity.getBlockState() :
(IBlockState) tileEntity.getBlockToUse().getDefaultState().with(BlockChest.FACING, EnumFacing.NORTH);
IronChestType chestType = IronChestType.IRON; IronChestType chestType = IronChestType.IRON;
IronChestType typeNew = BlockChest.getTypeFromBlock(iBlockState.getBlock()); IronChestType typeNew = BlockChest.getTypeFromBlock(iBlockState.getBlock());
@ -134,8 +132,7 @@ public class TileEntityIronChestRenderer<T extends TileEntity & IChestLid> exten
GlStateManager.matrixMode(5888); GlStateManager.matrixMode(5888);
} }
if (chestType.isTransparent() if (chestType.isTransparent() && tileEntity.getDistanceSq(this.rendererDispatcher.entityX, this.rendererDispatcher.entityY, this.rendererDispatcher.entityZ) < 128d)
&& tileEntity.getDistanceSq(this.rendererDispatcher.entityX, this.rendererDispatcher.entityY, this.rendererDispatcher.entityZ) < 128d)
{ {
this.random.setSeed(254L); this.random.setSeed(254L);

View File

@ -8,7 +8,7 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common; package com.progwml6.ironchest.common;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -8,10 +8,10 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.ai; package com.progwml6.ironchest.common.ai;
import cpw.mods.ironchest.common.blocks.BlockChest; import com.progwml6.ironchest.common.blocks.BlockChest;
import cpw.mods.ironchest.common.tileentity.TileEntityIronChest; import com.progwml6.ironchest.common.tileentity.TileEntityIronChest;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.ai.EntityAIOcelotSit; import net.minecraft.entity.ai.EntityAIOcelotSit;

View File

@ -8,7 +8,7 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.ai; package com.progwml6.ironchest.common.ai;
import net.minecraft.entity.ai.EntityAIOcelotSit; import net.minecraft.entity.ai.EntityAIOcelotSit;
import net.minecraft.entity.ai.EntityAITasks.EntityAITaskEntry; import net.minecraft.entity.ai.EntityAITasks.EntityAITaskEntry;

View File

@ -8,17 +8,18 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.blocks; package com.progwml6.ironchest.common.blocks;
import cpw.mods.ironchest.common.tileentity.TileEntityIronChest; import com.progwml6.ironchest.common.tileentity.TileEntityIronChest;
import io.netty.buffer.Unpooled;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockHorizontal; import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Enchantments; import net.minecraft.init.Enchantments;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
@ -26,6 +27,7 @@ import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.pathfinding.PathType; import net.minecraft.pathfinding.PathType;
import net.minecraft.state.DirectionProperty; import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateContainer;
@ -33,6 +35,7 @@ import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.INameable; import net.minecraft.util.INameable;
import net.minecraft.util.Mirror; import net.minecraft.util.Mirror;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -44,6 +47,8 @@ import net.minecraft.world.ILockableContainer;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.fml.network.NetworkHooks;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@ -55,9 +60,9 @@ public abstract class BlockChest extends Block
private final IronChestType type; private final IronChestType type;
public BlockChest(Builder builderIn, IronChestType typeIn) public BlockChest(Properties propertiesIn, IronChestType typeIn)
{ {
super(builderIn); super(propertiesIn);
this.type = typeIn; this.type = typeIn;
@ -123,6 +128,34 @@ public abstract class BlockChest extends Block
} }
} }
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
ILockableContainer ilockablecontainer = this.getContainer(state, worldIn, pos);
if (ilockablecontainer != null)
{
if (player instanceof EntityPlayerMP && !(player instanceof FakePlayer))
{
EntityPlayerMP entityPlayerMP = (EntityPlayerMP) player;
PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());
buffer.writeBlockPos(pos);
NetworkHooks.openGui(entityPlayerMP, ilockablecontainer, buffer);
}
player.addStat(StatList.OPEN_CHEST);
}
return true;
}
}
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Override @Override
public void onReplaced(IBlockState state, World worldIn, BlockPos pos, IBlockState newState, boolean isMoving) public void onReplaced(IBlockState state, World worldIn, BlockPos pos, IBlockState newState, boolean isMoving)
@ -130,12 +163,13 @@ public abstract class BlockChest extends Block
if (state.getBlock() != newState.getBlock()) if (state.getBlock() != newState.getBlock())
{ {
TileEntityIronChest tileentity = (TileEntityIronChest) worldIn.getTileEntity(pos); TileEntityIronChest tileentity = (TileEntityIronChest) worldIn.getTileEntity(pos);
if (tileentity != null) if (tileentity != null)
{ {
tileentity.removeAdornments();
InventoryHelper.dropInventoryItems(worldIn, pos, tileentity); InventoryHelper.dropInventoryItems(worldIn, pos, tileentity);
worldIn.updateComparatorOutputLevel(pos, this); worldIn.updateComparatorOutputLevel(pos, this);
tileentity.removeAdornments();
} }
super.onReplaced(state, worldIn, pos, newState, isMoving); super.onReplaced(state, worldIn, pos, newState, isMoving);
@ -180,6 +214,7 @@ public abstract class BlockChest extends Block
{ {
player.addStat(StatList.BLOCK_MINED.get(this)); player.addStat(StatList.BLOCK_MINED.get(this));
player.addExhaustion(0.005F); player.addExhaustion(0.005F);
if (worldIn.isRemote) if (worldIn.isRemote)
{ {
return; return;
@ -187,6 +222,7 @@ public abstract class BlockChest extends Block
int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, stack); int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, stack);
Item item = this.getItemDropped(state, worldIn, pos, i).asItem(); Item item = this.getItemDropped(state, worldIn, pos, i).asItem();
if (item == Items.AIR) if (item == Items.AIR)
{ {
return; return;

View File

@ -8,16 +8,16 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.blocks; package com.progwml6.ironchest.common.blocks;
import cpw.mods.ironchest.common.tileentity.TileEntityCopperChest; import com.progwml6.ironchest.common.tileentity.TileEntityCopperChest;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
public class BlockCopperChest extends BlockChest public class BlockCopperChest extends BlockChest
{ {
public BlockCopperChest(Builder properties) public BlockCopperChest(Properties properties)
{ {
super(properties, IronChestType.COPPER); super(properties, IronChestType.COPPER);
} }

View File

@ -8,16 +8,16 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.blocks; package com.progwml6.ironchest.common.blocks;
import cpw.mods.ironchest.common.tileentity.TileEntityCrystalChest; import com.progwml6.ironchest.common.tileentity.TileEntityCrystalChest;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
public class BlockCrystalChest extends BlockChest public class BlockCrystalChest extends BlockChest
{ {
public BlockCrystalChest(Builder properties) public BlockCrystalChest(Properties properties)
{ {
super(properties, IronChestType.CRYSTAL); super(properties, IronChestType.CRYSTAL);
} }

View File

@ -8,16 +8,16 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.blocks; package com.progwml6.ironchest.common.blocks;
import cpw.mods.ironchest.common.tileentity.TileEntityDiamondChest; import com.progwml6.ironchest.common.tileentity.TileEntityDiamondChest;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
public class BlockDiamondChest extends BlockChest public class BlockDiamondChest extends BlockChest
{ {
public BlockDiamondChest(Builder properties) public BlockDiamondChest(Properties properties)
{ {
super(properties, IronChestType.DIAMOND); super(properties, IronChestType.DIAMOND);
} }

View File

@ -8,9 +8,9 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.blocks; package com.progwml6.ironchest.common.blocks;
import cpw.mods.ironchest.common.tileentity.TileEntityDirtChest; import com.progwml6.ironchest.common.tileentity.TileEntityDirtChest;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagByte; import net.minecraft.nbt.NBTTagByte;
@ -21,7 +21,7 @@ import net.minecraft.world.World;
public class BlockDirtChest extends BlockChest public class BlockDirtChest extends BlockChest
{ {
public BlockDirtChest(Builder properties) public BlockDirtChest(Properties properties)
{ {
super(properties, IronChestType.DIRTCHEST9000); super(properties, IronChestType.DIRTCHEST9000);
} }

View File

@ -8,16 +8,16 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.blocks; package com.progwml6.ironchest.common.blocks;
import cpw.mods.ironchest.common.tileentity.TileEntityGoldChest; import com.progwml6.ironchest.common.tileentity.TileEntityGoldChest;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
public class BlockGoldChest extends BlockChest public class BlockGoldChest extends BlockChest
{ {
public BlockGoldChest(Builder properties) public BlockGoldChest(Properties properties)
{ {
super(properties, IronChestType.GOLD); super(properties, IronChestType.GOLD);
} }

View File

@ -8,16 +8,16 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.blocks; package com.progwml6.ironchest.common.blocks;
import cpw.mods.ironchest.common.tileentity.TileEntityIronChest; import com.progwml6.ironchest.common.tileentity.TileEntityIronChest;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
public class BlockIronChest extends BlockChest public class BlockIronChest extends BlockChest
{ {
public BlockIronChest(Builder properties) public BlockIronChest(Properties properties)
{ {
super(properties, IronChestType.IRON); super(properties, IronChestType.IRON);
} }

View File

@ -8,16 +8,16 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.blocks; package com.progwml6.ironchest.common.blocks;
import cpw.mods.ironchest.common.tileentity.TileEntityObsidianChest; import com.progwml6.ironchest.common.tileentity.TileEntityObsidianChest;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
public class BlockObsidianChest extends BlockChest public class BlockObsidianChest extends BlockChest
{ {
public BlockObsidianChest(Builder properties) public BlockObsidianChest(Properties properties)
{ {
super(properties, IronChestType.OBSIDIAN); super(properties, IronChestType.OBSIDIAN);
} }

View File

@ -8,16 +8,16 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.blocks; package com.progwml6.ironchest.common.blocks;
import cpw.mods.ironchest.common.tileentity.TileEntitySilverChest; import com.progwml6.ironchest.common.tileentity.TileEntitySilverChest;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
public class BlockSilverChest extends BlockChest public class BlockSilverChest extends BlockChest
{ {
public BlockSilverChest(Builder properties) public BlockSilverChest(Properties properties)
{ {
super(properties, IronChestType.SILVER); super(properties, IronChestType.SILVER);
} }

View File

@ -8,19 +8,19 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.blocks; package com.progwml6.ironchest.common.blocks;
import cpw.mods.ironchest.common.core.IronChestBlocks; import com.progwml6.ironchest.common.core.IronChestBlocks;
import cpw.mods.ironchest.common.gui.slot.ValidatingChestSlot; import com.progwml6.ironchest.common.gui.slot.ValidatingChestSlot;
import cpw.mods.ironchest.common.tileentity.TileEntityCopperChest; import com.progwml6.ironchest.common.util.BlockNames;
import cpw.mods.ironchest.common.tileentity.TileEntityCrystalChest; import com.progwml6.ironchest.common.tileentity.TileEntityCopperChest;
import cpw.mods.ironchest.common.tileentity.TileEntityDiamondChest; import com.progwml6.ironchest.common.tileentity.TileEntityCrystalChest;
import cpw.mods.ironchest.common.tileentity.TileEntityDirtChest; import com.progwml6.ironchest.common.tileentity.TileEntityDiamondChest;
import cpw.mods.ironchest.common.tileentity.TileEntityGoldChest; import com.progwml6.ironchest.common.tileentity.TileEntityDirtChest;
import cpw.mods.ironchest.common.tileentity.TileEntityIronChest; import com.progwml6.ironchest.common.tileentity.TileEntityGoldChest;
import cpw.mods.ironchest.common.tileentity.TileEntityObsidianChest; import com.progwml6.ironchest.common.tileentity.TileEntityIronChest;
import cpw.mods.ironchest.common.tileentity.TileEntitySilverChest; import com.progwml6.ironchest.common.tileentity.TileEntityObsidianChest;
import cpw.mods.ironchest.common.util.BlockNames; import com.progwml6.ironchest.common.tileentity.TileEntitySilverChest;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;

View File

@ -8,25 +8,25 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.core; package com.progwml6.ironchest.common.core;
import cpw.mods.ironchest.IronChest; import com.progwml6.ironchest.client.renderer.TileEntityIronChestItemRenderer;
import cpw.mods.ironchest.client.renderer.TileEntityIronChestItemRenderer; import com.progwml6.ironchest.IronChest;
import cpw.mods.ironchest.common.blocks.BlockChest; import com.progwml6.ironchest.common.blocks.BlockChest;
import cpw.mods.ironchest.common.blocks.BlockCopperChest; import com.progwml6.ironchest.common.blocks.BlockCopperChest;
import cpw.mods.ironchest.common.blocks.BlockCrystalChest; import com.progwml6.ironchest.common.blocks.BlockCrystalChest;
import cpw.mods.ironchest.common.blocks.BlockDiamondChest; import com.progwml6.ironchest.common.blocks.BlockDiamondChest;
import cpw.mods.ironchest.common.blocks.BlockDirtChest; import com.progwml6.ironchest.common.blocks.BlockDirtChest;
import cpw.mods.ironchest.common.blocks.BlockGoldChest; import com.progwml6.ironchest.common.blocks.BlockGoldChest;
import cpw.mods.ironchest.common.blocks.BlockIronChest; import com.progwml6.ironchest.common.blocks.BlockIronChest;
import cpw.mods.ironchest.common.blocks.BlockObsidianChest; import com.progwml6.ironchest.common.blocks.BlockObsidianChest;
import cpw.mods.ironchest.common.blocks.BlockSilverChest; import com.progwml6.ironchest.common.blocks.BlockSilverChest;
import cpw.mods.ironchest.common.items.ItemChest; import com.progwml6.ironchest.common.items.ItemChest;
import cpw.mods.ironchest.common.util.BlockNames; import com.progwml6.ironchest.common.util.BlockNames;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.Item.Builder; import net.minecraft.item.Item.Properties;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
@ -35,7 +35,7 @@ import net.minecraftforge.registries.ObjectHolder;
public class IronChestBlocks public class IronChestBlocks
{ {
public static Builder itemBuilder; public static Properties itemBuilder;
@ObjectHolder(BlockNames.IRON_CHEST) @ObjectHolder(BlockNames.IRON_CHEST)
public static BlockChest ironChestBlock; public static BlockChest ironChestBlock;
@ -98,14 +98,14 @@ public class IronChestBlocks
{ {
IForgeRegistry<Block> blockRegistry = event.getRegistry(); IForgeRegistry<Block> blockRegistry = event.getRegistry();
blockRegistry.register(new BlockIronChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); blockRegistry.register(new BlockIronChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
blockRegistry.register(new BlockGoldChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); blockRegistry.register(new BlockGoldChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
blockRegistry.register(new BlockDiamondChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); blockRegistry.register(new BlockDiamondChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
blockRegistry.register(new BlockCopperChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); blockRegistry.register(new BlockCopperChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
blockRegistry.register(new BlockSilverChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); blockRegistry.register(new BlockSilverChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
blockRegistry.register(new BlockCrystalChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); blockRegistry.register(new BlockCrystalChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
blockRegistry.register(new BlockObsidianChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 10000.0F))); blockRegistry.register(new BlockObsidianChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 10000.0F)));
blockRegistry.register(new BlockDirtChest(Block.Builder.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F))); blockRegistry.register(new BlockDirtChest(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 3.0F)));
} }
@SubscribeEvent @SubscribeEvent
@ -113,7 +113,7 @@ public class IronChestBlocks
{ {
IForgeRegistry<Item> itemRegistry = event.getRegistry(); IForgeRegistry<Item> itemRegistry = event.getRegistry();
itemBuilder = (new Builder()).group(IronChestCreativeTabs.IRON_CHESTS).setTEISR(() -> TileEntityIronChestItemRenderer::new); itemBuilder = (new Properties()).group(IronChestCreativeTabs.IRON_CHESTS).setTEISR(() -> TileEntityIronChestItemRenderer::new);
itemRegistry.register(new ItemChest(ironChestBlock, itemBuilder)); itemRegistry.register(new ItemChest(ironChestBlock, itemBuilder));
itemRegistry.register(new ItemChest(goldChestBlock, itemBuilder)); itemRegistry.register(new ItemChest(goldChestBlock, itemBuilder));

View File

@ -8,7 +8,7 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.core; package com.progwml6.ironchest.common.core;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;

View File

@ -8,14 +8,14 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.core; package com.progwml6.ironchest.common.core;
import cpw.mods.ironchest.IronChest; import com.progwml6.ironchest.IronChest;
import cpw.mods.ironchest.common.items.ChestChangerType; import com.progwml6.ironchest.common.items.ChestChangerType;
import cpw.mods.ironchest.common.items.ItemChestChanger; import com.progwml6.ironchest.common.items.ItemChestChanger;
import cpw.mods.ironchest.common.util.ItemNames; import com.progwml6.ironchest.common.util.ItemNames;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.Item.Builder; import net.minecraft.item.Item.Properties;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
@ -24,7 +24,7 @@ import net.minecraftforge.registries.ObjectHolder;
public class IronChestItems public class IronChestItems
{ {
public static Builder itemBuilder; public static Properties itemProperties;
@ObjectHolder(ItemNames.IRON_GOLD_UPGRADE) @ObjectHolder(ItemNames.IRON_GOLD_UPGRADE)
public static Item ironToGoldUpgrade; public static Item ironToGoldUpgrade;
@ -66,17 +66,17 @@ public class IronChestItems
{ {
IForgeRegistry<Item> itemRegistry = event.getRegistry(); IForgeRegistry<Item> itemRegistry = event.getRegistry();
itemBuilder = (new Builder()).group(IronChestCreativeTabs.IRON_CHESTS).maxStackSize(1); itemProperties = (new Properties()).group(IronChestCreativeTabs.IRON_CHESTS).maxStackSize(1);
itemRegistry.register(new ItemChestChanger(itemBuilder, ChestChangerType.IRON_GOLD)); itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.IRON_GOLD));
itemRegistry.register(new ItemChestChanger(itemBuilder, ChestChangerType.GOLD_DIAMOND)); itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.GOLD_DIAMOND));
itemRegistry.register(new ItemChestChanger(itemBuilder, ChestChangerType.COPPER_SILVER)); itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.COPPER_SILVER));
itemRegistry.register(new ItemChestChanger(itemBuilder, ChestChangerType.SILVER_GOLD)); itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.SILVER_GOLD));
itemRegistry.register(new ItemChestChanger(itemBuilder, ChestChangerType.COPPER_IRON)); itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.COPPER_IRON));
itemRegistry.register(new ItemChestChanger(itemBuilder, ChestChangerType.DIAMOND_CRYSTAL)); itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.DIAMOND_CRYSTAL));
itemRegistry.register(new ItemChestChanger(itemBuilder, ChestChangerType.WOOD_IRON)); itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.WOOD_IRON));
itemRegistry.register(new ItemChestChanger(itemBuilder, ChestChangerType.WOOD_COPPER)); itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.WOOD_COPPER));
itemRegistry.register(new ItemChestChanger(itemBuilder, ChestChangerType.DIAMOND_OBSIDIAN)); itemRegistry.register(new ItemChestChanger(itemProperties, ChestChangerType.DIAMOND_OBSIDIAN));
} }
} }
} }

View File

@ -8,9 +8,9 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.gui; package com.progwml6.ironchest.common.gui;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.common.blocks.IronChestType;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;

View File

@ -0,0 +1,26 @@
package com.progwml6.ironchest.common.gui;
import com.progwml6.ironchest.client.gui.GUIChest;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.network.FMLPlayMessages;
public class GuiHandler
{
public static GuiScreen openGui(FMLPlayMessages.OpenContainer openContainer)
{
BlockPos pos = openContainer.getAdditionalData().readBlockPos();
for (GUIChest.GUI type : GUIChest.GUI.values())
{
if (type.getGuiId().equals(openContainer.getId()))
{
return new GUIChest(type, (IInventory) Minecraft.getInstance().player.inventory, (IInventory) Minecraft.getInstance().world.getTileEntity(pos));
}
}
return null;
}
}

View File

@ -8,9 +8,9 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.gui.slot; package com.progwml6.ironchest.common.gui.slot;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.common.blocks.IronChestType;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;

View File

@ -8,20 +8,20 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.items; package com.progwml6.ironchest.common.items;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.common.blocks.IronChestType;
import cpw.mods.ironchest.common.util.ItemNames; import com.progwml6.ironchest.common.util.ItemNames;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import static cpw.mods.ironchest.common.blocks.IronChestType.COPPER; import static com.progwml6.ironchest.common.blocks.IronChestType.COPPER;
import static cpw.mods.ironchest.common.blocks.IronChestType.CRYSTAL; import static com.progwml6.ironchest.common.blocks.IronChestType.CRYSTAL;
import static cpw.mods.ironchest.common.blocks.IronChestType.DIAMOND; import static com.progwml6.ironchest.common.blocks.IronChestType.DIAMOND;
import static cpw.mods.ironchest.common.blocks.IronChestType.GOLD; import static com.progwml6.ironchest.common.blocks.IronChestType.GOLD;
import static cpw.mods.ironchest.common.blocks.IronChestType.IRON; import static com.progwml6.ironchest.common.blocks.IronChestType.IRON;
import static cpw.mods.ironchest.common.blocks.IronChestType.OBSIDIAN; import static com.progwml6.ironchest.common.blocks.IronChestType.OBSIDIAN;
import static cpw.mods.ironchest.common.blocks.IronChestType.SILVER; import static com.progwml6.ironchest.common.blocks.IronChestType.SILVER;
import static cpw.mods.ironchest.common.blocks.IronChestType.WOOD; import static com.progwml6.ironchest.common.blocks.IronChestType.WOOD;
public enum ChestChangerType public enum ChestChangerType
{ {

View File

@ -8,16 +8,17 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.items; package com.progwml6.ironchest.common.items;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
public class ItemChest extends ItemBlock public class ItemChest extends ItemBlock
{ {
public ItemChest(Block block, Builder builder) public ItemChest(Block block, Item.Properties properties)
{ {
super(block, builder); super(block, properties);
this.setRegistryName(block.getRegistryName()); this.setRegistryName(block.getRegistryName());
} }

View File

@ -8,12 +8,12 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.items; package com.progwml6.ironchest.common.items;
import cpw.mods.ironchest.common.blocks.BlockChest; import com.progwml6.ironchest.common.blocks.BlockChest;
import cpw.mods.ironchest.common.blocks.BlockIronChest; import com.progwml6.ironchest.common.blocks.BlockIronChest;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.common.blocks.IronChestType;
import cpw.mods.ironchest.common.tileentity.TileEntityIronChest; import com.progwml6.ironchest.common.tileentity.TileEntityIronChest;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -31,7 +31,7 @@ public class ItemChestChanger extends ItemTooltip
{ {
public final ChestChangerType type; public final ChestChangerType type;
public ItemChestChanger(Builder properties, ChestChangerType chestChangerType) public ItemChestChanger(Properties properties, ChestChangerType chestChangerType)
{ {
super(properties); super(properties);
this.type = chestChangerType; this.type = chestChangerType;

View File

@ -8,7 +8,7 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.items; package com.progwml6.ironchest.common.items;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
@ -27,7 +27,7 @@ import java.util.List;
public class ItemTooltip extends Item public class ItemTooltip extends Item
{ {
public ItemTooltip(Builder properties) public ItemTooltip(Properties properties)
{ {
super(properties); super(properties);
} }

View File

@ -8,10 +8,10 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.network; package com.progwml6.ironchest.common.network;
import cpw.mods.ironchest.IronChest; import com.progwml6.ironchest.IronChest;
import cpw.mods.ironchest.common.network.packets.PacketTopStackSyncChest; import com.progwml6.ironchest.common.network.packets.PacketTopStackSyncChest;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayer;

View File

@ -8,10 +8,10 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.network.packets; package com.progwml6.ironchest.common.network.packets;
import cpw.mods.ironchest.IronChest; import com.progwml6.ironchest.common.tileentity.TileEntityCrystalChest;
import cpw.mods.ironchest.common.tileentity.TileEntityCrystalChest; import com.progwml6.ironchest.IronChest;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;

View File

@ -8,20 +8,18 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.tileentity; package com.progwml6.ironchest.common.tileentity;
import com.mojang.datafixers.DataFixUtils; import com.mojang.datafixers.DataFixUtils;
import com.mojang.datafixers.types.Type; import com.mojang.datafixers.types.Type;
import cpw.mods.ironchest.IronChest; import com.progwml6.ironchest.common.util.TileEntityNames;
import cpw.mods.ironchest.common.util.TileEntityNames; import com.progwml6.ironchest.IronChest;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SharedConstants; import net.minecraft.util.SharedConstants;
import net.minecraft.util.datafix.DataFixesManager; import net.minecraft.util.datafix.DataFixesManager;
import net.minecraft.util.datafix.TypeReferences; import net.minecraft.util.datafix.TypeReferences;
import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
@ -66,22 +64,14 @@ public class IronChestEntityType
@SubscribeEvent @SubscribeEvent
public static void onTileEntityRegistry(final RegistryEvent.Register<TileEntityType<?>> e) public static void onTileEntityRegistry(final RegistryEvent.Register<TileEntityType<?>> e)
{ {
registerTileEntityType(e.getRegistry(), register("iron_chest", TileEntityType.Builder.create(TileEntityIronChest::new)), registerTileEntityType(e.getRegistry(), register("iron_chest", TileEntityType.Builder.create(TileEntityIronChest::new)), TileEntityNames.IRON_CHEST);
TileEntityNames.IRON_CHEST); registerTileEntityType(e.getRegistry(), register("gold_chest", TileEntityType.Builder.create(TileEntityGoldChest::new)), TileEntityNames.GOLD_CHEST);
registerTileEntityType(e.getRegistry(), register("gold_chest", TileEntityType.Builder.create(TileEntityGoldChest::new)), registerTileEntityType(e.getRegistry(), register("diamond_chest", TileEntityType.Builder.create(TileEntityDiamondChest::new)), TileEntityNames.DIAMOND_CHEST);
TileEntityNames.GOLD_CHEST); registerTileEntityType(e.getRegistry(), register("crystal_chest", TileEntityType.Builder.create(TileEntityCrystalChest::new)), TileEntityNames.CRYSTAL_CHEST);
registerTileEntityType(e.getRegistry(), register("diamond_chest", TileEntityType.Builder.create(TileEntityDiamondChest::new)), registerTileEntityType(e.getRegistry(), register("dirt_chest", TileEntityType.Builder.create(TileEntityDirtChest::new)), TileEntityNames.DIRT_CHEST);
TileEntityNames.DIAMOND_CHEST); registerTileEntityType(e.getRegistry(), register("copper_chest", TileEntityType.Builder.create(TileEntityCopperChest::new)), TileEntityNames.COPPER_CHEST);
registerTileEntityType(e.getRegistry(), register("crystal_chest", TileEntityType.Builder.create(TileEntityCrystalChest::new)), registerTileEntityType(e.getRegistry(), register("silver_chest", TileEntityType.Builder.create(TileEntitySilverChest::new)), TileEntityNames.SILVER_CHEST);
TileEntityNames.CRYSTAL_CHEST); registerTileEntityType(e.getRegistry(), register("obsidian_chest", TileEntityType.Builder.create(TileEntityObsidianChest::new)), TileEntityNames.OBSIDIAN_CHEST);
registerTileEntityType(e.getRegistry(), register("dirt_chest", TileEntityType.Builder.create(TileEntityDirtChest::new)),
TileEntityNames.DIRT_CHEST);
registerTileEntityType(e.getRegistry(), register("copper_chest", TileEntityType.Builder.create(TileEntityCopperChest::new)),
TileEntityNames.COPPER_CHEST);
registerTileEntityType(e.getRegistry(), register("silver_chest", TileEntityType.Builder.create(TileEntitySilverChest::new)),
TileEntityNames.SILVER_CHEST);
registerTileEntityType(e.getRegistry(), register("obsidian_chest", TileEntityType.Builder.create(TileEntityObsidianChest::new)),
TileEntityNames.OBSIDIAN_CHEST);
} }
} }

View File

@ -8,10 +8,11 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.tileentity; package com.progwml6.ironchest.common.tileentity;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.client.gui.GUIChest;
import cpw.mods.ironchest.common.core.IronChestBlocks; import com.progwml6.ironchest.common.blocks.IronChestType;
import com.progwml6.ironchest.common.core.IronChestBlocks;
public class TileEntityCopperChest extends TileEntityIronChest public class TileEntityCopperChest extends TileEntityIronChest
{ {
@ -19,4 +20,10 @@ public class TileEntityCopperChest extends TileEntityIronChest
{ {
super(IronChestEntityType.COPPER_CHEST, IronChestType.COPPER, IronChestBlocks.copperChestBlock); super(IronChestEntityType.COPPER_CHEST, IronChestType.COPPER, IronChestBlocks.copperChestBlock);
} }
@Override
public String getGuiID()
{
return GUIChest.GUI.COPPER.getGuiId().toString();
}
} }

View File

@ -8,12 +8,13 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.tileentity; package com.progwml6.ironchest.common.tileentity;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.client.gui.GUIChest;
import cpw.mods.ironchest.common.core.IronChestBlocks; import com.progwml6.ironchest.common.blocks.IronChestType;
import cpw.mods.ironchest.common.network.PacketHandler; import com.progwml6.ironchest.common.core.IronChestBlocks;
import cpw.mods.ironchest.common.network.packets.PacketTopStackSyncChest; import com.progwml6.ironchest.common.network.PacketHandler;
import com.progwml6.ironchest.common.network.packets.PacketTopStackSyncChest;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
@ -22,7 +23,6 @@ import net.minecraft.util.NonNullList;
import net.minecraftforge.fml.server.ServerLifecycleHooks; import net.minecraftforge.fml.server.ServerLifecycleHooks;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
public class TileEntityCrystalChest extends TileEntityIronChest public class TileEntityCrystalChest extends TileEntityIronChest
{ {
@ -141,11 +141,7 @@ public class TileEntityCrystalChest extends TileEntityIronChest
this.hadStuff = true; this.hadStuff = true;
Collections.sort(tempCopy, new Comparator<ItemStack>() Collections.sort(tempCopy, (stack1, stack2) -> {
{
@Override
public int compare(ItemStack stack1, ItemStack stack2)
{
if (stack1.isEmpty()) if (stack1.isEmpty())
{ {
return 1; return 1;
@ -158,7 +154,6 @@ public class TileEntityCrystalChest extends TileEntityIronChest
{ {
return stack2.getCount() - stack1.getCount(); return stack2.getCount() - stack1.getCount();
} }
}
}); });
int p = 0; int p = 0;
@ -227,7 +222,7 @@ public class TileEntityCrystalChest extends TileEntityIronChest
for (EntityPlayerMP player : ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers()) for (EntityPlayerMP player : ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayers())
{ {
if (player.dimension == world.getDimension().getId()) if (player.dimension == world.getDimension().getType())
{ {
double d4 = getPos().getX() - player.posX; double d4 = getPos().getX() - player.posX;
double d5 = getPos().getY() - player.posY; double d5 = getPos().getY() - player.posY;
@ -235,7 +230,7 @@ public class TileEntityCrystalChest extends TileEntityIronChest
if (d4 * d4 + d5 * d5 + d6 * d6 < 16384) if (d4 * d4 + d5 * d5 + d6 * d6 < 16384)
{ {
PacketHandler.sendTo(new PacketTopStackSyncChest(this.getWorld().getDimension().getId(), this.getPos(), stacks), player); PacketHandler.sendTo(new PacketTopStackSyncChest(this.getWorld().getDimension().getType().getId(), this.getPos(), stacks), player);
} }
} }
} }
@ -245,4 +240,10 @@ public class TileEntityCrystalChest extends TileEntityIronChest
{ {
this.topStacks = topStacks; this.topStacks = topStacks;
} }
@Override
public String getGuiID()
{
return GUIChest.GUI.CRYSTAL.getGuiId().toString();
}
} }

View File

@ -8,10 +8,11 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.tileentity; package com.progwml6.ironchest.common.tileentity;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.client.gui.GUIChest;
import cpw.mods.ironchest.common.core.IronChestBlocks; import com.progwml6.ironchest.common.blocks.IronChestType;
import com.progwml6.ironchest.common.core.IronChestBlocks;
public class TileEntityDiamondChest extends TileEntityIronChest public class TileEntityDiamondChest extends TileEntityIronChest
{ {
@ -19,4 +20,10 @@ public class TileEntityDiamondChest extends TileEntityIronChest
{ {
super(IronChestEntityType.DIAMOND_CHEST, IronChestType.DIAMOND, IronChestBlocks.diamondChestBlock); super(IronChestEntityType.DIAMOND_CHEST, IronChestType.DIAMOND, IronChestBlocks.diamondChestBlock);
} }
@Override
public String getGuiID()
{
return GUIChest.GUI.DIAMOND.getGuiId().toString();
}
} }

View File

@ -8,10 +8,11 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.tileentity; package com.progwml6.ironchest.common.tileentity;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.client.gui.GUIChest;
import cpw.mods.ironchest.common.core.IronChestBlocks; import com.progwml6.ironchest.common.blocks.IronChestType;
import com.progwml6.ironchest.common.core.IronChestBlocks;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Items; import net.minecraft.init.Items;
@ -19,7 +20,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString; import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentTranslation;
public class TileEntityDirtChest extends TileEntityIronChest public class TileEntityDirtChest extends TileEntityIronChest
{ {
@ -62,14 +63,20 @@ public class TileEntityDirtChest extends TileEntityIronChest
dirtChest9000GuideBook.setTagInfo("title", new NBTTagString(I18n.format("book.ironchest.dirtchest9000.title"))); dirtChest9000GuideBook.setTagInfo("title", new NBTTagString(I18n.format("book.ironchest.dirtchest9000.title")));
NBTTagList pages = new NBTTagList(); NBTTagList pages = new NBTTagList();
pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentString(I18n.format("book.ironchest.dirtchest9000.page1"))))); pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentTranslation("book.ironchest.dirtchest9000.page1"))));
pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentString(I18n.format("book.ironchest.dirtchest9000.page2"))))); pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentTranslation("book.ironchest.dirtchest9000.page2"))));
pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentString(I18n.format("book.ironchest.dirtchest9000.page3"))))); pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentTranslation("book.ironchest.dirtchest9000.page3"))));
pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentString(I18n.format("book.ironchest.dirtchest9000.page4"))))); pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentTranslation("book.ironchest.dirtchest9000.page4"))));
pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentString(I18n.format("book.ironchest.dirtchest9000.page5"))))); pages.add(new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentTranslation("book.ironchest.dirtchest9000.page5"))));
dirtChest9000GuideBook.setTagInfo("pages", pages); dirtChest9000GuideBook.setTagInfo("pages", pages);
bookDataCreated = true; bookDataCreated = true;
} }
@Override
public String getGuiID()
{
return GUIChest.GUI.DIRTCHEST9000.getGuiId().toString();
}
} }

View File

@ -8,10 +8,11 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.tileentity; package com.progwml6.ironchest.common.tileentity;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.client.gui.GUIChest;
import cpw.mods.ironchest.common.core.IronChestBlocks; import com.progwml6.ironchest.common.blocks.IronChestType;
import com.progwml6.ironchest.common.core.IronChestBlocks;
public class TileEntityGoldChest extends TileEntityIronChest public class TileEntityGoldChest extends TileEntityIronChest
{ {
@ -19,4 +20,10 @@ public class TileEntityGoldChest extends TileEntityIronChest
{ {
super(IronChestEntityType.GOLD_CHEST, IronChestType.GOLD, IronChestBlocks.goldChestBlock); super(IronChestEntityType.GOLD_CHEST, IronChestType.GOLD, IronChestBlocks.goldChestBlock);
} }
@Override
public String getGuiID()
{
return GUIChest.GUI.GOLD.getGuiId().toString();
}
} }

View File

@ -8,12 +8,13 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.tileentity; package com.progwml6.ironchest.common.tileentity;
import cpw.mods.ironchest.common.blocks.BlockChest; import com.progwml6.ironchest.client.gui.GUIChest;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.common.blocks.BlockChest;
import cpw.mods.ironchest.common.core.IronChestBlocks; import com.progwml6.ironchest.common.blocks.IronChestType;
import cpw.mods.ironchest.common.gui.ContainerIronChest; import com.progwml6.ironchest.common.core.IronChestBlocks;
import com.progwml6.ironchest.common.gui.ContainerIronChest;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
@ -322,7 +323,7 @@ public class TileEntityIronChest extends TileEntityLockableLoot implements IChes
@Override @Override
public String getGuiID() public String getGuiID()
{ {
return "IronChest:" + this.getIronChestType().name() + "_chest"; return GUIChest.GUI.IRON.getGuiId().toString();
} }
@Override @Override

View File

@ -8,10 +8,11 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.tileentity; package com.progwml6.ironchest.common.tileentity;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.client.gui.GUIChest;
import cpw.mods.ironchest.common.core.IronChestBlocks; import com.progwml6.ironchest.common.blocks.IronChestType;
import com.progwml6.ironchest.common.core.IronChestBlocks;
public class TileEntityObsidianChest extends TileEntityIronChest public class TileEntityObsidianChest extends TileEntityIronChest
{ {
@ -19,4 +20,10 @@ public class TileEntityObsidianChest extends TileEntityIronChest
{ {
super(IronChestEntityType.OBSIDIAN_CHEST, IronChestType.OBSIDIAN, IronChestBlocks.obsidianChestBlock); super(IronChestEntityType.OBSIDIAN_CHEST, IronChestType.OBSIDIAN, IronChestBlocks.obsidianChestBlock);
} }
@Override
public String getGuiID()
{
return GUIChest.GUI.OBSIDIAN.getGuiId().toString();
}
} }

View File

@ -8,10 +8,11 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.tileentity; package com.progwml6.ironchest.common.tileentity;
import cpw.mods.ironchest.common.blocks.IronChestType; import com.progwml6.ironchest.client.gui.GUIChest;
import cpw.mods.ironchest.common.core.IronChestBlocks; import com.progwml6.ironchest.common.blocks.IronChestType;
import com.progwml6.ironchest.common.core.IronChestBlocks;
public class TileEntitySilverChest extends TileEntityIronChest public class TileEntitySilverChest extends TileEntityIronChest
{ {
@ -19,4 +20,10 @@ public class TileEntitySilverChest extends TileEntityIronChest
{ {
super(IronChestEntityType.SILVER_CHEST, IronChestType.SILVER, IronChestBlocks.silverChestBlock); super(IronChestEntityType.SILVER_CHEST, IronChestType.SILVER, IronChestBlocks.silverChestBlock);
} }
@Override
public String getGuiID()
{
return GUIChest.GUI.SILVER.getGuiId().toString();
}
} }

View File

@ -8,9 +8,9 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.util; package com.progwml6.ironchest.common.util;
import cpw.mods.ironchest.IronChest; import com.progwml6.ironchest.IronChest;
public class BlockNames public class BlockNames
{ {

View File

@ -8,9 +8,9 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.util; package com.progwml6.ironchest.common.util;
import cpw.mods.ironchest.IronChest; import com.progwml6.ironchest.IronChest;
public class ItemNames public class ItemNames
{ {

View File

@ -8,9 +8,9 @@
* Contributors: * Contributors:
* cpw - initial API and implementation * cpw - initial API and implementation
******************************************************************************/ ******************************************************************************/
package cpw.mods.ironchest.common.util; package com.progwml6.ironchest.common.util;
import cpw.mods.ironchest.IronChest; import com.progwml6.ironchest.IronChest;
public class TileEntityNames public class TileEntityNames
{ {

View File

@ -1,93 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Public License v3.0
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
* <p>
* Contributors:
* cpw - initial API and implementation
******************************************************************************/
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.network.PacketHandler;
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.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLModLoadingContext;
@Mod(value = IronChest.MOD_ID)
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 IronChest()
{
instance = this;
FMLModLoadingContext.get().getModEventBus().addListener(this::preInit);
MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
}
private void preInit(final FMLCommonSetupEvent event)
{
proxy.preInit();
if (IronChest.DEBUG)
{
debugPrints();
}
PacketHandler.register();
}
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("--------------------------");
}
}

View File

@ -1,7 +1,6 @@
modLoader="javafml" modLoader="javafml"
loaderVersion="[24,)" loaderVersion="[24,)"
issueTrackerURL="https://github.com/progwml6/ironchest/issues"
displayURL="https://minecraft.curseforge.com/projects/iron-chests"
[[mods]] [[mods]]
modId="ironchest" modId="ironchest"
@ -9,10 +8,12 @@ displayURL="https://minecraft.curseforge.com/projects/iron-chests"
displayName="Iron Chests" displayName="Iron Chests"
authors="cpw, alexbegt, progwml6" authors="cpw, alexbegt, progwml6"
description=''' description='''
New chests with larger sizes, with in-place upgrade items. New chests with larger sizes, with in-place upgrade items.
The feature chest is the crystal chest, which is transparent - some inventory contents are visible without opening the chest The feature chest is the crystal chest, which is transparent - some inventory contents are visible without opening the chest
''' '''
namespace="ironchest" namespace="ironchest"
issueTrackerURL="https://github.com/progwml6/ironchest/issues"
displayURL="https://minecraft.curseforge.com/projects/iron-chests"
[[dependencies.ironchest]] [[dependencies.ironchest]]
modId="forge" modId="forge"
mandatory=true mandatory=true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB