Need to push shit out of the block class and put it in the tile Ent class
This commit is contained in:
@@ -19,18 +19,26 @@ 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;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgHandleLocZ;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgHandleLocX;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacket;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacketLocX;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacketLocY;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacketLocZ;
|
||||
import com.kitsu.medievalcraft.packethandle.forgeHammerParticles.MsgPacketLocX;
|
||||
import com.kitsu.medievalcraft.packethandle.sandFilterRender.MsgHandleSandFilterRender;
|
||||
import com.kitsu.medievalcraft.packethandle.sandFilterRender.MsgPacketSandFilterRender;
|
||||
import com.kitsu.medievalcraft.packethandle.shelf.MsgHandleShelfCase;
|
||||
@@ -88,6 +96,10 @@ public class Main {
|
||||
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();
|
||||
@@ -95,9 +107,6 @@ public class Main {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
|
||||
}
|
||||
|
||||
/**
|
||||
* Do your mod setup. Build whatever data structures you care about. Register recipes.
|
||||
*/
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent e) {
|
||||
|
||||
|
||||
@@ -26,11 +26,13 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
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.packethandle.shelf.MsgPacketShelfCase;
|
||||
import com.kitsu.medievalcraft.renderer.RenderId;
|
||||
import com.kitsu.medievalcraft.tileents.machine.TileForge;
|
||||
import com.kitsu.medievalcraft.util.CustomTab;
|
||||
@@ -43,8 +45,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
public class Forge extends BlockContainer implements TileForgePlaceables{
|
||||
|
||||
private final Random random = new Random();
|
||||
public static int sideMeta;
|
||||
public static boolean furnaceParts;
|
||||
public static int sideMeta, locX, locY, locZ;
|
||||
public static boolean furnaceParts, coalParts;
|
||||
private int c;
|
||||
|
||||
public Forge(String unlocalizedName, Material material) {
|
||||
@@ -59,7 +61,7 @@ public class Forge extends BlockContainer implements TileForgePlaceables{
|
||||
//this.isFlammable(world, x, y, z, face);
|
||||
//(xmin, ymin, zmin,
|
||||
// xmax, ymax, zmax)
|
||||
this.setBlockBounds(0.0F, 0.00F, 0.0F,
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F,
|
||||
1.0F, 1.0F, 1.0F);
|
||||
|
||||
}
|
||||
@@ -74,21 +76,44 @@ public class Forge extends BlockContainer implements TileForgePlaceables{
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
super.randomDisplayTick(world, x, y, z, random);
|
||||
if(furnaceParts == true){
|
||||
int l;
|
||||
float f;
|
||||
float f1;
|
||||
float f2;
|
||||
for (l = 0; l < 3; ++l)
|
||||
{
|
||||
f = (float)(x+0.25) + (rand.nextFloat()/2);
|
||||
f1 = (float)y + rand.nextFloat() * 0.4F + 0.3F;
|
||||
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);
|
||||
//world.spawnParticle("smoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if(this.furnaceParts==true){
|
||||
world.spawnParticle("fire", (double)locX, (double)locY+1f, (double)locZ, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("flame", (double)locX, (double)locY+1f, (double)locZ, 0.0D, 0.0D, 0.0D);
|
||||
world.spawnParticle("smoke", (double)locX, (double)locY+1f, (double)locZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
//if(x==locX&&y==locY&&z==locZ){
|
||||
/*if(this.furnaceParts == true){
|
||||
int l;
|
||||
float f;
|
||||
float f1;
|
||||
float f2;
|
||||
for (l = 0; l < 3; ++l)
|
||||
{
|
||||
f = (float)(locX+0.25) + (rand.nextFloat()/2);
|
||||
f1 = (float)locY + rand.nextFloat() * 0.4F + 0.3F;
|
||||
f2 = (float)(locZ+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);
|
||||
//world.spawnParticle("smoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
if(this.coalParts == true){
|
||||
int l;
|
||||
float f;
|
||||
float f1;
|
||||
float f2;
|
||||
for (l = 0; l < 3; ++l)
|
||||
{
|
||||
f = (float)(locX+0.25) + (rand.nextFloat()/2);
|
||||
//f1 = (float)y + rand.nextFloat() * 0.4F + 0.3F;
|
||||
f1 = locY;
|
||||
f2 = (float)(locZ+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);
|
||||
//world.spawnParticle("smoke", (double)f, (double)f1, (double)f2, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}*/
|
||||
//}
|
||||
}
|
||||
|
||||
public static int determineOrientation(World p_150071_0_, int p_150071_1_, int p_150071_2_, int p_150071_3_, EntityLivingBase p_150071_4_)
|
||||
@@ -136,8 +161,12 @@ public class Forge extends BlockContainer implements TileForgePlaceables{
|
||||
){
|
||||
tileEnt.isBurning=true;
|
||||
Main.sNet.sendToAll(new MsgPacketOn(tileEnt.isBurning));
|
||||
Main.sNet.sendToAll(new MsgPacketForgeX(tileEnt.xCoord));
|
||||
Main.sNet.sendToAll(new MsgPacketForgeY(tileEnt.yCoord));
|
||||
Main.sNet.sendToAll(new MsgPacketForgeZ(tileEnt.zCoord));
|
||||
if(tileEnt.getStackInSlot(1)!=null){
|
||||
tileEnt.isOn=true;
|
||||
Main.sNet.sendToAll(new MsgPacketBurning(tileEnt.isOn));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public final class ModCrafting {
|
||||
|
||||
|
||||
|
||||
public static final Hashtable<Integer, Item> pickheads = new Hashtable <Integer, Item>(){{
|
||||
|
||||
put(0, ModItems.unbreakingOneHead);
|
||||
|
||||
@@ -38,13 +38,12 @@ public class FireBow extends Item {
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_){
|
||||
|
||||
if(rand.nextInt(5) == 0){
|
||||
world.setBlock(x, y + 1, z , Blocks.fire);
|
||||
//item.setDamage(new ItemStack(item), +1);
|
||||
stack.damageItem(1, player);
|
||||
if(!world.isRemote){
|
||||
if(rand.nextInt(5) == 0){
|
||||
world.setBlock(x, y + 1, z , Blocks.fire);
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.kitsu.medievalcraft.item.craftingtools;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemShears;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.kitsu.medievalcraft.Main;
|
||||
@@ -8,46 +9,34 @@ import com.kitsu.medievalcraft.util.CustomTab;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class LeatherShears extends Item {
|
||||
public class LeatherShears extends ItemShears {
|
||||
|
||||
private String name = "leatherShears";
|
||||
private Item item;
|
||||
|
||||
public LeatherShears() {
|
||||
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName(name);
|
||||
setCreativeTab(CustomTab.MedievalCraftTab);
|
||||
setTextureName(Main.MODID + ":" + name);
|
||||
setMaxDamage(64);
|
||||
setNoRepair();
|
||||
|
||||
item = this;
|
||||
|
||||
GameRegistry.registerItem(this, name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemstack) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getContainerItem()
|
||||
{
|
||||
public Item getContainerItem(){
|
||||
item.setDamage(new ItemStack(item), +1);
|
||||
//itemStack.setItemDamage(itemStack.getItemDamage() + 1);
|
||||
return item;
|
||||
}
|
||||
|
||||
public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_)
|
||||
{
|
||||
public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,16 @@
|
||||
package com.kitsu.medievalcraft.packethandle.forge;
|
||||
|
||||
public class MsgHandleBurning {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,26 @@
|
||||
package com.kitsu.medievalcraft.packethandle.forge;
|
||||
|
||||
public class MsgPacketBurning {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.kitsu.medievalcraft.packethandle.forgeHammerParticles;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ingots.IngotBase;
|
||||
import com.kitsu.medievalcraft.block.machines.Forge;
|
||||
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
@@ -12,7 +13,7 @@ public class MsgHandleLocX implements IMessageHandler<MsgPacketLocX, IMessage>{
|
||||
public IMessage onMessage(MsgPacketLocX message, MessageContext ctx) {
|
||||
|
||||
IngotBase.locX = message.locx;
|
||||
//HotIronPlate.locX = message.locx;
|
||||
//Forge.locX = message.locx;
|
||||
//ItemRendererLongbow.tick = message.lTick;
|
||||
|
||||
//System.out.println(message.lTick);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 413 B |
Reference in New Issue
Block a user