mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-11 15:57:31 +00:00
Added in all of the original files
This commit is contained in:
1 parent
4d138e644a
commit
e55dc197cb
14 files changed
+458
-34
No files matched your search
@@ -1,7 +1,7 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
@@ -290,8 +290,8 @@ to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
{description}
|
||||
Copyright (C) {year} {fullname}
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -329,7 +329,7 @@ necessary. Here is a sample; alter the names:
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
{signature of Ty Coon}, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
@@ -337,3 +337,4 @@ proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Chisel
|
||||
=======
|
||||
Chisel is a mod for Minecraft which adds aesthetic blocks to the game through the use of a chisel. Originally created by
|
||||
AUTOMATIC_MAIDEN, it was ported to Minecraft 1.7.2 by asie, and maintained by Pokefenn.
|
||||
AUTOMATIC_MAIDEN, it was ported to Minecraft 1.7.2 by asie, and maintained by Pokefenn during 1.7.10 and now maintained by Cricket.
|
||||
|
||||
Issue Reporting
|
||||
----------------
|
||||
@@ -27,4 +27,4 @@ To set up the mod as to allow you to make changes, do the following:
|
||||
7. After opening the project in IntelliJ, run 'gradlew genIntellijRuns' in the command terminal you opened earlier.
|
||||
8. You now have a functional local copy of Chisel, ready to develop on.
|
||||
|
||||
MAKE SURE TO UPDATE YOUR FORK BEFORE MAKING A PULL REQUEST.
|
||||
MAKE SURE TO UPDATE YOUR FORK BEFORE MAKING A PULL REQUEST.
|
||||
@@ -1,26 +1,14 @@
|
||||
package info.jbcs.minecraft.chisel;
|
||||
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
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.*;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent.MissingMapping;
|
||||
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.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.Type;
|
||||
import info.jbcs.minecraft.chisel.block.BlockAutoChisel;
|
||||
import info.jbcs.minecraft.chisel.block.BlockCarvable;
|
||||
import info.jbcs.minecraft.chisel.carving.Carving;
|
||||
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.entity.EntityBallOMoss;
|
||||
import info.jbcs.minecraft.chisel.entity.EntityCloudInABottle;
|
||||
import info.jbcs.minecraft.chisel.entity.EntitySmashingRock;
|
||||
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.item.ItemBallOMoss;
|
||||
@@ -30,15 +18,36 @@ import info.jbcs.minecraft.chisel.item.ItemSmashingRock;
|
||||
import info.jbcs.minecraft.chisel.world.GeneratorLimestone;
|
||||
import info.jbcs.minecraft.chisel.world.GeneratorMarble;
|
||||
import info.jbcs.minecraft.utilities.General;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
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;
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
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.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.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.Type;
|
||||
|
||||
|
||||
@Mod(modid = Chisel.MOD_ID, name = Chisel.MOD_NAME, version = "@MOD_VERSION@", guiFactory = "info.jbcs.minecraft.chisel.client.gui.GuiFactory"/*, dependencies = "after:ForgeMicroblock;"*/)
|
||||
@@ -61,6 +70,8 @@ public class Chisel
|
||||
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 Block autoChisel;
|
||||
|
||||
public static int RenderEldritchId;
|
||||
public static int RenderCTMId;
|
||||
public static int RenderCarpetId;
|
||||
@@ -130,9 +141,15 @@ public class Chisel
|
||||
}
|
||||
};
|
||||
|
||||
chisel = (ItemChisel) new ItemChisel(Carving.chisel).setTextureName("chisel:chisel").setCreativeTab(CreativeTabs.tabTools);
|
||||
chisel = (ItemChisel) new ItemChisel().setTextureName("chisel:chisel").setCreativeTab(CreativeTabs.tabTools);
|
||||
GameRegistry.registerItem(chisel, "chisel");
|
||||
|
||||
if(Configurations.featureEnabled("autoChisel")){
|
||||
autoChisel = new BlockAutoChisel().setBlockTextureName("Chisel:autoChisel").setCreativeTab(CreativeTabs.tabTools);
|
||||
GameRegistry.registerBlock(autoChisel, autoChisel.getUnlocalizedName());
|
||||
proxy.registerTileEntities();
|
||||
}
|
||||
|
||||
if(Configurations.featureEnabled("cloud"))
|
||||
{
|
||||
itemCloudInABottle = (ItemCloudInABottle) new ItemCloudInABottle().setTextureName("Chisel:cloudinabottle").setCreativeTab(CreativeTabs.tabTools);
|
||||
@@ -167,13 +184,31 @@ public class Chisel
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
return new ContainerChisel(player.inventory, new InventoryChiselSelection(null));
|
||||
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);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
return new GuiChisel(player.inventory, new InventoryChiselSelection(null));
|
||||
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);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
package info.jbcs.minecraft.chisel;
|
||||
|
||||
import info.jbcs.minecraft.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class CommonProxy
|
||||
{
|
||||
public void registerTileEntities() {
|
||||
registerTileEntity(TileEntityAutoChisel.class, "autoChisel");
|
||||
}
|
||||
|
||||
private void registerTileEntity(Class<? extends TileEntity> cls, String baseName) {
|
||||
GameRegistry.registerTileEntity(cls, "tile.autoChisel." + baseName);
|
||||
}
|
||||
public void preInit()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ public class Configurations
|
||||
public static boolean chiselStoneToCobbleBricks;
|
||||
public static boolean enableChiseling;
|
||||
public static boolean chiselRecipe;
|
||||
public static boolean autoChisel;
|
||||
|
||||
public static int factoryBlockAmount;
|
||||
public static int particlesTickrate;
|
||||
@@ -38,6 +39,7 @@ public class Configurations
|
||||
marbleAmount = config.get("worldgen", "marbleAmount", 7, "Amount of marble to generate in the world; use 0 for none").getInt(7);
|
||||
limestoneAmount = config.get("worldgen", "limestoneAmount", 8, "Amount of limestone to generate in the world; use 0 for none").getInt(8);
|
||||
chiselRecipe = config.get("general", "chiselAlternateRecipe", false, "Use alternative crafting recipe for the chisel").getBoolean(false);
|
||||
autoChisel = config.get("general", "autoChisel", true, "Should people be allowed to use the auto chisel").getBoolean(false);
|
||||
|
||||
if(config.hasChanged())
|
||||
{
|
||||
|
||||
@@ -1,7 +1,18 @@
|
||||
package info.jbcs.minecraft.chisel.block;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -14,9 +25,58 @@ public class BlockAutoChisel extends BlockContainer
|
||||
setHardness(1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float x1, float y1, float z1){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(world.isRemote)
|
||||
return true;
|
||||
if(tile !=null && tile instanceof TileEntityAutoChisel)
|
||||
player.openGui(Chisel.instance, 1, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
dropItems(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
|
||||
private void dropItems(World world, int x, int y, int z){
|
||||
Random random = new Random();
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
|
||||
if(!(tileEntity instanceof IInventory)){
|
||||
return;
|
||||
}
|
||||
|
||||
IInventory inventory = (IInventory) tileEntity;
|
||||
|
||||
for(int c = 0; c < inventory.getSizeInventory(); c++){
|
||||
ItemStack stack = inventory.getStackInSlot(c);
|
||||
|
||||
if(stack != null && stack.stackSize > 0){
|
||||
float rx = random.nextFloat() * 0.8F + 0.1F;
|
||||
float ry = random.nextFloat() * 0.8F + 0.1F;
|
||||
float rz = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, x + rx, y + ry, z + rz, stack);
|
||||
|
||||
if(stack.hasTagCompound()){
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = random.nextGaussian() * factor;
|
||||
entityItem.motionY = random.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = random.nextGaussian() * factor;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2)
|
||||
{
|
||||
return null;
|
||||
return new TileEntityAutoChisel();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
package info.jbcs.minecraft.chisel.block.tileentity;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityAutoChisel extends TileEntity implements ISidedInventory{
|
||||
|
||||
private ItemStack[] inventory = new ItemStack[3];
|
||||
private String name = "autoChisel";
|
||||
|
||||
@Override
|
||||
public boolean canUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int slot, int size) {
|
||||
if (inventory[slot] != null) {
|
||||
ItemStack is;
|
||||
if (inventory[slot].stackSize <= size) {
|
||||
is = inventory[slot];
|
||||
inventory[slot] = null;
|
||||
return is;
|
||||
} else {
|
||||
is = inventory[slot].splitStack(size);
|
||||
if (inventory[slot].stackSize == 0)
|
||||
inventory[slot] = null;
|
||||
return is;
|
||||
}
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagList tags = nbt.getTagList("Items", 10);
|
||||
inventory = new ItemStack[getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < tags.tagCount(); i++) {
|
||||
NBTTagCompound data = tags.getCompoundTagAt(i);
|
||||
int j = data.getByte("Slot") & 255;
|
||||
|
||||
if (j >= 0 && j < inventory.length) {
|
||||
inventory[j] = ItemStack.loadItemStackFromNBT(data);
|
||||
}
|
||||
}
|
||||
|
||||
if (nbt.hasKey("CustomName", 8))
|
||||
{
|
||||
this.name = nbt.getString("CustomName");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
NBTTagList tags = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < inventory.length; i++) {
|
||||
if (inventory[i] != null) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setByte("Slot", (byte) i);
|
||||
inventory[i].writeToNBT(data);
|
||||
tags.appendTag(data);
|
||||
}
|
||||
}
|
||||
|
||||
nbt.setTag("Items", tags);
|
||||
|
||||
if (this.hasCustomInventoryName())
|
||||
{
|
||||
nbt.setString("CustomName", this.name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory(){
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slot){
|
||||
return inventory[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
if (inventory[slot] != null) {
|
||||
ItemStack is = inventory[slot];
|
||||
inventory[slot] = null;
|
||||
return is;
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int slot, ItemStack stack){
|
||||
inventory[slot] = stack;
|
||||
|
||||
if(stack != null && stack.stackSize > getInventoryStackLimit()){
|
||||
stack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName(){
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isUseableByPlayer(EntityPlayer player){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit(){
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side){
|
||||
int[] slots = new int[getSizeInventory()];
|
||||
|
||||
for(int c = 0; c < slots.length; c++){
|
||||
slots[c] = c;
|
||||
}
|
||||
|
||||
if(side != 0){
|
||||
return slots;
|
||||
} else if(side == 0){
|
||||
return new int[] {2};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemStack){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack itemStack, int side){
|
||||
if(side != 0){
|
||||
if(slot == 0){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if(side == 0){
|
||||
if(slot == 2){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack itemStack, int side){
|
||||
if(side != 0){
|
||||
if(slot == 1){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if(side == 0){
|
||||
if(slot == 2){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory(){}
|
||||
|
||||
@Override
|
||||
public void closeInventory(){
|
||||
NBTTagList tags = new NBTTagList();
|
||||
System.out.print(tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeToNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
readFromNBT(packet.func_148857_g());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package info.jbcs.minecraft.chisel.client.gui;
|
||||
|
||||
import info.jbcs.minecraft.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
import info.jbcs.minecraft.chisel.inventory.ContainerAutoChisel;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiAutoChisel extends GuiContainer {
|
||||
|
||||
private static final ResourceLocation gui = new ResourceLocation("chisel:textures/autochisel-gui.png");
|
||||
|
||||
public GuiAutoChisel(InventoryPlayer inventoryPlayer, TileEntityAutoChisel tileEntityAutoChisel){
|
||||
super(new ContainerAutoChisel(inventoryPlayer, tileEntityAutoChisel));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3){
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.renderEngine.bindTexture(gui);
|
||||
int x = (width - xSize) / 2;
|
||||
int y = (height - ySize) / 2;
|
||||
this.drawTexturedModalRect(x ,y, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package info.jbcs.minecraft.chisel.inventory;
|
||||
|
||||
import info.jbcs.minecraft.chisel.block.tileentity.TileEntityAutoChisel;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerAutoChisel extends Container {
|
||||
|
||||
public static TileEntityAutoChisel autoChisel;
|
||||
public static EntityPlayer player;
|
||||
|
||||
public ContainerAutoChisel(InventoryPlayer player, TileEntityAutoChisel tileEntityAutoChisel){
|
||||
|
||||
this.player = player.player;
|
||||
autoChisel = tileEntityAutoChisel;
|
||||
|
||||
addSlotToContainer(new Slot(tileEntityAutoChisel, 0, 53, 15));
|
||||
addSlotToContainer(new Slot(tileEntityAutoChisel, 1, 103, 15));
|
||||
addSlotToContainer(new Slot(tileEntityAutoChisel, 2, 78, 51));
|
||||
|
||||
bindPlayerInventory(player);
|
||||
}
|
||||
|
||||
protected void bindPlayerInventory(InventoryPlayer invPlayer){
|
||||
for(int row = 0; row < 3; row++){
|
||||
for(int column = 0; column < 9; column++){
|
||||
addSlotToContainer(new Slot(invPlayer, column + row * 9 + 9, 8 + column * 18, 84 + row * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int slotNumber = 0; slotNumber < 9; slotNumber++){
|
||||
addSlotToContainer(new Slot(invPlayer, slotNumber, 8 + slotNumber * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return autoChisel.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
||||
ItemStack stack = null;
|
||||
Slot slotObject = (Slot) inventorySlots.get(slot);
|
||||
|
||||
if(slotObject != null && slotObject.getHasStack()){
|
||||
ItemStack stackInSlot = slotObject.getStack();
|
||||
stack = stackInSlot.copy();
|
||||
|
||||
if(slot < autoChisel.getSizeInventory()){
|
||||
if(!this.mergeItemStack(stackInSlot, 0, 35, true)){
|
||||
return null;
|
||||
}
|
||||
} else if(!this.mergeItemStack(stackInSlot, 0, 3, false)){
|
||||
return null;
|
||||
}
|
||||
|
||||
if(stackInSlot.stackSize == 0){
|
||||
slotObject.putStack(null);
|
||||
} else {
|
||||
slotObject.onSlotChanged();
|
||||
}
|
||||
|
||||
if(stackInSlot.stackSize == stack.stackSize){
|
||||
return null;
|
||||
}
|
||||
|
||||
slotObject.onPickupFromSlot(player, stackInSlot);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -62,8 +62,8 @@ public class ContainerChisel extends Container
|
||||
for(int l = 0; l < 9; l++)
|
||||
{
|
||||
addSlotToContainer(l == currentIndex ?
|
||||
new SlotChiselPlayer(this, inventoryplayer, l, 8 + l * 18, 160 - 18) :
|
||||
new Slot(inventoryplayer, l, 8 + l * 18, 160 - 18)
|
||||
new SlotChiselPlayer(this, inventoryplayer, l, 8 + l * 18, 160 - 18) :
|
||||
new Slot(inventoryplayer, l, 8 + l * 18, 160 - 18)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ItemChisel extends ItemTool implements IChiselMode
|
||||
public static Carving carving = Carving.chisel;
|
||||
private static final HashSet<String> toolSet = new HashSet<String>();
|
||||
|
||||
public ItemChisel(Carving c)
|
||||
public ItemChisel()
|
||||
{
|
||||
super(1, ToolMaterial.IRON, CarvableHelper.getChiselBlockSet());
|
||||
|
||||
@@ -28,7 +28,6 @@ public class ItemChisel extends ItemTool implements IChiselMode
|
||||
setUnlocalizedName("chisel");
|
||||
|
||||
toolSet.add("chisel");
|
||||
//this.carving = c;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 7.2 KiB |
@@ -7,7 +7,7 @@
|
||||
"mcversion": "${mcversion}",
|
||||
"url": "http://www.minecraftforum.net/forums/thread/1294901",
|
||||
"updateUrl": "",
|
||||
"authorList": [ "AUTOMATIC_MAIDEN", "Pokefenn" ],
|
||||
"authorList": [ "AUTOMATIC_MAIDEN", "Pokefenn", "Cricket"],
|
||||
"credits": "This mod uses a lot of textures from the Painterly pack: http://painterlypack.net/. Also one stone variation is designed to look like a block from Doku. Oh, and asie for porting the mod to 1.7.2",
|
||||
"logoFile": "",
|
||||
"screenshots": [],
|
||||
|
||||
Reference in new issue
Block a user