mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-16 10:45:02 +00:00
Just needs the transaction redone
This commit is contained in:
1 parent
3eb7d90c89
commit
29293b01e6
6 files changed
+112
-100
No files matched your search
@@ -1,9 +1,8 @@
|
||||
package com.cricketcraft.chisel.block.tileentity;
|
||||
|
||||
import com.cricketcraft.chisel.block.BlockCarvable;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
import com.cricketcraft.chisel.init.ModItems;
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@@ -15,8 +14,6 @@ import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TileEntityAutoChisel extends TileEntity implements ISidedInventory {
|
||||
|
||||
@@ -93,68 +90,61 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
|
||||
if(isFaster){
|
||||
if(!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0){
|
||||
doTransaction();
|
||||
}
|
||||
} else {
|
||||
if(!worldObj.isRemote && worldObj.getWorldTime() % 40 == 0){
|
||||
doTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
markDirty();
|
||||
}
|
||||
|
||||
private void doTransaction(){
|
||||
if(inventory[BASE] != null && inventory[TARGET] != null){
|
||||
if(inventory[BASE].getItem() instanceof ItemBlock && inventory[TARGET].getItem() instanceof ItemBlock){
|
||||
Block base = Block.getBlockFromItem(inventory[BASE].getItem());
|
||||
Block target = Block.getBlockFromItem(inventory[TARGET].getItem());
|
||||
|
||||
if(base instanceof BlockCarvable){
|
||||
BlockCarvable baseCarvable = (BlockCarvable) base;
|
||||
|
||||
if(baseCarvable.carverHelper.variations.contains(target)){
|
||||
if(isStackMode){
|
||||
if(inventory[BASE].stackSize == inventory[BASE].getMaxStackSize()){
|
||||
if(inventory[BASE] != null && inventory[TARGET] != null){
|
||||
if(inventory[BASE].getItem() instanceof ItemBlock && inventory[TARGET].getItem() instanceof ItemBlock){
|
||||
if(inventory[BASE].getUnlocalizedName().equalsIgnoreCase(inventory[TARGET].getUnlocalizedName())){
|
||||
if(isStackMode){
|
||||
if(inventory[BASE].stackSize == inventory[BASE].getMaxStackSize()){
|
||||
if(inventory[OUTPUT] == null){
|
||||
inventory[OUTPUT] = inventory[BASE];
|
||||
inventory[BASE] = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(inventory[OUTPUT] == null){
|
||||
inventory[OUTPUT] = inventory[BASE];
|
||||
inventory[BASE].stackSize--;
|
||||
} else if(inventory[BASE].stackSize != 0){
|
||||
inventory[OUTPUT].stackSize++;
|
||||
inventory[BASE].stackSize--;
|
||||
} else {
|
||||
inventory[BASE] = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(inventory[OUTPUT] == null){
|
||||
inventory[OUTPUT] = new ItemStack(base, 1, inventory[BASE].getItemDamage());
|
||||
inventory[BASE].stackSize--;
|
||||
} else if(inventory[BASE].stackSize != 0){
|
||||
inventory[OUTPUT].stackSize++;
|
||||
inventory[BASE].stackSize--;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(target instanceof BlockCarvable){
|
||||
BlockCarvable targetCarvable = (BlockCarvable) target;
|
||||
|
||||
if(targetCarvable.carverHelper.variations.contains(base)){
|
||||
if(isStackMode){
|
||||
if(inventory[BASE].stackSize == inventory[BASE].getMaxStackSize()){
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(!worldObj.isRemote && worldObj.getWorldTime() % 100 == 0){
|
||||
if(inventory[BASE] != null && inventory[TARGET] != null){
|
||||
if(inventory[BASE].getItem() instanceof ItemBlock && inventory[TARGET].getItem() instanceof ItemBlock){
|
||||
if(inventory[BASE].getUnlocalizedName().equalsIgnoreCase(inventory[TARGET].getUnlocalizedName())){
|
||||
if(isStackMode){
|
||||
if(inventory[BASE].stackSize == inventory[BASE].getMaxStackSize()){
|
||||
if(inventory[OUTPUT] == null){
|
||||
inventory[OUTPUT] = inventory[BASE];
|
||||
inventory[BASE] = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(inventory[OUTPUT] == null){
|
||||
inventory[OUTPUT] = inventory[BASE];
|
||||
inventory[BASE].stackSize--;
|
||||
} else if(inventory[BASE].stackSize != 0){
|
||||
inventory[OUTPUT].stackSize++;
|
||||
inventory[BASE].stackSize--;
|
||||
} else {
|
||||
inventory[BASE] = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(inventory[OUTPUT] == null){
|
||||
inventory[OUTPUT] = new ItemStack(base, 1, inventory[BASE].getItemDamage());
|
||||
inventory[BASE].stackSize--;
|
||||
} else if(inventory[BASE].stackSize != 0){
|
||||
inventory[OUTPUT].stackSize++;
|
||||
inventory[BASE].stackSize--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user