mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-25 14:44:35 +00:00
More stream work
This commit is contained in:
1 parent
8f0f2d3937
commit
7c14f2db03
7 files changed
+35
-30
No files matched your search
@@ -38,6 +38,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockPresent extends BlockContainer implements ICarvable {
|
||||
private final Random random = new Random();
|
||||
private String textureLocation;
|
||||
public CarvableHelper carverHelper;
|
||||
private boolean isChristmas = true;
|
||||
|
||||
@@ -73,7 +74,23 @@ public class BlockPresent extends BlockContainer implements ICarvable {
|
||||
public ResourceLocation getResourceSingle(int metadata) {
|
||||
if (isChristmas) {
|
||||
switch (metadata) {
|
||||
case 0:
|
||||
return new ResourceLocation(Chisel.MOD_ID, "textures/blocks/present/giftboxBlack.png");
|
||||
case 1:
|
||||
return new ResourceLocation(Chisel.MOD_ID, "textures/blocks/present/giftboxBlue.png");
|
||||
case 2:
|
||||
return new ResourceLocation(Chisel.MOD_ID, "textures/blocks/present/giftboxCyan.png");
|
||||
case 3:
|
||||
return new ResourceLocation(Chisel.MOD_ID, "textures/blocks/present/giftboxGreen.png");
|
||||
case 4:
|
||||
return new ResourceLocation(Chisel.MOD_ID, "textures/blocks/present/giftboxOrange.png");
|
||||
case 5:
|
||||
return new ResourceLocation(Chisel.MOD_ID, "textures/blocks/present/giftboxPink.png");
|
||||
case 6:
|
||||
return new ResourceLocation(Chisel.MOD_ID, "textures/blocks/present/giftboxPurple.png");
|
||||
case 7:
|
||||
return new ResourceLocation(Chisel.MOD_ID, "textures/blocks/present/giftboxYellow.png");
|
||||
case 8:
|
||||
return new ResourceLocation(Chisel.MOD_ID, "textures/blocks/present/red.png");
|
||||
default:
|
||||
return null;
|
||||
|
||||
@@ -92,11 +92,11 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
}
|
||||
|
||||
if(isFaster){
|
||||
if(!worldObj.isRemote && worldObj.getWorldTime() % 10 == 0){
|
||||
if(!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0){
|
||||
doTransaction();
|
||||
}
|
||||
} else {
|
||||
if(!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0){
|
||||
if(!worldObj.isRemote && worldObj.getWorldTime() % 40 == 0){
|
||||
doTransaction();
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
}
|
||||
|
||||
private void doTransaction(){
|
||||
if(!(isSlotNull(BASE) && !(isSlotNull(TARGET)))){
|
||||
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());
|
||||
@@ -116,13 +116,13 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
if(baseCarvable.carverHelper.variations.contains(target)){
|
||||
if(isStackMode){
|
||||
if(inventory[BASE].stackSize == inventory[BASE].getMaxStackSize()){
|
||||
if(isSlotNull(OUTPUT)){
|
||||
if(inventory[OUTPUT] == null){
|
||||
inventory[OUTPUT] = inventory[BASE];
|
||||
inventory[BASE] = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(isSlotNull(OUTPUT)){
|
||||
if(inventory[OUTPUT] == null){
|
||||
inventory[OUTPUT] = new ItemStack(base, 1, inventory[BASE].getItemDamage());
|
||||
inventory[BASE].stackSize--;
|
||||
} else if(inventory[BASE].stackSize != 0){
|
||||
@@ -137,13 +137,13 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
if(targetCarvable.carverHelper.variations.contains(base)){
|
||||
if(isStackMode){
|
||||
if(inventory[BASE].stackSize == inventory[BASE].getMaxStackSize()){
|
||||
if(isSlotNull(OUTPUT)){
|
||||
if(inventory[OUTPUT] == null){
|
||||
inventory[OUTPUT] = inventory[BASE];
|
||||
inventory[BASE] = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(isSlotNull(OUTPUT)){
|
||||
if(inventory[OUTPUT] == null){
|
||||
inventory[OUTPUT] = new ItemStack(base, 1, inventory[BASE].getItemDamage());
|
||||
inventory[BASE].stackSize--;
|
||||
} else if(inventory[BASE].stackSize != 0){
|
||||
@@ -157,14 +157,6 @@ public class TileEntityAutoChisel extends TileEntity implements ISidedInventory
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSlotNull(int slot){
|
||||
if(inventory[slot] == null){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
Reference in new issue
Block a user