commit
9b74c5438f
24 changed files with 87 additions and 175 deletions
|
@ -3,6 +3,9 @@ package techreborn.api.recipe;
|
||||||
import ic2.api.energy.prefab.BasicSink;
|
import ic2.api.energy.prefab.BasicSink;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.Packet;
|
||||||
|
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||||
|
import techreborn.packets.PacketHandler;
|
||||||
import techreborn.tiles.TileMachineBase;
|
import techreborn.tiles.TileMachineBase;
|
||||||
import techreborn.util.Inventory;
|
import techreborn.util.Inventory;
|
||||||
import techreborn.util.ItemUtils;
|
import techreborn.util.ItemUtils;
|
||||||
|
@ -80,7 +83,7 @@ public class RecipeCrafter {
|
||||||
|
|
||||||
public IBaseRecipeType currentRecipe;
|
public IBaseRecipeType currentRecipe;
|
||||||
public int currentTickTime = 0;
|
public int currentTickTime = 0;
|
||||||
public int currentNeededTicks = 0;
|
public int currentNeededTicks = 1;//Set to 1 to stop rare crashes
|
||||||
double lastEnergy;
|
double lastEnergy;
|
||||||
public boolean isactive = false;
|
public boolean isactive = false;
|
||||||
|
|
||||||
|
@ -111,26 +114,31 @@ public class RecipeCrafter {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (currentRecipe == null) {//It will now look for new recipes.
|
if (currentRecipe == null) {//It will now look for new recipes.
|
||||||
|
currentTickTime = 0;
|
||||||
for (IBaseRecipeType recipe : RecipeHanderer.getRecipeClassFromName(recipeName)) {
|
for (IBaseRecipeType recipe : RecipeHanderer.getRecipeClassFromName(recipeName)) {
|
||||||
if (recipe.canCraft(parentTile) && hasAllInputs(recipe)) {//This checks to see if it has all of the inputs
|
if (recipe.canCraft(parentTile) && hasAllInputs(recipe)) {//This checks to see if it has all of the inputs
|
||||||
boolean canGiveInvAll = true;
|
boolean canGiveInvAll = true;
|
||||||
for (int i = 0; i < recipe.getOutputs().size(); i++) {//This checks to see if it can fit all of the outputs
|
for (int i = 0; i < recipe.getOutputs().size(); i++) {//This checks to see if it can fit all of the outputs
|
||||||
if (!canFitStack(recipe.getOutputs().get(i), outputSlots[i])) {
|
if (!canFitStack(recipe.getOutputs().get(i), outputSlots[i])) {
|
||||||
canGiveInvAll = false;
|
canGiveInvAll = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (canGiveInvAll) {
|
if (canGiveInvAll) {
|
||||||
currentRecipe = recipe;//Sets the current recipe then syncs
|
currentRecipe = recipe;//Sets the current recipe then syncs
|
||||||
this.currentNeededTicks = (int)(currentRecipe.tickTime() * (1.0 - speedMultiplier));
|
this.currentNeededTicks = (int)(currentRecipe.tickTime() * (1.0 - speedMultiplier));
|
||||||
parentTile.syncWithAll();//update texture
|
this.currentTickTime = 0;
|
||||||
|
syncIsActive();
|
||||||
|
} else {
|
||||||
|
this.currentTickTime = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!hasAllInputs()) {//If it doesn't have all the inputs reset
|
if (!hasAllInputs()) {//If it doesn't have all the inputs reset
|
||||||
currentRecipe = null;
|
currentRecipe = null;
|
||||||
currentTickTime = 0;
|
currentTickTime = -1;
|
||||||
parentTile.syncWithAll();//update texture
|
syncIsActive();
|
||||||
}
|
}
|
||||||
if (currentRecipe != null && currentTickTime >= currentNeededTicks) {//If it has reached the recipe tick time
|
if (currentRecipe != null && currentTickTime >= currentNeededTicks) {//If it has reached the recipe tick time
|
||||||
boolean canGiveInvAll = true;
|
boolean canGiveInvAll = true;
|
||||||
|
@ -150,8 +158,7 @@ public class RecipeCrafter {
|
||||||
useAllInputs();//this uses all the inputs
|
useAllInputs();//this uses all the inputs
|
||||||
currentRecipe = null;//resets
|
currentRecipe = null;//resets
|
||||||
currentTickTime = 0;
|
currentTickTime = 0;
|
||||||
//Force sync after craft to update texture
|
syncIsActive();
|
||||||
parentTile.syncWithAll();
|
|
||||||
}
|
}
|
||||||
} else if (currentRecipe != null && currentTickTime < currentNeededTicks) {
|
} else if (currentRecipe != null && currentTickTime < currentNeededTicks) {
|
||||||
if (energy.useEnergy(getEuPerTick())) {//This uses the power
|
if (energy.useEnergy(getEuPerTick())) {//This uses the power
|
||||||
|
@ -244,9 +251,15 @@ public class RecipeCrafter {
|
||||||
public void readFromNBT(NBTTagCompound tag) {
|
public void readFromNBT(NBTTagCompound tag) {
|
||||||
NBTTagCompound data = tag.getCompoundTag("Crater");
|
NBTTagCompound data = tag.getCompoundTag("Crater");
|
||||||
|
|
||||||
|
if(data.hasKey("currentTickTime"))
|
||||||
currentTickTime = data.getInteger("currentTickTime");
|
currentTickTime = data.getInteger("currentTickTime");
|
||||||
|
|
||||||
isactive = data.getBoolean("isActive");
|
isactive = data.getBoolean("isActive");
|
||||||
|
if(parentTile.getWorldObj().isRemote){
|
||||||
|
System.out.println(isactive);
|
||||||
|
parentTile.getWorldObj().markBlockForUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord);
|
||||||
|
parentTile.getWorldObj().markBlockRangeForRenderUpdate(parentTile.xCoord, parentTile.yCoord, parentTile.zCoord, parentTile.xCoord, parentTile.yCoord, parentTile.zCoord);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound tag) {
|
public void writeToNBT(NBTTagCompound tag) {
|
||||||
|
@ -259,6 +272,7 @@ public class RecipeCrafter {
|
||||||
tag.setTag("Crater", data);
|
tag.setTag("Crater", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean isActiveServer() {
|
private boolean isActiveServer() {
|
||||||
return currentRecipe != null;
|
return currentRecipe != null;
|
||||||
}
|
}
|
||||||
|
@ -295,4 +309,19 @@ public class RecipeCrafter {
|
||||||
public double getEuPerTick(){
|
public double getEuPerTick(){
|
||||||
return currentRecipe.euPerTick() * powerMultiplier;
|
return currentRecipe.euPerTick() * powerMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void syncIsActive() {
|
||||||
|
if (!parentTile.getWorldObj().isRemote) {
|
||||||
|
PacketHandler.sendPacketToAllPlayers(parentTile.getDescriptionPacket(),
|
||||||
|
parentTile.getWorldObj());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Packet getSyncPacket() {
|
||||||
|
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||||
|
writeToNBT(nbtTag);
|
||||||
|
return new S35PacketUpdateTileEntity(this.parentTile.xCoord, this.parentTile.yCoord,
|
||||||
|
this.parentTile.zCoord, 1, nbtTag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package techreborn.blocks;
|
package techreborn.blocks;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
@ -11,8 +15,10 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import techreborn.client.TechRebornCreativeTabMisc;
|
import techreborn.client.TechRebornCreativeTabMisc;
|
||||||
|
import techreborn.init.ModItems;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@ -34,11 +40,18 @@ public class BlockOre extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int meta, Random random, int fortune)
|
public Item getItemDropped(int meta, Random random, int fortune){
|
||||||
{
|
if (meta == 5){
|
||||||
|
return new ItemStack(ModItems.dusts, 1, 60).getItem();
|
||||||
|
}
|
||||||
return Item.getItemFromBlock(this);
|
return Item.getItemFromBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean canSilkHarvest() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list)
|
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list)
|
||||||
|
@ -50,9 +63,7 @@ public class BlockOre extends Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int metaData)
|
public int damageDropped(int metaData){
|
||||||
{
|
|
||||||
// TODO RubyOre Returns Rubys
|
|
||||||
return metaData;
|
return metaData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import net.minecraft.inventory.Slot;
|
||||||
import techreborn.client.SlotOutput;
|
import techreborn.client.SlotOutput;
|
||||||
import techreborn.tiles.TileAlloySmelter;
|
import techreborn.tiles.TileAlloySmelter;
|
||||||
|
|
||||||
public class ContainerAlloySmelter extends TechRebornContainer {
|
public class ContainerAlloySmelter extends ContainerCrafting {
|
||||||
|
|
||||||
EntityPlayer player;
|
EntityPlayer player;
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ public class ContainerAlloySmelter extends TechRebornContainer {
|
||||||
public ContainerAlloySmelter(TileAlloySmelter tileAlloysmelter,
|
public ContainerAlloySmelter(TileAlloySmelter tileAlloysmelter,
|
||||||
EntityPlayer player)
|
EntityPlayer player)
|
||||||
{
|
{
|
||||||
|
super(tileAlloysmelter.crafter);
|
||||||
tile = tileAlloysmelter;
|
tile = tileAlloysmelter;
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,9 @@ public abstract class ContainerCrafting extends TechRebornContainer {
|
||||||
|
|
||||||
RecipeCrafter crafter;
|
RecipeCrafter crafter;
|
||||||
|
|
||||||
public int currentTickTime = 0;
|
int currentTickTime = 0;
|
||||||
public int currentNeededTicks = 0;
|
int currentNeededTicks = 0;
|
||||||
public int energy;
|
int energy;
|
||||||
|
|
||||||
public ContainerCrafting(RecipeCrafter crafter) {
|
public ContainerCrafting(RecipeCrafter crafter) {
|
||||||
this.crafter = crafter;
|
this.crafter = crafter;
|
||||||
|
@ -52,5 +52,8 @@ public abstract class ContainerCrafting extends TechRebornContainer {
|
||||||
} else if(id == 2){
|
} else if(id == 2){
|
||||||
this.energy = value;
|
this.energy = value;
|
||||||
}
|
}
|
||||||
|
this.crafter.currentTickTime = currentTickTime;
|
||||||
|
this.crafter.currentNeededTicks = currentNeededTicks;
|
||||||
|
this.crafter.energy.setEnergyStored(energy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class GuiAlloySmelter extends GuiContainer {
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
if(alloysmelter.crafter.currentRecipe != null) {
|
if(alloysmelter.crafter.currentTickTime != 0) {
|
||||||
j = this.alloysmelter.crafter.currentTickTime * 24 / this.alloysmelter.crafter.currentNeededTicks;
|
j = this.alloysmelter.crafter.currentTickTime * 24 / this.alloysmelter.crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);
|
||||||
|
|
|
@ -42,12 +42,12 @@ public class GuiAssemblingMachine extends GuiContainer {
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
if(this.containerAssemblingMachine.currentTickTime != 0){
|
if(this.assemblingmachine.crafter.currentTickTime != 0){
|
||||||
j = this.containerAssemblingMachine.currentTickTime * 20 / this.containerAssemblingMachine.currentNeededTicks;
|
j = this.assemblingmachine.crafter.currentTickTime * 20 / this.assemblingmachine.crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16);
|
||||||
|
|
||||||
j = this.containerAssemblingMachine.energy * 12 / this.assemblingmachine.energy.getCapacity();
|
j = (int) (this.assemblingmachine.energy.getEnergyStored() * 12 / this.assemblingmachine.energy.getCapacity());
|
||||||
if(j > 0) {
|
if(j > 0) {
|
||||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,12 +42,12 @@ public class GuiChemicalReactor extends GuiContainer {
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
if(this.containerChemicalReactor.currentTickTime != 0){
|
if(this.chemicalReactor.crafter.currentTickTime != 0){
|
||||||
j = this.containerChemicalReactor.currentTickTime * 20 / this.containerChemicalReactor.currentNeededTicks;
|
j = this.chemicalReactor.crafter.currentTickTime * 20 / this.chemicalReactor.crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j);
|
this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j);
|
||||||
|
|
||||||
j = this.containerChemicalReactor.energy * 12 / this.chemicalReactor.energy.getCapacity();
|
j = (int) (this.chemicalReactor.crafter.energy.getEnergyStored() * 12 / this.chemicalReactor.energy.getCapacity());
|
||||||
if(j > 0) {
|
if(j > 0) {
|
||||||
this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,13 +42,13 @@ public class GuiImplosionCompressor extends GuiContainer{
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
if(this.containerImplosionCompressor.currentTickTime != 0){
|
if(this.compresser.crafter.currentTickTime != 0){
|
||||||
j = this.containerImplosionCompressor.currentTickTime * 20 / this.containerImplosionCompressor.currentNeededTicks;
|
j = this.compresser.crafter.currentTickTime * 20 / this.compresser.crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.drawTexturedModalRect(k + 60, l + 38, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 60, l + 38, 176, 14, j + 1, 16);
|
||||||
|
|
||||||
j = this.containerImplosionCompressor.energy * 12 / this.compresser.energy.getCapacity();
|
j = (int) (this.compresser.crafter.energy.getEnergyStored() * 12 / this.compresser.energy.getCapacity());
|
||||||
if(j > 0) {
|
if(j > 0) {
|
||||||
this.drawTexturedModalRect(k + 16, l + 37 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 16, l + 37 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,12 +42,12 @@ public class GuiLathe extends GuiContainer {
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
if(this.containerLathe.currentTickTime != 0){
|
if(this.lathe.crafter.currentTickTime != 0){
|
||||||
j = this.containerLathe.currentTickTime * 20 / this.containerLathe.currentNeededTicks;
|
j = this.lathe.crafter.currentTickTime * 20 / this.lathe.crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
this.drawTexturedModalRect(k + 80, l + 34, 176, 14, j, 16);
|
this.drawTexturedModalRect(k + 80, l + 34, 176, 14, j, 16);
|
||||||
|
|
||||||
j = this.containerLathe.energy * 12 / this.lathe.energy.getCapacity();
|
j = (int) (this.lathe.energy.getEnergyStored() * 12 / this.lathe.energy.getCapacity());
|
||||||
if(j > 0) {
|
if(j > 0) {
|
||||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,12 +43,12 @@ public class GuiPlateCuttingMachine extends GuiContainer {
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
if(this.containerPlateCuttingMachine.currentTickTime != 0){
|
if(this.platecuttingmachine.crafter.currentTickTime != 0){
|
||||||
j = this.containerPlateCuttingMachine.currentTickTime * 20 / this.containerPlateCuttingMachine.currentNeededTicks;
|
j = this.platecuttingmachine.crafter.currentTickTime * 20 / this.platecuttingmachine.crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
this.drawTexturedModalRect(k + 83, l + 34, 176, 14, j, 16);
|
this.drawTexturedModalRect(k + 83, l + 34, 176, 14, j, 16);
|
||||||
|
|
||||||
j = this.containerPlateCuttingMachine.energy * 12 / this.platecuttingmachine.energy.getCapacity();
|
j = (int) (this.platecuttingmachine.energy.getEnergyStored() * 12 / this.platecuttingmachine.energy.getCapacity());
|
||||||
if(j > 0) {
|
if(j > 0) {
|
||||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,21 +151,6 @@ public class CablePart extends ModPart implements IEnergyConductor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
if (ticks == 0) {
|
|
||||||
checkConnectedSides();
|
|
||||||
ticks += 1;
|
|
||||||
} else if (ticks == 40) {
|
|
||||||
ticks = 0;
|
|
||||||
} else {
|
|
||||||
ticks += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IC2.platform.isSimulating()) {
|
|
||||||
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
|
|
||||||
this.addedToEnergyNet = true;
|
|
||||||
checkConnectedSides();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -91,13 +91,6 @@ public class TileAlloySmelter extends TileMachineBase implements IWrenchable, IE
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
|
||||||
super.writeSyncToNBT(tagCompound);
|
|
||||||
energy.writeToNBT(tagCompound);
|
|
||||||
crafter.writeToNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate(){
|
public void invalidate(){
|
||||||
energy.invalidate();
|
energy.invalidate();
|
||||||
|
|
|
@ -102,14 +102,6 @@ public class TileAssemblingMachine extends TileMachineBase implements IWrenchabl
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
|
||||||
super.writeSyncToNBT(tagCompound);
|
|
||||||
energy.writeToNBT(tagCompound);
|
|
||||||
crafter.writeToNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate()
|
public void invalidate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -109,14 +109,6 @@ public class TileCentrifuge extends TileMachineBase implements IWrenchable, IEn
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
|
||||||
super.writeSyncToNBT(tagCompound);
|
|
||||||
energy.writeToNBT(tagCompound);
|
|
||||||
crafter.writeToNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate()
|
public void invalidate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,14 +102,6 @@ public class TileChemicalReactor extends TileMachineBase implements IWrenchable,
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
|
||||||
super.writeSyncToNBT(tagCompound);
|
|
||||||
energy.writeToNBT(tagCompound);
|
|
||||||
crafter.writeToNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate()
|
public void invalidate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -99,15 +99,6 @@ public class TileGrinder extends TileMachineBase implements IWrenchable, IEnergy
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
|
||||||
super.writeSyncToNBT(tagCompound);
|
|
||||||
energy.writeToNBT(tagCompound);
|
|
||||||
crafter.writeToNBT(tagCompound);
|
|
||||||
tank.writeToNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
energy.invalidate();
|
energy.invalidate();
|
||||||
|
|
|
@ -123,13 +123,6 @@ public class TileHeatGenerator extends TileMachineBase implements IWrenchable, I
|
||||||
energy.writeToNBT(tagCompound);
|
energy.writeToNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
|
||||||
super.writeSyncToNBT(tagCompound);
|
|
||||||
energy.writeToNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addWailaInfo(List<String> info)
|
public void addWailaInfo(List<String> info)
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,14 +95,6 @@ public class TileImplosionCompressor extends TileMachineBase implements IWrencha
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
|
||||||
super.writeSyncToNBT(tagCompound);
|
|
||||||
energy.writeToNBT(tagCompound);
|
|
||||||
crafter.writeToNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addWailaInfo(List<String> info)
|
public void addWailaInfo(List<String> info)
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,14 +100,6 @@ public class TileIndustrialElectrolyzer extends TileMachineBase implements IWren
|
||||||
energy.writeToNBT(tagCompound);
|
energy.writeToNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
|
||||||
super.writeSyncToNBT(tagCompound);
|
|
||||||
energy.writeToNBT(tagCompound);
|
|
||||||
crafter.writeToNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate()
|
public void invalidate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -104,14 +104,6 @@ public class TileIndustrialSawmill extends TileMachineBase implements IWrenchabl
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
|
||||||
super.writeSyncToNBT(tagCompound);
|
|
||||||
energy.writeToNBT(tagCompound);
|
|
||||||
crafter.writeToNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate()
|
public void invalidate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,14 +101,6 @@ public class TileLathe extends TileMachineBase implements IWrenchable, IEnergyTi
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
|
||||||
super.writeSyncToNBT(tagCompound);
|
|
||||||
energy.writeToNBT(tagCompound);
|
|
||||||
crafter.writeToNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate()
|
public void invalidate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,19 +11,17 @@ import techreborn.packets.PacketHandler;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TileMachineBase extends TileEntity {
|
public abstract class TileMachineBase extends TileEntity {
|
||||||
|
|
||||||
public boolean needsSync = false;
|
@Deprecated
|
||||||
public int ticksSinceLastSync = 0;
|
/**
|
||||||
|
* Try not to use this
|
||||||
@Override
|
*/
|
||||||
public void updateEntity() {
|
public void syncWithAll() {
|
||||||
super.updateEntity();
|
if (!worldObj.isRemote) {
|
||||||
//Force a sync evey 10 seconds
|
PacketHandler.sendPacketToAllPlayers(getDescriptionPacket(),
|
||||||
if(needsSync && !worldObj.isRemote){
|
worldObj);
|
||||||
syncWithAll();
|
|
||||||
}
|
}
|
||||||
ticksSinceLastSync ++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
@ -31,22 +29,6 @@ public class TileMachineBase extends TileEntity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void syncWithAll() {
|
|
||||||
if (!worldObj.isRemote) {
|
|
||||||
PacketHandler.sendPacketToAllPlayers(getSyncPacket(),
|
|
||||||
worldObj);
|
|
||||||
}
|
|
||||||
needsSync = false;
|
|
||||||
ticksSinceLastSync = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Packet getSyncPacket() {
|
|
||||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
|
||||||
writeSyncToNBT(nbtTag);
|
|
||||||
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord,
|
|
||||||
this.zCoord, 1, nbtTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Packet getDescriptionPacket() {
|
public Packet getDescriptionPacket() {
|
||||||
NBTTagCompound nbtTag = new NBTTagCompound();
|
NBTTagCompound nbtTag = new NBTTagCompound();
|
||||||
writeToNBT(nbtTag);
|
writeToNBT(nbtTag);
|
||||||
|
@ -61,9 +43,4 @@ public class TileMachineBase extends TileEntity {
|
||||||
readFromNBT(packet.func_148857_g());
|
readFromNBT(packet.func_148857_g());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,13 +83,6 @@ public class TileMatterFabricator extends TileMachineBase implements IWrenchable
|
||||||
energy.writeToNBT(tagCompound);
|
energy.writeToNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
|
||||||
super.writeSyncToNBT(tagCompound);
|
|
||||||
energy.writeToNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate()
|
public void invalidate()
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,14 +101,6 @@ public class TilePlateCuttingMachine extends TileMachineBase implements IWrencha
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncToNBT(NBTTagCompound tagCompound) {
|
|
||||||
super.writeSyncToNBT(tagCompound);
|
|
||||||
energy.writeToNBT(tagCompound);
|
|
||||||
crafter.writeToNBT(tagCompound);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addWailaInfo(List<String> info)
|
public void addWailaInfo(List<String> info)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue