Chest will be done nearer to christmas

This commit is contained in:
TheCricket committed 2014-11-27 13:07:59 -05:00
1 parent 37bad22041
commit fed9ba684f
8 files changed
+124 -114

No files matched your search

@@ -1,34 +1,5 @@
package info.jbcs.minecraft.chisel;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import info.jbcs.minecraft.chisel.block.BlockCarvable;
import info.jbcs.minecraft.chisel.block.tileentity.TileEntityAutoChisel;
import info.jbcs.minecraft.chisel.client.gui.GuiAutoChisel;
import info.jbcs.minecraft.chisel.client.gui.GuiChisel;
import info.jbcs.minecraft.chisel.compat.Compatibility;
import info.jbcs.minecraft.chisel.compat.FMPIntegration;
import info.jbcs.minecraft.chisel.compat.ModIntegration;
import info.jbcs.minecraft.chisel.init.ModBlocks;
import info.jbcs.minecraft.chisel.init.ModItems;
import info.jbcs.minecraft.chisel.init.ModTabs;
import info.jbcs.minecraft.chisel.inventory.ContainerAutoChisel;
import info.jbcs.minecraft.chisel.inventory.ContainerChisel;
import info.jbcs.minecraft.chisel.inventory.InventoryChiselSelection;
import info.jbcs.minecraft.chisel.proxy.CommonProxy;
import info.jbcs.minecraft.chisel.world.GeneratorLimestone;
import info.jbcs.minecraft.chisel.world.GeneratorMarble;
import info.jbcs.minecraft.chisel.utils.General;
import java.io.File;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
@@ -36,34 +7,55 @@ import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.event.FMLMissingMappingsEvent.MissingMapping;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.GameRegistry.Type;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import info.jbcs.minecraft.chisel.block.BlockCarvable;
import info.jbcs.minecraft.chisel.block.tileentity.TileEntityAutoChisel;
import info.jbcs.minecraft.chisel.block.tileentity.TileEntityPresent;
import info.jbcs.minecraft.chisel.client.gui.GuiAutoChisel;
import info.jbcs.minecraft.chisel.client.gui.GuiChisel;
import info.jbcs.minecraft.chisel.client.gui.GuiPresent;
import info.jbcs.minecraft.chisel.compat.Compatibility;
import info.jbcs.minecraft.chisel.compat.ModIntegration;
import info.jbcs.minecraft.chisel.init.ModBlocks;
import info.jbcs.minecraft.chisel.init.ModItems;
import info.jbcs.minecraft.chisel.init.ModTabs;
import info.jbcs.minecraft.chisel.inventory.ContainerAutoChisel;
import info.jbcs.minecraft.chisel.inventory.ContainerChisel;
import info.jbcs.minecraft.chisel.inventory.ContainerPresent;
import info.jbcs.minecraft.chisel.inventory.InventoryChiselSelection;
import info.jbcs.minecraft.chisel.proxy.CommonProxy;
import info.jbcs.minecraft.chisel.utils.General;
import info.jbcs.minecraft.chisel.world.GeneratorLimestone;
import info.jbcs.minecraft.chisel.world.GeneratorMarble;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import java.io.File;
@Mod(modid = Chisel.MOD_ID, name = Chisel.MOD_NAME, version = Chisel.VERSION, guiFactory = "info.jbcs.minecraft.chisel.client.gui.GuiFactory", dependencies = "after:ForgeMultipart;")
public class Chisel
{
public static final String MOD_ID = "chisel";
public static final BlockCarvable.SoundType soundTempleFootstep = new BlockCarvable.SoundType("dig.stone", MOD_ID + ":step.templeblock", 1.0f, 1.0f);
public static final String MOD_NAME = "Chisel 2";
public static final String VERSION = "2.0.0.3";
public static boolean multipartLoaded = false;
public static final BlockCarvable.SoundType soundHolystoneFootstep = new BlockCarvable.SoundType("holystone", 1.0f, 1.0f);
public static final BlockCarvable.SoundType soundTempleFootstep = new BlockCarvable.SoundType("dig.stone", MOD_ID+":step.templeblock", 1.0f, 1.0f);
public static final BlockCarvable.SoundType soundMetalFootstep = new BlockCarvable.SoundType("metal", 1.0f, 1.0f);
public static boolean multipartLoaded = false;
public static int RenderEldritchId;
public static int RenderCTMId;
public static int RenderCarpetId;
@@ -74,38 +66,39 @@ public class Chisel
@SidedProxy(clientSide = "info.jbcs.minecraft.chisel.proxy.ClientProxy", serverSide = "info.jbcs.minecraft.chisel.proxy.CommonProxy")
public static CommonProxy proxy;
@SideOnly(Side.CLIENT)
private static void initModIntegration() {
//To be added back at a different time
//ModIntegration.addMod(FMPIntegration.class);
ModIntegration.init();
}
@EventHandler
public void missingMapping(FMLMissingMappingsEvent event)
{
public void missingMapping(FMLMissingMappingsEvent event) {
BlockNameConversion.init();
for(MissingMapping m : event.get())
{
for (MissingMapping m : event.get()) {
// This bug was introduced along with Chisel 1.5.2, and was fixed in 1.5.3.
// Ice Stairs were called null.0-7 instead of other names, and Marble/Limestone stairs did not exist.
// This fixes the bug.
if(m.name.startsWith("null.") && m.name.length() == 6 && m.type == Type.BLOCK)
{
if (m.name.startsWith("null.") && m.name.length() == 6 && m.type == Type.BLOCK) {
m.warn();//(Action.WARN);
}
// Fix mapping of snakestoneSand, snakestoneStone, limestoneStairs, marbleStairs when loading an old (1.5.4) save
else if(m.type == Type.BLOCK)
{
else if (m.type == Type.BLOCK) {
final Block block = BlockNameConversion.findBlock(m.name);
if(block != null)
{
if (block != null) {
m.remap(block);
FMLLog.getLogger().info("Remapping block " + m.name + " to " + General.getName(block));
} else
FMLLog.getLogger().warn("Block " + m.name + " could not get remapped.");
} else if(m.type == Type.ITEM)
{
} else if (m.type == Type.ITEM) {
final Item item = BlockNameConversion.findItem(m.name);
if(item != null)
{
if (item != null) {
m.remap(item);
FMLLog.getLogger().info("Remapping item " + m.name + " to " + General.getName(item));
@@ -116,8 +109,7 @@ public class Chisel
}
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
public void preInit(FMLPreInitializationEvent event) {
File configFile = event.getSuggestedConfigurationFile();
Configurations.configExists = configFile.exists();
Configurations.config = new Configuration(configFile);
@@ -135,33 +127,38 @@ public class Chisel
{
Crafting.init();
NetworkRegistry.INSTANCE.registerGuiHandler(this, new IGuiHandler()
{
NetworkRegistry.INSTANCE.registerGuiHandler(this, new IGuiHandler() {
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
switch (ID){
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) {
case 0:
return new ContainerChisel(player.inventory, new InventoryChiselSelection(null));
case 1:
TileEntity tileentity = world.getTileEntity(x, y, z);
if (tileentity instanceof TileEntityAutoChisel)
return new ContainerAutoChisel(player.inventory, (TileEntityAutoChisel) tileentity);
TileEntity tileentity = world.getTileEntity(x, y, z);
if (tileentity instanceof TileEntityAutoChisel)
return new ContainerAutoChisel(player.inventory, (TileEntityAutoChisel) tileentity);
case 2:
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileEntityPresent)
return new ContainerPresent(player.inventory, (TileEntityPresent) tileEntity);
default:
return null;
}
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
switch (ID){
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
switch (ID) {
case 0:
return new GuiChisel(player.inventory, new InventoryChiselSelection(null));
case 1:
TileEntity tileentity = world.getTileEntity(x, y, z);
if (tileentity instanceof TileEntityAutoChisel)
return new GuiAutoChisel(player.inventory, (TileEntityAutoChisel) tileentity);
TileEntity tileentity = world.getTileEntity(x, y, z);
if (tileentity instanceof TileEntityAutoChisel)
return new GuiAutoChisel(player.inventory, (TileEntityAutoChisel) tileentity);
case 2:
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileEntityPresent)
return new GuiPresent(player.inventory, (TileEntityPresent) tileEntity);
default:
return null;
}
@@ -172,7 +169,7 @@ public class Chisel
GameRegistry.registerWorldGenerator(new GeneratorMarble(ModBlocks.marble, 32, Configurations.marbleAmount), 1000);
GameRegistry.registerWorldGenerator(new GeneratorLimestone(ModBlocks.limestone, 32, Configurations.limestoneAmount), 1000);
if(event.getSide() == Side.CLIENT){
if (event.getSide() == Side.CLIENT) {
initModIntegration();
}
@@ -191,22 +188,11 @@ public class Chisel
Compatibility.init(event);
}
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event)
{
if(event.modID.equals("chisel"))
{
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
if (event.modID.equals("chisel")) {
Configurations.refreshConfig();
}
}
@SideOnly(Side.CLIENT)
private static void initModIntegration(){
//To be added back at a different time
//ModIntegration.addMod(FMPIntegration.class);
ModIntegration.init();
}
}
@@ -70,6 +70,8 @@ public class Crafting
GameRegistry.addRecipe(new ItemStack(ModItems.itemBallOMoss, 1), new Object[]{"XYX", "YXY", "XYX", 'X', Blocks.vine, 'Y', Items.stick});
if(Configurations.featureEnabled("cloud"))
GameRegistry.addRecipe(new ItemStack(ModItems.itemCloudInABottle, 1), new Object[]{"X X", "XYX", " X ", 'X', Blocks.glass, 'Y', Items.quartz});
if (Configurations.featureEnabled("smashingrock"))
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.smashingRock, 16), new Object[]{new ItemStack(Items.stone_pickaxe), new ItemStack(Items.glass_bottle, 1), new ItemStack(Items.stone_shovel)});
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.paperWall, 8), new Object[]{"ppp", "psp", "ppp", ('p'), Items.paper, ('s'), "stickWood"}));
@@ -240,23 +240,18 @@ public class BlockPresent extends BlockContainer implements ICarvable {
}
}
world.func_147453_f(x, y, z, present);
world.func_147453_f(x, y, z, this);
}
super.breakBlock(world, x, y, z, present, meta);
super.breakBlock(world, x, y, z, this, meta);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int meta, float x1, float y1, float z1) {
if (world.isRemote) {
if (!world.isRemote) {
player.openGui(Chisel.instance, 2, world, x, y, z);
return true;
} else {
IInventory inventory = getInventory(world, x, y, z);
if (inventory != null) {
player.openGui(Chisel.instance, 2, world, x, y, z);
}
return true;
}
}
@@ -0,0 +1,31 @@
package info.jbcs.minecraft.chisel.client.gui;
import info.jbcs.minecraft.chisel.block.tileentity.TileEntityPresent;
import info.jbcs.minecraft.chisel.inventory.ContainerPresent;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class GuiPresent extends GuiContainer {
private static final ResourceLocation gui = new ResourceLocation("chisel:textures/present-gui.png");
private IInventory upper, lower;
private int rows;
public GuiPresent(InventoryPlayer inventoryPlayer, TileEntityPresent tileEntityPresent) {
super(new ContainerPresent(inventoryPlayer, tileEntityPresent));
rows = tileEntityPresent.getSizeInventory() / 9;
this.ySize = 114 + rows * 18;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(gui);
int x = (this.width - this.xSize) / 2;
int y = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.rows * 18 + 17);
this.drawTexturedModalRect(x, y + this.rows * 18 + 17, 0, 126, this.xSize, 96);
}
}
@@ -23,19 +23,19 @@ public class ItemPresentRenderer implements IItemRenderer {
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Chisel.MOD_ID, "textures/blocks/present/1.png"));
FMLClientHandler.instance().getClient().renderEngine.bindTexture(new ResourceLocation(Chisel.MOD_ID, "textures/blocks/present/red.png"));
switch (type) {
case ENTITY:
renderBlock(0.0F, 1.0F, 0.0F);
renderBlock(0.0F, 0.0F, 0.0F);
break;
case EQUIPPED:
renderBlock(0.5F, 1.5F, 0.5F);
renderBlock(0.0F, 0.0F, 0.0F);
break;
case EQUIPPED_FIRST_PERSON:
renderBlock(0.5F, 1.0F, 0.5F);
renderBlock(0.0F, 0.0F, 0.0F);
break;
case INVENTORY:
renderInventory(0.0F, 0.625F, 0.0F);
renderInventory(1.0F, 1.0F, 1.0F);
break;
default:
break;
@@ -55,7 +55,7 @@ public class ItemPresentRenderer implements IItemRenderer {
GL11.glTranslatef(x, y, z);
GL11.glRotatef(180F, 1F, 0, 0);
GL11.glRotatef(-90F, 0, 1F, 0);
GL11.glScalef(0.8F, 0.8F, 0.8F);
GL11.glScalef(1.0F, 1.0F, 1.0F);
model.renderAll();
GL11.glPopMatrix();
}
@@ -4,8 +4,6 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import info.jbcs.minecraft.chisel.block.tileentity.TileEntityAutoChisel;
import info.jbcs.minecraft.chisel.client.model.ModelAutoChisel;
import info.jbcs.minecraft.chisel.init.ModItems;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@@ -20,11 +18,11 @@ import static org.lwjgl.opengl.GL11.*;
public class RenderAutoChisel extends TileEntitySpecialRenderer {
private static EntityItem ghostItem;
private static TileEntityAutoChisel autoChisel;
private final ModelAutoChisel model;
private final ResourceLocation texture = new ResourceLocation("chisel:textures/blocks/autoChisel.png");
private final RenderItem renderTargetAndChisel, renderBase;
private static EntityItem ghostItem;
private static TileEntityAutoChisel autoChisel;
public RenderAutoChisel(){
model = new ModelAutoChisel();
@@ -78,7 +76,7 @@ public class RenderAutoChisel extends TileEntitySpecialRenderer {
GL11.glPopMatrix();
}
EntityItem chisel = getGhostItem(autoChisel.getWorldObj(), new ItemStack(ModItems.chisel));
/*EntityItem chisel = getGhostItem(autoChisel.getWorldObj(), new ItemStack(ModItems.chisel));
if(chisel != null){
GL11.glPushMatrix();
@@ -86,7 +84,7 @@ public class RenderAutoChisel extends TileEntitySpecialRenderer {
GL11.glScaled(1, 1, 1);
renderTargetAndChisel.doRender(chisel, 0, 0, 0, 0, 0);
GL11.glPopMatrix();
}
}*/
}
@SideOnly(Side.CLIENT)
@@ -1309,6 +1309,7 @@ public class ModBlocks {
}
if (Configurations.featureEnabled("chest")) {
//TODO: will be done at winter time
present = (BlockPresent) new BlockPresent().setHardness(2.5F).setStepSound(Block.soundTypeWood);
Carving.chisel.addVariation("chest", Blocks.chest, 0, 0);
present.carverHelper.addVariation(StatCollector.translateToLocal("tile.presetnt.1.desc"), 1, present, 1);
@@ -18,26 +18,23 @@ public class ModItems {
public static ItemBallOMoss itemBallOMoss;
public static ItemSmashingRock smashingRock;
public static void load(){
public static void load() {
chisel = (ItemChisel) new ItemChisel().setTextureName("chisel:chisel").setCreativeTab(ModTabs.tabChisel);
GameRegistry.registerItem(chisel, "chisel");
if(Configurations.featureEnabled("cloud"))
{
itemCloudInABottle = (ItemCloudInABottle) new ItemCloudInABottle().setTextureName("Chisel:cloudinabottle").setCreativeTab(ModTabs.tabChisel);
if (Configurations.featureEnabled("cloud")) {
itemCloudInABottle = (ItemCloudInABottle) new ItemCloudInABottle().setTextureName("Chisel:cloudinabottle-x").setCreativeTab(ModTabs.tabChisel);
EntityRegistry.registerModEntity(EntityCloudInABottle.class, "CloudInABottle", 1, Chisel.instance, 40, 1, true);
GameRegistry.registerItem(itemCloudInABottle, "cloudinabottle");
}
if(Configurations.featureEnabled("ballOfMoss"))
{
if (Configurations.featureEnabled("ballOfMoss")) {
itemBallOMoss = (ItemBallOMoss) new ItemBallOMoss().setTextureName("Chisel:ballomoss").setCreativeTab(ModTabs.tabChisel);
EntityRegistry.registerModEntity(EntityBallOMoss.class, "BallOMoss", 2, Chisel.instance, 40, 1, true);
GameRegistry.registerItem(itemBallOMoss, "ballomoss");
}
if(Configurations.featureEnabled("smashingRock"))
{
if (Configurations.featureEnabled("smashingRock")) {
smashingRock = (ItemSmashingRock) new ItemSmashingRock().setTextureName("Chisel:smashingrock").setCreativeTab(ModTabs.tabChisel);
EntityRegistry.registerModEntity(EntitySmashingRock.class, "SmashingRock", 2, Chisel.instance, 40, 1, true);
GameRegistry.registerItem(smashingRock, "smashingrock");