I think everything is working?

This commit is contained in:
kitsushadow
2015-07-07 07:09:37 -04:00
parent b001b20049
commit db43a14b32
63 changed files with 402 additions and 669 deletions

View File

@@ -19,18 +19,8 @@ import com.kitsu.medievalcraft.packethandle.curedLeather.MsgHandleCuredLeatherZ;
import com.kitsu.medievalcraft.packethandle.curedLeather.MsgPacketCuredLeatherX;
import com.kitsu.medievalcraft.packethandle.curedLeather.MsgPacketCuredLeatherY;
import com.kitsu.medievalcraft.packethandle.curedLeather.MsgPacketCuredLeatherZ;
import com.kitsu.medievalcraft.packethandle.forge.MsgHandleBurning;
import com.kitsu.medievalcraft.packethandle.forge.MsgHandleForge;
import com.kitsu.medievalcraft.packethandle.forge.MsgHandleForgeX;
import com.kitsu.medievalcraft.packethandle.forge.MsgHandleForgeY;
import com.kitsu.medievalcraft.packethandle.forge.MsgHandleForgeZ;
import com.kitsu.medievalcraft.packethandle.forge.MsgHandleOn;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketBurning;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForge;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeX;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeY;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeZ;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketOn;
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgHandle;
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgHandleLocX;
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgHandleLocY;
@@ -95,11 +85,7 @@ public class Main {
sNet.registerMessage(MsgHandleCuredLeatherZ.class, MsgPacketCuredLeatherZ.class, 8, Side.SERVER);
sNet.registerMessage(MsgHandleShelfCase.class, MsgPacketShelfCase.class, 9, Side.SERVER);
sNet.registerMessage(MsgHandleForge.class, MsgPacketForge.class, 10, Side.SERVER);
sNet.registerMessage(MsgHandleOn.class, MsgPacketOn.class, 11, Side.CLIENT);
sNet.registerMessage(MsgHandleBurning.class, MsgPacketBurning.class, 12, Side.CLIENT);
sNet.registerMessage(MsgHandleForgeX.class, MsgPacketForgeX.class, 13, Side.CLIENT);
sNet.registerMessage(MsgHandleForgeY.class, MsgPacketForgeY.class, 14, Side.CLIENT);
sNet.registerMessage(MsgHandleForgeZ.class, MsgPacketForgeZ.class, 15, Side.CLIENT);
CustomTab.MedievalTab();
ModBlocks.init();
ModItems.init();

View File

@@ -79,7 +79,7 @@ public class Firebox extends BlockContainer{
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
{
super.randomDisplayTick(world, x, y, z, random);
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
if(world.getBlockMetadata(x, y, z)==1){
int l;
float f;
float f1;
@@ -87,7 +87,7 @@ public class Firebox extends BlockContainer{
for (l = 0; l < 3; ++l)
{
f = (float)(x+0.25) + (rand.nextFloat()/2);
f1 = (float)y + rand.nextFloat() * 0.4F + 0.2F;
f1 = (float)y+0.3f + rand.nextFloat() * 0.4F;
f2 = (float)(z+0.25) + (rand.nextFloat()/2);
world.spawnParticle("fire", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
@@ -100,21 +100,17 @@ public class Firebox extends BlockContainer{
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
TileEntityFirebox tileEnt = (TileEntityFirebox) world.getTileEntity(x, y, z);
//System.out.println("");
if(!world.isRemote){
if(player.inventory.getCurrentItem()!=null){
if((player.inventory.getCurrentItem().getItem()==Item.getItemFromBlock(Blocks.torch))||
(player.inventory.getCurrentItem().getItem()==Items.flint_and_steel)||
(player.inventory.getCurrentItem().getItem()==ModItems.fireBow)
){
tileEnt.isOn=true;
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
player.inventory.getCurrentItem().damageItem(1, player);
if(world.getBlock(x, y, z).equals(Blocks.air)){
world.setBlock(x, y+1, z, Blocks.fire, 0, 2);
}
System.out.println(tileEnt.isOn);
}
}
if(player.inventory.getCurrentItem()!=null){
@@ -156,30 +152,18 @@ public class Firebox extends BlockContainer{
}
return true;
}
//tileEnt.markDirty();
}
tileEnt.markForUpdate();
tileEnt.markDirty();
//System.out.println(player.inventory.getCurrentItem());
return true;
}
/*public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack p_149689_6_) {
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
if(!world.isRemote){
if(player.inventory.getCurrentItem()!= null){
if(player.inventory.getCurrentItem().equals(ModItems.fireBow)||player.inventory.getCurrentItem().equals(Items.flint_and_steel)){
TileEntityFirebox tileEnt = (TileEntityFirebox) world.getTileEntity(x, y, z);
tileEnt.isOn = true;
}
}
}
}*/
world.markBlockForUpdate(x, y, z);
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileEntityFirebox tileEnt = (TileEntityFirebox) world.getTileEntity(x, y, z);

View File

@@ -27,18 +27,12 @@ import net.minecraftforge.common.util.ForgeDirection;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.item.ModItems;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketBurning;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForge;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeX;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeY;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeZ;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketOn;
import com.kitsu.medievalcraft.renderer.RenderId;
import com.kitsu.medievalcraft.tileents.machine.TileForge;
import com.kitsu.medievalcraft.util.CustomTab;
import com.kitsu.medievalcraft.util.TileForgePlaceables;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -46,8 +40,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class Forge extends BlockContainer implements TileForgePlaceables{
private final Random random = new Random();
public static int sideMeta, locX, locY, locZ;
public static boolean furnaceParts, coalParts;
public static int sideMeta;
private int c;
public Forge(String unlocalizedName, Material material) {
@@ -142,7 +135,7 @@ public class Forge extends BlockContainer implements TileForgePlaceables{
}
l=l-2;
world.setBlockMetadataWithNotify(x, y, z, l, 2);
System.out.println(l);
//System.out.println(l);
world.markBlockForUpdate(x, y, z);
}
@@ -162,7 +155,7 @@ public class Forge extends BlockContainer implements TileForgePlaceables{
c = (int)mop.sideHit;
Main.sNet.sendToServer(new MsgPacketForge((int) c));
}
System.out.println(sideMeta + " " + world.getBlockMetadata(x, y, z));
if(!world.isRemote){
if(player.inventory.getCurrentItem()!=null){
if((player.inventory.getCurrentItem().getItem()==Item.getItemFromBlock(Blocks.torch))||
@@ -221,10 +214,9 @@ public class Forge extends BlockContainer implements TileForgePlaceables{
return true;
}
}
if(sideMeta-2 == world.getBlockMetadata(x, y, z)||sideMeta == world.getBlockMetadata(x, y, z)-4||sideMeta == world.getBlockMetadata(x, y, z)-8){
if(sideMeta!=1){
if(player.inventory.getCurrentItem()!=null){
if(tileEnt.getStackInSlot(0)==null){
System.out.println();
if(isItemFuel(player.inventory.getCurrentItem())==true){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);

View File

@@ -23,11 +23,10 @@ import com.kitsu.medievalcraft.renderer.RenderId;
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
import com.kitsu.medievalcraft.util.CustomTab;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ForgeAnvil extends BlockContainer {
public class ForgeAnvil extends BlockContainer{
private final Random random = new Random();
@@ -69,7 +68,56 @@ public class ForgeAnvil extends BlockContainer {
@Override
public boolean onBlockActivated(World world, int x, int y, int z,EntityPlayer player, int metadata, float what, float these, float are) {
FMLNetworkHandler.openGui(player, Main.instance, 2, world, x, y, z);
TileEntityAnvilForge tileEnt = (TileEntityAnvilForge) world.getTileEntity(x, y, z);
if(!world.isRemote){
if(player.inventory.getCurrentItem()!=null){
if (tileEnt.getStackInSlot(0)==null){
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
tileEnt.markForUpdate();
}
if (tileEnt.getStackInSlot(0)!=null){
if(player.inventory.getCurrentItem()!=null){
ItemStack pStack = player.inventory.getCurrentItem().copy();
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
if(tileEnt.getStackInSlot(0).stackSize < 64){
sStackTemp.stackSize++;
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
tileEnt.setInventorySlotContents(0, sStackTemp);
player.inventory.decrStackSize(player.inventory.currentItem, 1);
}
}
}
}
tileEnt.markForUpdate();
return true;
}
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
if(tileEnt.getStackInSlot(0)!=null){
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
tileEnt.setInventorySlotContents(0, null);
}
tileEnt.markForUpdate();
return true;
}
if (!player.isSneaking()){
if((player.inventory.getCurrentItem()==null)){
if(tileEnt.getStackInSlot(0)!=null){
ItemStack pStack = tileEnt.getStackInSlot(0).copy();
pStack.stackSize = 1;
world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, pStack));
tileEnt.setInventorySlotContents(0, null);
tileEnt.markForUpdate();
}
}
tileEnt.markForUpdate();
return true;
}
}
tileEnt.markForUpdate();
tileEnt.markDirty();
return true;
}
@@ -81,13 +129,6 @@ public class ForgeAnvil extends BlockContainer {
return Item.getItemFromBlock(ModBlocks.forgeAnvil);
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random random)
{
super.randomDisplayTick(world, x, y, z, random);
}
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
TileEntityAnvilForge tileEnt = (TileEntityAnvilForge) world.getTileEntity(x, y, z);
@@ -122,7 +163,6 @@ public class ForgeAnvil extends BlockContainer {
}
}
}
world.func_147453_f(x, y, z, block);
}
super.breakBlock(world, x, y, z, block, meta);
@@ -150,6 +190,8 @@ public class ForgeAnvil extends BlockContainer {
//System.out.println(dir);
}
}

View File

@@ -11,74 +11,51 @@ import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox;
import com.kitsu.medievalcraft.tileents.machine.TileEntityShelfFour;
public class ContainerFirebox extends Container {
protected TileEntityFirebox tileEnt;
@Override
public boolean canInteractWith(EntityPlayer player) {
return tileEnt.isUseableByPlayer(player);
}
public ContainerFirebox (InventoryPlayer inventoryPlayer, TileEntityFirebox te){
tileEnt = te;
@Override
public boolean canInteractWith(EntityPlayer player) {
return tileEnt.isUseableByPlayer(player);
}
//the Slot constructor takes the IInventory and the slot number in that it binds to
//and the x-y coordinates it resides on-screen
/* for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
addSlotToContainer(new Slot(tileEnt, j + i * 3, 62 + j * 18, 17 + i * 18));
}
}*/
addSlotToContainer(new Slot(tileEnt, 0, 80, 34));
public ContainerFirebox (InventoryPlayer inventoryPlayer, TileEntityFirebox te){
tileEnt = te;
addSlotToContainer(new Slot(tileEnt, 0, 80, 34));
bindPlayerInventory(inventoryPlayer);
}
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
8 + j * 18, 84 + i * 18));
}
}
for (int i = 0; i < 9; i++) {
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
}
}
//commonly used vanilla code that adds the player's inventory
bindPlayerInventory(inventoryPlayer);
}
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
8 + j * 18, 84 + i * 18));
}
}
for (int i = 0; i < 9; i++) {
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
}
}
@Override
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
ItemStack stack = null;
Slot slotObject = (Slot) inventorySlots.get(slot);
//null checks and checks if the item can be stacked (maxStackSize > 1)
if (slotObject != null && slotObject.getHasStack()) {
ItemStack stackInSlot = slotObject.getStack();
stack = stackInSlot.copy();
//merges the item into player inventory since its in the tileEntity
if (slot < 9) {
if (!this.mergeItemStack(stackInSlot, 9, this.inventorySlots.size(), true)) {
return null;
}
}
//places it into the tileEntity is possible since its in the player inventory
else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) {
return null;
}
if (stackInSlot.stackSize == 0) {
slotObject.putStack((ItemStack)null);
} else {
slotObject.onSlotChanged();
}
/*if (stackInSlot.stackSize == stack.stackSize) {
return null;
}*/
//slotObject.onPickupFromSlot(player, stackInSlot);
}
return stack;
}

View File

@@ -7,89 +7,56 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
import com.kitsu.medievalcraft.tileents.machine.TileEntityFirebox;
public class ContainerForgeAnvil extends Container {
protected TileEntityAnvilForge tileEnt;
@Override
public boolean canInteractWith(EntityPlayer player) {
return tileEnt.isUseableByPlayer(player);
}
public ContainerForgeAnvil (InventoryPlayer inventoryPlayer, TileEntityAnvilForge te){
tileEnt = te;
@Override
public boolean canInteractWith(EntityPlayer player) {
return tileEnt.isUseableByPlayer(player);
}
//the Slot constructor takes the IInventory and the slot number in that it binds to
//and the x-y coordinates it resides on-screen
/*for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
addSlotToContainer(new Slot(tileEnt, j + i * 3, 62 + j * 18, 17 + i * 18));
}
}*/
addSlotToContainer(new Slot(tileEnt, 0, 80, 34));
public ContainerForgeAnvil (InventoryPlayer inventoryPlayer, TileEntityAnvilForge te){
tileEnt = te;
addSlotToContainer(new Slot(tileEnt, 0, 80, 34));
bindPlayerInventory(inventoryPlayer);
}
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
8 + j * 18, 84 + i * 18));
}
}
for (int i = 0; i < 9; i++) {
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
}
}
//commonly used vanilla code that adds the player's inventory
bindPlayerInventory(inventoryPlayer);
}
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9,
8 + j * 18, 84 + i * 18));
}
}
for (int i = 0; i < 9; i++) {
addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
}
}
@Override
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
ItemStack stack = null;
Slot slotObject = (Slot) inventorySlots.get(slot);
//null checks and checks if the item can be stacked (maxStackSize > 1)
if (slotObject != null && slotObject.getHasStack()) {
ItemStack stackInSlot = slotObject.getStack();
stack = stackInSlot.copy();
//merges the item into player inventory since its in the tileEntity
if (slot < 9) {
if (!this.mergeItemStack(stackInSlot, 9, this.inventorySlots.size(), true)) {
return null;
}
}
//places it into the tileEntity is possible since its in the player inventory
else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) {
return null;
}
if (stackInSlot.stackSize == 0) {
slotObject.putStack((ItemStack)null);
} else {
slotObject.onSlotChanged();
}
/*if (stackInSlot.stackSize == stack.stackSize) {
return null;
}*/
//slotObject.onPickupFromSlot(player, stackInSlot);
}
return stack;
}
}
}

View File

@@ -184,7 +184,6 @@ public final class ModCrafting {
'x', ModBlocks.ironPlate,
'i', Blocks.iron_bars,
'y', ModItems.charcoalFilter});
GameRegistry.addRecipe(new ItemStack(ModItems.itemSmallBarrelLid), new Object[]
{"ixi", "xxx", "ixi",
'x', ModItems.halfSplitBoard,
@@ -197,7 +196,6 @@ public final class ModCrafting {
{"x x", "x x", "xxx",
'x', Items.brick});
//-----------------------LEATHER STUFF-----------------------//
//GameRegistry.addRecipe(new ItemStack(ModItems.rawCuredLeather), new Object[]{"x", "z", 'x', Items.leather, 'z', ModItems.salt});
@@ -218,26 +216,42 @@ public final class ModCrafting {
GameRegistry.addRecipe(longbow0, new Object[]{"ya", 'y', ModItems.unstrungLongbow, 'a', Items.string});
//-----------------------CRUCIBLE STUFF-----------------------//
/*//GameRegistry.addRecipe(new ItemStack(ModItems.crucibleLid), new Object[]{"x", "y", 'x', Items.clay_ball, 'y', Blocks.stone_slab});
//GameRegistry.addRecipe(new ItemStack(ModItems.crucibleLid), new Object[]{"x", "y", 'x', Items.clay_ball, 'y', Blocks.stone_slab});
GameRegistry.addRecipe(new ItemStack(ModBlocks.emptySoftCrucible), new Object[]{"y y", "y y", "yyy", 'y', Items.clay_ball});
GameRegistry.addRecipe(new ItemStack(ModBlocks.filledCrucibleIron), new Object[]{" x ", "abc", " y ", 'x', Blocks.stone_slab, 'y', ModBlocks.emptyCookedCrucible,
'a', Blocks.sand, 'b', Blocks.iron_ore, 'c', new ItemStack(Items.coal,0,1)});
GameRegistry.addRecipe(new ItemStack(ModBlocks.filledCrucibleIronIngot), new Object[]{" x ", "abc", " y ", 'x', Blocks.stone_slab, 'y', ModBlocks.emptyCookedCrucible,
'a', Blocks.sand, 'b', Items.iron_ingot, 'c', new ItemStack(Items.coal,0,1)});
GameRegistry.addRecipe(new ItemStack(ModItems.charcoalLeafPellet), new Object[]{"xxx", "xyx", "xxx", 'x', new ItemStack(Blocks.leaves,0,3), 'y', new ItemStack(Items.coal,0,1)});
GameRegistry.addRecipe(new ItemStack(ModBlocks.filledCrucibleDamascus), new Object[]{" x ", "abc", " y ", 'x', Blocks.stone_slab, 'y', ModBlocks.emptyCookedCrucible,
'a', Blocks.sand, 'b', ModBlocks.wootzOre, 'c', ModItems.charcoalLeafPellet});
GameRegistry.addRecipe(new ItemStack(ModBlocks.filledLapisCrucible),
GameRegistry.addRecipe(new ItemStack(ModBlocks.crucibleIronOre),
new Object[]{" x ", "abc", " y ",
'x', Blocks.stone_slab,
'y', ModBlocks.emptyCookedCrucible,
'a', Blocks.sand,
'b', Blocks.iron_ore,
'c', new ItemStack(Items.coal,0,1)});
GameRegistry.addRecipe(new ItemStack(ModBlocks.crucibleIronIngot),
new Object[]{" x ", "abc"," y ",
'x', Blocks.stone_slab,
'y', ModBlocks.emptyCookedCrucible,
'a', Blocks.sand,
'b', Items.iron_ingot,
'c', new ItemStack(Items.coal,0,1)});
GameRegistry.addRecipe(new ItemStack(ModBlocks.crucibleWootz),
new Object[]{" x ", "abc", " y ",
'x', Blocks.stone_slab,
'y', ModBlocks.emptyCookedCrucible,
'a', Blocks.sand,
'b', ModBlocks.wootzOre,
'c', ModItems.charcoalLeafPellet});
GameRegistry.addRecipe(new ItemStack(ModBlocks.crucibleLapis),
new Object[]{" x ", "abb", " y ",
'x', Blocks.stone_slab,
'a', Blocks.sand, 'b', Blocks.lapis_block,
'y', ModBlocks.emptyCookedCrucible});
GameRegistry.addRecipe(new ItemStack(ModBlocks.filledRedstoneCrucible),
GameRegistry.addRecipe(new ItemStack(ModBlocks.crucibleRedstone),
new Object[]{" x ", "abb", " y ",
'x', Blocks.stone_slab,
'a', Blocks.sand, 'b', Blocks.redstone_block,
'y', ModBlocks.emptyCookedCrucible});
*/
//-----------------------WEAPONS-----------------------//
GameRegistry.addRecipe(new ShapedOreRecipe((ModItems.longSword), new Object[]{"b", "a", Character.valueOf('a'), "strapLeather", 'b', ModItems.ironlongswordBlade}));
GameRegistry.addRecipe(new ShapedOreRecipe((ModItems.heavyMace), new Object[]{" a ", "aba", " c ", 'a', ModItems.ironsharpTip, 'b', ModItems.ironmaceHead, 'c', ModItems.ironweaponHandle}));

View File

@@ -1,16 +0,0 @@
package com.kitsu.medievalcraft.packethandle.forge;
import com.kitsu.medievalcraft.block.machines.Forge;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class MsgHandleBurning implements IMessageHandler<MsgPacketBurning, IMessage>{
@Override
public IMessage onMessage(MsgPacketBurning message, MessageContext ctx) {
Forge.coalParts = message.packetOn;
return null;
}
}

View File

@@ -1,25 +0,0 @@
package com.kitsu.medievalcraft.packethandle.forge;
import com.kitsu.medievalcraft.block.ingots.IngotBase;
import com.kitsu.medievalcraft.block.machines.Forge;
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacketLocX;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class MsgHandleForgeX implements IMessageHandler<MsgPacketForgeX, IMessage>{
@Override
public IMessage onMessage(MsgPacketForgeX message, MessageContext ctx) {
//IngotBase.locX = message.locx;
Forge.locX = message.locx;
//ItemRendererLongbow.tick = message.lTick;
//System.out.println(message.lTick);
//ctx.getClientHandler().addToSendQueue(new MsgPacket(message.useme));
return null;
}
}

View File

@@ -1,23 +0,0 @@
package com.kitsu.medievalcraft.packethandle.forge;
import com.kitsu.medievalcraft.block.machines.Forge;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class MsgHandleForgeY implements IMessageHandler<MsgPacketForgeY, IMessage>{
@Override
public IMessage onMessage(MsgPacketForgeY message, MessageContext ctx) {
//IngotBase.locX = message.locx;
Forge.locY = message.locy;
//ItemRendererLongbow.tick = message.lTick;
//System.out.println(message.lTick);
//ctx.getClientHandler().addToSendQueue(new MsgPacket(message.useme));
return null;
}
}

View File

@@ -1,23 +0,0 @@
package com.kitsu.medievalcraft.packethandle.forge;
import com.kitsu.medievalcraft.block.machines.Forge;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class MsgHandleForgeZ implements IMessageHandler<MsgPacketForgeZ, IMessage>{
@Override
public IMessage onMessage(MsgPacketForgeZ message, MessageContext ctx) {
//IngotBase.locX = message.locx;
Forge.locZ = message.locz;
//ItemRendererLongbow.tick = message.lTick;
//System.out.println(message.lTick);
//ctx.getClientHandler().addToSendQueue(new MsgPacket(message.useme));
return null;
}
}

View File

@@ -1,16 +0,0 @@
package com.kitsu.medievalcraft.packethandle.forge;
import com.kitsu.medievalcraft.block.machines.Forge;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
public class MsgHandleOn implements IMessageHandler<MsgPacketOn, IMessage>{
@Override
public IMessage onMessage(MsgPacketOn message, MessageContext ctx) {
Forge.furnaceParts = message.packetOn;
return null;
}
}

View File

@@ -1,26 +0,0 @@
package com.kitsu.medievalcraft.packethandle.forge;
import io.netty.buffer.ByteBuf;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
public class MsgPacketBurning implements IMessage {
public boolean packetOn;
public MsgPacketBurning() {}
public MsgPacketBurning(boolean x){
this.packetOn = x;
}
@Override
public void fromBytes(ByteBuf buf) {
this.packetOn = buf.readBoolean();
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeBoolean(this.packetOn);
}
}

View File

@@ -1,28 +0,0 @@
package com.kitsu.medievalcraft.packethandle.forge;
import io.netty.buffer.ByteBuf;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
public class MsgPacketForgeX implements IMessage {
public int locx;
public MsgPacketForgeX() {}
public MsgPacketForgeX(int x){
this.locx = x;
}
@Override
public void fromBytes(ByteBuf buf) {
this.locx = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(this.locx);
}
}

View File

@@ -1,28 +0,0 @@
package com.kitsu.medievalcraft.packethandle.forge;
import io.netty.buffer.ByteBuf;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
public class MsgPacketForgeY implements IMessage {
public int locy;
public MsgPacketForgeY() {}
public MsgPacketForgeY(int y){
this.locy = y;
}
@Override
public void fromBytes(ByteBuf buf) {
this.locy = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(this.locy);
}
}

View File

@@ -1,28 +0,0 @@
package com.kitsu.medievalcraft.packethandle.forge;
import io.netty.buffer.ByteBuf;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
public class MsgPacketForgeZ implements IMessage {
public int locz;
public MsgPacketForgeZ() {}
public MsgPacketForgeZ(int z){
this.locz = z;
}
@Override
public void fromBytes(ByteBuf buf) {
this.locz = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(this.locz);
}
}

View File

@@ -1,26 +0,0 @@
package com.kitsu.medievalcraft.packethandle.forge;
import io.netty.buffer.ByteBuf;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
public class MsgPacketOn implements IMessage {
public boolean packetOn;
public MsgPacketOn() {}
public MsgPacketOn(boolean x){
this.packetOn = x;
}
@Override
public void fromBytes(ByteBuf buf) {
this.packetOn = buf.readBoolean();
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeBoolean(this.packetOn);
}
}

View File

@@ -45,8 +45,9 @@ public class FireboxRenderer extends TileEntitySpecialRenderer {
this.entItem.hoverStart = 0.0F;
RenderItem.renderInFrame = true;
GL11.glScalef(1.0f, 1.0f, 1.0f);
//GL11.glRotatef(90, 0, 1, 0);
RenderManager.instance.renderEntityWithPosYaw(entItem, 0.5D, 0.3D, 0.5D, 0.0F, 0.0F);
GL11.glRotatef(90, 0, 1, 0);
RenderManager.instance.renderEntityWithPosYaw(entItem, -0.5D, 0.3D, 0.5D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
GL11.glPopMatrix();
}
@@ -60,10 +61,6 @@ public class FireboxRenderer extends TileEntitySpecialRenderer {
@SuppressWarnings({ "cast"})
public void renderBlock(TileEntityFirebox tl, World world, int i, int j,int k, Block block) {
Tessellator tessellator = Tessellator.instance;
// This will make your block brightness dependent from surroundings
// lighting.
int dir = world.getBlockMetadata(i, j, k);
GL11.glPushMatrix();

View File

@@ -33,6 +33,11 @@ public class ForgeAnvilRenderer extends TileEntitySpecialRenderer {
TileEntityAnvilForge tileEntity = (TileEntityAnvilForge)tile;
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y, (float) z);
if(tileEntity.getStackInSlot(0)==null){
entItem=null;
}
if(tileEntity.getStackInSlot(0)!=null){
entItem = new EntityItem(tileEntity.getWorldObj(), x, y, z, tileEntity.getStackInSlot(0));
GL11.glPushMatrix();
@@ -43,8 +48,12 @@ public class ForgeAnvilRenderer extends TileEntitySpecialRenderer {
RenderItem.renderInFrame = false;
GL11.glPopMatrix();
tileEntity.markForUpdate();
tileEntity.markDirty();
}
renderBlock(tileEntity, tile.getWorldObj(), tile.xCoord,tile.yCoord, tile.zCoord, ModBlocks.forgeAnvil);
tileEntity.markForUpdate();
tileEntity.markDirty();
GL11.glPopMatrix();
}

View File

@@ -74,9 +74,11 @@ public class ForgeRenderer extends TileEntitySpecialRenderer {
GL11.glPushMatrix();
this.entItem.hoverStart = 0.0F;
RenderItem.renderInFrame = true;
GL11.glScalef(1.0f, 1.0f, 1.0f);
//GL11.glRotatef(10, 0, 1, 0);
RenderManager.instance.renderEntityWithPosYaw(entItem, 0.55D, 0.25D, 0.5D, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
GL11.glPopMatrix();
tileEntity.markForUpdate();

View File

@@ -23,10 +23,8 @@ public class TileEntityBoilingWaterCrucible extends TileEntity {
this.boilingWaterCrucibleName = string;
}
private void heat(World world, int x, int y, int z){
Block ironbar = this.worldObj.getBlock(x, y - 1, z);
Block fire = this.worldObj.getBlock(x, y-2, z);
if(!world.isRemote){
if((ironbar == Blocks.iron_bars) && (fire == Blocks.fire)){
if(world.getBlock(x, y-1, z).equals(ModBlocks.firebox)&&world.getBlockMetadata(x, y-1, z)==1){
cticks = 0;
if((dotan==true)){
bticks++;
@@ -49,16 +47,14 @@ public class TileEntityBoilingWaterCrucible extends TileEntity {
Block fire = this.worldObj.getBlock(x, y-2, z);
Block ironbar = this.worldObj.getBlock(x, y - 1, z);
if(!world.isRemote){
if((fire != Blocks.fire)&&(ironbar == Blocks.iron_bars)){
if(world.getBlock(x, y-1, z)!=(ModBlocks.firebox)||world.getBlock(x, y-1, z)!=(Blocks.fire)){
cticks++;
//System.out.println(tagCompound.getInteger("CTICKS"));
if(cticks >= 500 + world.rand.nextInt(50)){
world.setBlock(x, y, z, ModBlocks.filledWaterCrucible, 0, 2);
}
}
if((fire != Blocks.fire)&&(ironbar != Blocks.iron_bars)){
if(world.getBlock(x, y-1, z)==(ModBlocks.firebox)&&world.getBlockMetadata(x, y, z)==0){
cticks++;
//System.out.println(tagCompound.getInteger("CTICKS"));
if(cticks >= 500 + world.rand.nextInt(50)){
world.setBlock(x, y, z, ModBlocks.filledWaterCrucible, 0, 2);
}

View File

@@ -14,62 +14,12 @@ import net.minecraft.world.World;
public class TileEntityFilledWaterCrucible extends TileEntity {
private String filledWaterCrucibleName;
private int cticks;
NBTTagCompound nbt = new NBTTagCompound();
public int cookTime = 450;
public int coolTime = 500;
public Block cookBlock = ModBlocks.boilingWaterCrucible;
public void forgeName(String string){
this.filledWaterCrucibleName = string;
}
private void heat(World world, int x, int y, int z){
Block testBlock = this.worldObj.getBlock(x, y - 1, z);
Block fire = this.worldObj.getBlock(x, y-2, z);
public TileEntityFilledWaterCrucible() {
if((!world.isRemote) && (testBlock == Blocks.iron_bars) && (fire == Blocks.fire)){
cticks++;
if(cticks >= 500 + world.rand.nextInt(50)){
world.setBlock(x, y, z, ModBlocks.boilingWaterCrucible, 0, 2);
//System.out.println("Boiled");
}
}
}
@Override
public void readFromNBT(NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
this.cticks = tagCompound.getInteger("CTICKS");
if (tagCompound.hasKey("CustomName", 8)) {
this.filledWaterCrucibleName = tagCompound.getString("CustomName");
}
}
@Override
public void writeToNBT(NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound);
tagCompound.setInteger("CTICKS", cticks);
}
@Override
public void updateEntity() {
World world = this.getWorldObj();
int x = this.xCoord;
int y = this.yCoord;
int z = this.zCoord;
if(!world.isRemote){
heat(world, x, y, z);
}
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbt = new NBTTagCompound();
writeToNBT(nbt);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -998, nbt);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}

View File

@@ -1,10 +1,15 @@
package com.kitsu.medievalcraft.tileents.crucible.empty;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import com.kitsu.medievalcraft.block.ModBlocks;
public class TileEntitySoftEmptyCrucible extends TileEntity {
private String emptyCrucibleName;
public int cookTime = 250;
public Block cookBlock = ModBlocks.emptyCookedCrucible;
public void emptyCrucibleName(String string){
this.emptyCrucibleName = string;

View File

@@ -12,21 +12,23 @@ import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
import com.kitsu.medievalcraft.util.AnvilUtil;
public class TileIngotBase extends TileEntity implements AnvilUtil{
private String specName;
public int hits = 0;
protected int heatBase = 300;
public int coolTicks = 250;
public int heatTicks = 100;
public int heatTicks = 300;
protected int coolBase = 250;
public boolean hot;
public TileIngotBase(String name){
specName = name;
}
public void markForUpdate(){
worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
@Override
public void updateEntity() {
World world = this.getWorldObj();
@@ -34,10 +36,11 @@ public class TileIngotBase extends TileEntity implements AnvilUtil{
int y = this.yCoord;
int z = this.zCoord;
if(!world.isRemote){
System.out.println(this.heatTicks);
if(this.heatTicks<=0){
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
this.hot=true;
this.heatTicks=100;
//this.heatTicks=100;
}
if(this.coolTicks<=0){
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
@@ -47,30 +50,33 @@ public class TileIngotBase extends TileEntity implements AnvilUtil{
}
}
private void coolDown(World world, int x, int y, int z){
if(!world.isRemote){
if((world.getBlock(x, y-1, z)!=ModBlocks.forge)&&(this.hot==true)){
coolTicks--;
if(coolTicks <= 0){
this.hot=false;
this.coolTicks=100;
this.heatTicks=100;
this.markForUpdate();
this.markDirty();
if(this.hot==true){
if(world.getBlockMetadata(x, y-1, z)<8){
coolTicks--;
if(coolTicks <= 0){
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
this.hot=false;
this.coolTicks=coolBase;
this.heatTicks=heatBase;
this.markForUpdate();
this.markDirty();
}
}
}
}
}
/*
private void makeItem(World world, int x, int y, int z){
if(this.hits==0 && this.hot==true && world.getBlock(x, y-1, z).equals(ModBlocks.forgeAnvil)){
TileEntityAnvilForge tile = (TileEntityAnvilForge) world.getTileEntity(x, y-1, z);
if(tile.getStackInSlot(0)!=null){
System.out.println(forms.get(tile.getStackInSlot(0).getItem().getUnlocalizedName()));
if(tile.getStackInSlot(0).equals(forms.get(tile.getStackInSlot(0).getItem().getUnlocalizedName()))){
System.out.println("Logic is Working");
@@ -78,8 +84,8 @@ public class TileIngotBase extends TileEntity implements AnvilUtil{
}
}
}
*/
*/
@Override
public void readFromNBT(NBTTagCompound tagCompound)
{

View File

@@ -8,8 +8,9 @@ public class TileMyIronIngot extends TileIngotBase{
super(nameCustom);
this.hits = 0;
this.hot = false;
this.heatTicks = 300;
this.heatBase = 50;
this.heatTicks = 50;
this.coolBase = 50;
}
}

View File

@@ -1,52 +1,104 @@
package com.kitsu.medievalcraft.tileents.machine;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.block.crucible.CrucibleBase;
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleBase;
import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntityFilledWaterCrucible;
import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntitySoftEmptyCrucible;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFurnace;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
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;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.world.World;
public class TileEntityAnvilForge extends TileEntity implements IInventory {
public class TileEntityAnvilForge extends TileEntity implements IInventory{
private String forgeAnvilName;
public ItemStack[] inv;
NBTTagCompound tag = new NBTTagCompound();
private String anvilName;
private ItemStack[] inv;
private NBTTagCompound tag = new NBTTagCompound();
private int ticks;
public boolean isOn;
public TileEntityAnvilForge(){
inv = new ItemStack[1];
}
public void forgeName(String string){
this.forgeAnvilName = string;
this.inv = new ItemStack[1];
}
@Override
public int getSizeInventory() {
return inv.length;
return this.inv.length;
}
@Override
public ItemStack getStackInSlot(int slot) {
return inv[slot];
return this.inv[slot];
}
@Override
public ItemStack getStackInSlotOnClosing(int p_70304_1_)
public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_)
{
if (this.inv[p_70304_1_] != null)
if (this.inv[p_70298_1_] != null)
{
ItemStack itemstack = this.inv[p_70304_1_];
this.inv[p_70304_1_] = null;
ItemStack itemstack;
if (this.inv[p_70298_1_].stackSize <= p_70298_2_)
{
itemstack = this.inv[p_70298_1_];
this.inv[p_70298_1_] = null;
this.markForUpdate();
this.markDirty();
return itemstack;
}
itemstack = this.inv[p_70298_1_].splitStack(p_70298_2_);
if (this.inv[p_70298_1_].stackSize == 0)
{
this.inv[p_70298_1_] = null;
}
this.markForUpdate();
this.markDirty();
return itemstack;
}
this.markForUpdate();
this.markDirty();
return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int i)
{
if (this.inv[i] != null)
{
ItemStack itemstack = this.inv[i];
this.inv[i] = null;
this.markForUpdate();
this.markDirty();
return itemstack;
}
else
{
this.markForUpdate();
this.markDirty();
return null;
}
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack)
{
@@ -62,44 +114,54 @@ public class TileEntityAnvilForge extends TileEntity implements IInventory {
@Override
public String getInventoryName() {
return this.hasCustomInventoryName() ? this.forgeAnvilName : "Forge";
return this.hasCustomInventoryName() ? this.anvilName : "anvilName";
}
@Override
public boolean hasCustomInventoryName() {
return this.forgeAnvilName != null && this.forgeAnvilName.length() > 0;
return this.anvilName != null && this.anvilName.length() > 0;
}
@Override
public int getInventoryStackLimit() {
return 1;
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : player.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D;
}
@Override
public boolean isItemValidForSlot(int par1, ItemStack itemstack) {
public void openInventory() {}
@Override
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int par1, ItemStack itemstack) {
return false;
}
public void markForUpdate(){
worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
}
@Override
public void readFromNBT(NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
NBTTagList tagList = tagCompound.getTagList("Inventory", 10);
this.inv = new ItemStack[this.getSizeInventory()];
for (int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound tag = tagList.getCompoundTagAt(i);
byte slot = tag.getByte("Slot");
if (slot >= 0 && slot < inv.length) {
inv[slot] = ItemStack.loadItemStackFromNBT(tag);
if (slot >= 0 && slot < this.inv.length) {
this.inv[slot] = ItemStack.loadItemStackFromNBT(tag);
}
}
if (tagCompound.hasKey("CustomName", 8)) {
this.forgeAnvilName = tagCompound.getString("CustomName");
this.anvilName = tagCompound.getString("CustomName");
}
}
@Override
@@ -108,59 +170,22 @@ public class TileEntityAnvilForge extends TileEntity implements IInventory {
NBTTagList itemList = new NBTTagList();
for (int i = 0; i < inv.length; i++) {
ItemStack stack = inv[i];
if (stack != null) {
//ItemStack stack = inv[i];
if (inv[i] != null) {
NBTTagCompound tag = new NBTTagCompound();
tag.setByte("Slot", (byte) i);
stack.writeToNBT(tag);
this.inv[i].writeToNBT(tag);
itemList.appendTag(tag);
}
}
tagCompound.setTag("Inventory", itemList);
}
@Override
public void openInventory() {}
@Override
public void closeInventory() {}
/**
* Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a
* new stack.
*/
@Override
public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_)
{
if (this.inv[p_70298_1_] != null)
{
ItemStack itemstack;
if (this.inv[p_70298_1_].stackSize <= p_70298_2_)
{
itemstack = this.inv[p_70298_1_];
this.inv[p_70298_1_] = null;
return itemstack;
}
itemstack = this.inv[p_70298_1_].splitStack(p_70298_2_);
if (this.inv[p_70298_1_].stackSize == 0)
{
this.inv[p_70298_1_] = null;
}
this.markForUpdate();
return itemstack;
}
this.markForUpdate();
return null;
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -998, tag);
this.writeToNBT(tag);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 998, tag);
}
@Override
@@ -168,12 +193,26 @@ public class TileEntityAnvilForge extends TileEntity implements IInventory {
readFromNBT(pkt.func_148857_g());
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
public void markForUpdate(){
worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
@Override
public void updateEntity() {
World world = getWorldObj();
int x = this.xCoord;
int y = this.yCoord;
int z = this.zCoord;
if(!world.isRemote){
}
if (worldObj.isRemote) return;
}
}

View File

@@ -24,9 +24,9 @@ import net.minecraft.world.World;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.block.crucible.CrucibleBase;
import com.kitsu.medievalcraft.block.ingots.IngotBase;
import com.kitsu.medievalcraft.tileents.crucible.TileCrucibleBase;
import com.kitsu.medievalcraft.tileents.ingots.TileIngotBase;
import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntityFilledWaterCrucible;
import com.kitsu.medievalcraft.tileents.crucible.empty.TileEntitySoftEmptyCrucible;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -212,25 +212,24 @@ public class TileEntityFirebox extends TileEntity implements IInventory{
fireboxFuelDec(world, x, y, z, this.getStackInSlot(0), this.ticks);
isFurnace(world, x, y, z);
isCrucible(world, x, y, z);
isIngot(world, x, y, z);
//isIngot(world, x, y, z);
}
if (worldObj.isRemote) return;
}
private void fireboxMaint(World world, int x, int y, int z){
if(world.getBlock(x, y+1, z).equals(Blocks.air)||this.getStackInSlot(0)==null){
this.isOn = false;
}
if((this.getStackInSlot(0)==null)&&(world.getBlock(x, y+1, z).equals(Blocks.fire))){
if(world.getBlockMetadata(x, y, z)==0&&world.getBlock(x, y+1, z).equals(Blocks.fire)){
world.setBlock(x, y+1, z, Blocks.air, 0, 2);
this.isOn=false;
}
if(this.isOn==true && world.getBlock(x, y+1, z).equals(Blocks.air)){
if((this.getStackInSlot(0)==null)){
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
}
if(world.getBlockMetadata(x, y, z)==1 && world.getBlock(x, y+1, z).equals(Blocks.air)){
world.setBlock(x, y+1, z, Blocks.fire, 0, 2);
}
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
this.isOn = true;
}
/*if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
}*/
}
private void fireboxFuelDec(World world, int x, int y, int z, ItemStack stack, int time){
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
@@ -332,7 +331,7 @@ public class TileEntityFirebox extends TileEntity implements IInventory{
public void isCrucible(World world, int x, int y, int z){
if(world.getBlock(x, y+1, z) instanceof CrucibleBase){
TileCrucibleBase tile = (TileCrucibleBase) world.getTileEntity(x, y+1, z);
if(tile.hot == false && tile.cooked == false && this.isOn == true){
if(tile.hot == false && tile.cooked == false && world.getBlockMetadata(x, y, z)==1){
tile.heatTicks--;
if(tile.heatTicks<=0){
tile.hot=true;
@@ -341,21 +340,27 @@ public class TileEntityFirebox extends TileEntity implements IInventory{
}
}
}
}
public void isIngot(World world, int x, int y, int z){
if(world.getBlock(x, y+1, z) instanceof IngotBase){
TileIngotBase tile = (TileIngotBase) world.getTileEntity(x, y+1, z);
if(tile.hot == false && this.isOn == true){
tile.heatTicks--;
if(tile.heatTicks<=0){
tile.hot=true;
tile.markForUpdate();
tile.markDirty();
if(world.getBlock(x, y+1, z).equals(ModBlocks.emptySoftCrucible)){
TileEntitySoftEmptyCrucible tile = (TileEntitySoftEmptyCrucible) world.getTileEntity(x, y+1, z);
if(world.getBlockMetadata(x, y, z)==1){
tile.cookTime--;
if(tile.cookTime<=0){
world.setBlock(x, y+1, z, tile.cookBlock, 0, 2);
}
}
}
if(world.getBlock(x, y+1, z).equals(ModBlocks.filledWaterCrucible)){
TileEntityFilledWaterCrucible tile = (TileEntityFilledWaterCrucible) world.getTileEntity(x, y+1, z);
if(world.getBlockMetadata(x, y, z)==1){
tile.cookTime--;
if(tile.cookTime<=0){
world.setBlock(x, y+1, z, tile.cookBlock, 0, 2);
}
}
}
}
}

View File

@@ -22,13 +22,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.kitsu.medievalcraft.Main;
import com.kitsu.medievalcraft.block.ingots.IngotBase;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketBurning;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeX;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeY;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketForgeZ;
import com.kitsu.medievalcraft.packethandle.forge.MsgPacketOn;
import com.kitsu.medievalcraft.tileents.ingots.TileIngotBase;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -221,6 +215,7 @@ public class TileForge extends TileEntity implements IInventory{
heatIngot(world, x, y, z);
fireboxFuelDec(world, x, y, z,this.getStackInSlot(0), this.ticks);
fireboxFuelDec2(world, x, y, z,this.getStackInSlot(1), this.ticks);
//System.out.println(world.getBlockMetadata(x, y, z));
}
if (worldObj.isRemote) return;
@@ -230,7 +225,7 @@ public class TileForge extends TileEntity implements IInventory{
if(!world.isRemote){
if(world.getBlock(x, y+1, z) instanceof IngotBase){
TileIngotBase tile = (TileIngotBase) world.getTileEntity(x, y+1, z);
if(this.isOn==true){
if(world.getBlockMetadata(x, y, z)>7){
if(tile.hot==false){
tile.heatTicks--;
}
@@ -240,7 +235,7 @@ public class TileForge extends TileEntity implements IInventory{
}
private void fireboxFuelDec(World world, int x, int y, int z, ItemStack stack, int time){
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
if(world.getBlockMetadata(x, y, z)>3){
if(stack!=null){
if(isItemFuel(stack)==true){
this.ticks++;
@@ -258,7 +253,7 @@ public class TileForge extends TileEntity implements IInventory{
private void fireboxFuelDec2(World world, int x, int y, int z, ItemStack stack, int time){
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){
if(world.getBlockMetadata(x, y, z)>7){
if(stack!=null){
if(isItemFuel(stack)==true){
this.ticks++;
@@ -335,7 +330,7 @@ public class TileForge extends TileEntity implements IInventory{
{
return getItemBurnTime(stack) > 0;
}
//Main.sNet.sendToAll(new MsgPacketOn(tileEnt.isBurning));
//Main.sNet.sendToAll(new MsgPacketForgeX(tileEnt.xCoord));
//Main.sNet.sendToAll(new MsgPacketForgeY(tileEnt.yCoord));
@@ -353,6 +348,11 @@ public class TileForge extends TileEntity implements IInventory{
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)-4, 2);
}
}
if(world.getBlockMetadata(x, y, z)>3&&world.getBlockMetadata(x, y, z)<8){
if(this.getStackInSlot(1)!=null){
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)+4, 2);
}
}
}
}