This commit is contained in:
Ellpeck 2015-10-03 10:16:18 +02:00
parent 23e23f5836
commit 8c0c2bb073
135 changed files with 1477 additions and 1021 deletions

View file

@ -51,7 +51,9 @@ public enum TheAchievements{
TheAchievements(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore, int type){ TheAchievements(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore, int type){
this.ach = new Achievement("achievement."+ModUtil.MOD_ID_LOWER+"."+name, ModUtil.MOD_ID_LOWER+"."+name, x, y, displayStack, hasToHaveBefore); this.ach = new Achievement("achievement."+ModUtil.MOD_ID_LOWER+"."+name, ModUtil.MOD_ID_LOWER+"."+name, x, y, displayStack, hasToHaveBefore);
if(hasToHaveBefore == null) this.ach.initIndependentStat(); if(hasToHaveBefore == null){
this.ach.initIndependentStat();
}
this.ach.registerStat(); this.ach.registerStat();
this.type = type; this.type = type;
} }

View file

@ -60,16 +60,24 @@ public class BlockBreaker extends BlockContainerBase implements IActAddItemOrBlo
@Override @Override
public IIcon getIcon(int side, int meta){ public IIcon getIcon(int side, int meta){
if(side == 0 || side == 1) return this.topIcon; if(side == 0 || side == 1){
if(side == 3) return this.frontIcon; return this.topIcon;
}
if(side == 3){
return this.frontIcon;
}
return this.blockIcon; return this.blockIcon;
} }
@Override @Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
if(side != meta && (side == 0 || side == 1)) return this.topIcon; if(side != meta && (side == 0 || side == 1)){
if(side == meta) return this.frontIcon; return this.topIcon;
}
if(side == meta){
return this.frontIcon;
}
return this.blockIcon; return this.blockIcon;
} }

View file

@ -48,10 +48,18 @@ public class BlockCoffeeMachine extends BlockContainerBase implements IActAddIte
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
if(rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 0); if(rotation == 0){
if(rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 1, 3); world.setBlockMetadataWithNotify(x, y, z, 2, 0);
if(rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 0, 2); }
if(rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 3, 3); if(rotation == 1){
world.setBlockMetadataWithNotify(x, y, z, 1, 3);
}
if(rotation == 2){
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
}
if(rotation == 3){
world.setBlockMetadataWithNotify(x, y, z, 3, 3);
}
} }
@Override @Override

View file

@ -36,10 +36,8 @@ import java.util.Random;
public class BlockColoredLamp extends Block implements IActAddItemOrBlock{ public class BlockColoredLamp extends Block implements IActAddItemOrBlock{
public static TheColoredLampColors[] allLampTypes = TheColoredLampColors.values(); public static TheColoredLampColors[] allLampTypes = TheColoredLampColors.values();
private IIcon[] textures = new IIcon[allLampTypes.length];
public boolean isOn; public boolean isOn;
private IIcon[] textures = new IIcon[allLampTypes.length];
public BlockColoredLamp(boolean isOn){ public BlockColoredLamp(boolean isOn){
super(Material.redstoneLight); super(Material.redstoneLight);
@ -162,7 +160,9 @@ public class BlockColoredLamp extends Block implements IActAddItemOrBlock{
@Override @Override
public String getItemStackDisplayName(ItemStack stack){ public String getItemStackDisplayName(ItemStack stack){
if(stack.getItemDamage() >= allLampTypes.length) return null; if(stack.getItemDamage() >= allLampTypes.length){
return null;
}
return StringUtil.localize(this.getUnlocalizedName(stack)+".name")+(((BlockColoredLamp)this.theBlock).isOn ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".onSuffix.desc")+")" : ""); return StringUtil.localize(this.getUnlocalizedName(stack)+".name")+(((BlockColoredLamp)this.theBlock).isOn ? " ("+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".onSuffix.desc")+")" : "");
} }
} }

View file

@ -60,7 +60,9 @@ public class BlockCompost extends BlockContainerBase implements IActAddItemOrBlo
else{ else{
tile.slots[0].stackSize++; tile.slots[0].stackSize++;
} }
if(!player.capabilities.isCreativeMode) player.inventory.getCurrentItem().stackSize--; if(!player.capabilities.isCreativeMode){
player.inventory.getCurrentItem().stackSize--;
}
} }
//Add Fertilizer to player's inventory //Add Fertilizer to player's inventory

View file

@ -71,7 +71,9 @@ public abstract class BlockContainerBase extends BlockContainer{
@Override @Override
public int getComparatorInputOverride(World world, int x, int y, int z, int meta){ public int getComparatorInputOverride(World world, int x, int y, int z, int meta){
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof IInventory) return Container.calcRedstoneFromInventory((IInventory)tile); if(tile instanceof IInventory){
return Container.calcRedstoneFromInventory((IInventory)tile);
}
return 0; return 0;
} }
} }

View file

@ -57,16 +57,24 @@ public class BlockDropper extends BlockContainerBase implements IActAddItemOrBlo
@Override @Override
public IIcon getIcon(int side, int meta){ public IIcon getIcon(int side, int meta){
if(side == 0 || side == 1) return this.topIcon; if(side == 0 || side == 1){
if(side == 3) return this.frontIcon; return this.topIcon;
}
if(side == 3){
return this.frontIcon;
}
return this.blockIcon; return this.blockIcon;
} }
@Override @Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
if(side != meta && (side == 0 || side == 1)) return this.topIcon; if(side != meta && (side == 0 || side == 1)){
if(side == meta) return this.frontIcon; return this.topIcon;
}
if(side == meta){
return this.frontIcon;
}
return this.blockIcon; return this.blockIcon;
} }

View file

@ -60,16 +60,24 @@ public class BlockFluidCollector extends BlockContainerBase implements IActAddIt
@Override @Override
public IIcon getIcon(int side, int meta){ public IIcon getIcon(int side, int meta){
if(side == 0 || side == 1) return this.topIcon; if(side == 0 || side == 1){
if(side == 3) return this.frontIcon; return this.topIcon;
}
if(side == 3){
return this.frontIcon;
}
return this.blockIcon; return this.blockIcon;
} }
@Override @Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
if(side != meta && (side == 0 || side == 1)) return this.topIcon; if(side != meta && (side == 0 || side == 1)){
if(side == meta) return this.frontIcon; return this.topIcon;
}
if(side == meta){
return this.frontIcon;
}
return this.blockIcon; return this.blockIcon;
} }

View file

@ -28,10 +28,9 @@ import net.minecraftforge.fluids.Fluid;
public class BlockFluidFlowing extends BlockFluidClassic implements IActAddItemOrBlock{ public class BlockFluidFlowing extends BlockFluidClassic implements IActAddItemOrBlock{
private String name;
public IIcon stillIcon; public IIcon stillIcon;
public IIcon flowingIcon; public IIcon flowingIcon;
private String name;
public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName){ public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName){
super(fluid, material); super(fluid, material);

View file

@ -52,10 +52,18 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IActAddIte
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
if(rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 0, 2); if(rotation == 0){
if(rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 3, 2); world.setBlockMetadataWithNotify(x, y, z, 0, 2);
if(rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 1, 2); }
if(rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 2); if(rotation == 1){
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if(rotation == 2){
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
}
if(rotation == 3){
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
} }
@Override @Override
@ -70,19 +78,27 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IActAddIte
@Override @Override
public IIcon getIcon(int side, int meta){ public IIcon getIcon(int side, int meta){
if(side == 1) return this.topIcon; if(side == 1){
if(side == 3) return this.frontIcon; return this.topIcon;
}
if(side == 3){
return this.frontIcon;
}
return this.blockIcon; return this.blockIcon;
} }
@Override @Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
if(side == 1) return this.topIcon; if(side == 1){
return this.topIcon;
}
if(side == meta+2 && meta <= 3){ if(side == meta+2 && meta <= 3){
return this.frontIcon; return this.frontIcon;
} }
else if(side == meta-2 && meta > 3) return this.onIcon; else if(side == meta-2 && meta > 3){
return this.onIcon;
}
return this.blockIcon; return this.blockIcon;
} }

View file

@ -33,12 +33,11 @@ import java.util.Random;
public class BlockGrinder extends BlockContainerBase implements IActAddItemOrBlock{ public class BlockGrinder extends BlockContainerBase implements IActAddItemOrBlock{
private final boolean isDouble;
private IIcon topIcon; private IIcon topIcon;
private IIcon onIcon; private IIcon onIcon;
private IIcon bottomIcon; private IIcon bottomIcon;
private final boolean isDouble;
public BlockGrinder(boolean isDouble){ public BlockGrinder(boolean isDouble){
super(Material.rock); super(Material.rock);
this.isDouble = isDouble; this.isDouble = isDouble;
@ -61,9 +60,15 @@ public class BlockGrinder extends BlockContainerBase implements IActAddItemOrBlo
@Override @Override
public IIcon getIcon(int side, int meta){ public IIcon getIcon(int side, int meta){
if(side == 1 && meta != 1) return this.topIcon; if(side == 1 && meta != 1){
if(side == 1) return this.onIcon; return this.topIcon;
if(side == 0) return this.bottomIcon; }
if(side == 1){
return this.onIcon;
}
if(side == 0){
return this.bottomIcon;
}
return this.blockIcon; return this.blockIcon;
} }

View file

@ -55,8 +55,12 @@ public class BlockItemRepairer extends BlockContainerBase implements IActAddItem
@Override @Override
public IIcon getIcon(int side, int meta){ public IIcon getIcon(int side, int meta){
if(side == 1) return this.topIcon; if(side == 1){
if(side == 0) return this.bottomIcon; return this.topIcon;
}
if(side == 0){
return this.bottomIcon;
}
return this.blockIcon; return this.blockIcon;
} }

View file

@ -54,14 +54,18 @@ public class BlockLampPowerer extends Block implements IActAddItemOrBlock{
@Override @Override
public IIcon getIcon(int side, int meta){ public IIcon getIcon(int side, int meta){
if(side == 3) return this.frontIcon; if(side == 3){
return this.frontIcon;
}
return this.blockIcon; return this.blockIcon;
} }
@Override @Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
if(side == meta) return this.frontIcon; if(side == meta){
return this.frontIcon;
}
return this.blockIcon; return this.blockIcon;
} }

View file

@ -36,17 +36,8 @@ import net.minecraft.world.World;
public class BlockPhantom extends BlockContainerBase implements IActAddItemOrBlock{ public class BlockPhantom extends BlockContainerBase implements IActAddItemOrBlock{
public enum Type{
FACE,
PLACER,
BREAKER,
LIQUIFACE,
ENERGYFACE
}
public Type type; public Type type;
public int range; public int range;
public BlockPhantom(Type type){ public BlockPhantom(Type type){
super(Material.rock); super(Material.rock);
this.type = type; this.type = type;
@ -65,7 +56,9 @@ public class BlockPhantom extends BlockContainerBase implements IActAddItemOrBlo
@Override @Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){ public void breakBlock(World world, int x, int y, int z, Block block, int par6){
if(this.type == Type.PLACER || this.type == Type.BREAKER) this.dropInventory(world, x, y, z); if(this.type == Type.PLACER || this.type == Type.BREAKER){
this.dropInventory(world, x, y, z);
}
super.breakBlock(world, x, y, z, block, par6); super.breakBlock(world, x, y, z, block, par6);
} }
@ -147,6 +140,14 @@ public class BlockPhantom extends BlockContainerBase implements IActAddItemOrBlo
} }
} }
public enum Type{
FACE,
PLACER,
BREAKER,
LIQUIFACE,
ENERGYFACE
}
public static class TheItemBlock extends ItemBlock{ public static class TheItemBlock extends ItemBlock{
private Block theBlock; private Block theBlock;

View file

@ -30,11 +30,11 @@ import java.util.Random;
public class BlockPlant extends BlockCrops implements IActAddItemOrBlock{ public class BlockPlant extends BlockCrops implements IActAddItemOrBlock{
private IIcon[] textures;
private String name;
public Item seedItem; public Item seedItem;
public Item returnItem; public Item returnItem;
public int returnMeta; public int returnMeta;
private IIcon[] textures;
private String name;
private int minDropAmount; private int minDropAmount;
private int addDropAmount; private int addDropAmount;
@ -59,7 +59,9 @@ public class BlockPlant extends BlockCrops implements IActAddItemOrBlock{
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta){ public IIcon getIcon(int side, int meta){
if(meta < 7){ if(meta < 7){
if(meta == 6) meta = 5; if(meta == 6){
meta = 5;
}
return this.textures[meta >> 1]; return this.textures[meta >> 1];
} }
else{ else{

View file

@ -62,8 +62,12 @@ public class BlockSlabs extends Block implements IActAddItemOrBlock{
@Override @Override
public int onBlockPlaced(World par1World, int blockX, int blockY, int blockZ, int side, float hitX, float hitY, float hitZ, int meta){ public int onBlockPlaced(World par1World, int blockX, int blockY, int blockZ, int side, float hitX, float hitY, float hitZ, int meta){
if(side == 1) return meta; if(side == 1){
if(side == 0 || hitY >= 0.5F) return meta+1; return meta;
}
if(side == 0 || hitY >= 0.5F){
return meta+1;
}
return meta; return meta;
} }

View file

@ -80,10 +80,18 @@ public class BlockSmileyCloud extends BlockContainerBase implements IActAddItemO
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
if(rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 2); if(rotation == 0){
if(rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 1, 2); world.setBlockMetadataWithNotify(x, y, z, 2, 2);
if(rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 0, 2); }
if(rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 3, 2); if(rotation == 1){
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
}
if(rotation == 2){
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
}
if(rotation == 3){
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
} }
@Override @Override

View file

@ -59,10 +59,18 @@ public class BlockTreasureChest extends Block implements IActAddItemOrBlock{
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
if(rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 0, 2); if(rotation == 0){
if(rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 3, 2); world.setBlockMetadataWithNotify(x, y, z, 0, 2);
if(rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 1, 2); }
if(rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 2); if(rotation == 1){
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if(rotation == 2){
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
}
if(rotation == 3){
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
} }
@Override @Override
@ -72,18 +80,30 @@ public class BlockTreasureChest extends Block implements IActAddItemOrBlock{
@Override @Override
public IIcon getIcon(int side, int meta){ public IIcon getIcon(int side, int meta){
if(side == 1) return this.topIcon; if(side == 1){
if(side == 0) return this.bottomIcon; return this.topIcon;
if(side == 3) return this.frontIcon; }
if(side == 0){
return this.bottomIcon;
}
if(side == 3){
return this.frontIcon;
}
return this.blockIcon; return this.blockIcon;
} }
@Override @Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
if(side == 1) return this.topIcon; if(side == 1){
if(side == meta+2) return this.frontIcon; return this.topIcon;
if(side == 0) return this.bottomIcon; }
if(side == meta+2){
return this.frontIcon;
}
if(side == 0){
return this.bottomIcon;
}
return this.blockIcon; return this.blockIcon;
} }

View file

@ -51,10 +51,18 @@ public class BlockXPSolidifier extends BlockContainerBase implements IActAddItem
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){ public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3; int rotation = MathHelper.floor_double((double)(player.rotationYaw*4.0F/360.0F)+0.5D) & 3;
if(rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 0, 2); if(rotation == 0){
if(rotation == 1) world.setBlockMetadataWithNotify(x, y, z, 3, 2); world.setBlockMetadataWithNotify(x, y, z, 0, 2);
if(rotation == 2) world.setBlockMetadataWithNotify(x, y, z, 1, 2); }
if(rotation == 3) world.setBlockMetadataWithNotify(x, y, z, 2, 2); if(rotation == 1){
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if(rotation == 2){
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
}
if(rotation == 3){
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
} }
@Override @Override
@ -64,16 +72,24 @@ public class BlockXPSolidifier extends BlockContainerBase implements IActAddItem
@Override @Override
public IIcon getIcon(int side, int meta){ public IIcon getIcon(int side, int meta){
if(side == 1 || side == 0) return this.topIcon; if(side == 1 || side == 0){
if(side == 3) return this.frontIcon; return this.topIcon;
}
if(side == 3){
return this.frontIcon;
}
return this.blockIcon; return this.blockIcon;
} }
@Override @Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){ public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
if(side == 1 || side == 0) return this.topIcon; if(side == 1 || side == 0){
if(side == meta+2) return this.frontIcon; return this.topIcon;
}
if(side == meta+2){
return this.frontIcon;
}
return this.blockIcon; return this.blockIcon;
} }

View file

@ -37,18 +37,20 @@ public enum TheColoredLampColors implements IActAddItemOrBlock{
this.name = name; this.name = name;
} }
@Override
public String getName(){
return name;
}
public static TheColoredLampColors getColorFromDyeName(String color){ public static TheColoredLampColors getColorFromDyeName(String color){
if(color.substring(0, 3).equals("dye")){ if(color.substring(0, 3).equals("dye")){
String actualName = color.substring(3); String actualName = color.substring(3);
for(int i = 0; i < values().length; i++){ for(int i = 0; i < values().length; i++){
if(values()[i].getName().equals(actualName)) return values()[i]; if(values()[i].getName().equals(actualName)){
return values()[i];
}
} }
} }
return null; return null;
} }
@Override
public String getName(){
return name;
}
} }

View file

@ -59,7 +59,9 @@ public class ModelCompost extends ModelBaseAA{
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
if(meta > 0 && meta <= ConfigIntValues.COMPOST_AMOUNT.getValue()){ if(meta > 0 && meta <= ConfigIntValues.COMPOST_AMOUNT.getValue()){
int heightToDisplay = meta*13/ConfigIntValues.COMPOST_AMOUNT.getValue(); int heightToDisplay = meta*13/ConfigIntValues.COMPOST_AMOUNT.getValue();
if(heightToDisplay > 13) heightToDisplay = 13; if(heightToDisplay > 13){
heightToDisplay = 13;
}
this.innerRawList[heightToDisplay-1].render(f); this.innerRawList[heightToDisplay-1].render(f);
} }

View file

@ -31,11 +31,6 @@ public class ModelSmileyCloud extends ModelBaseAA{
ModelRenderer s15; ModelRenderer s15;
ModelRenderer s16; ModelRenderer s16;
@Override
public boolean doesRotate(){
return true;
}
public ModelSmileyCloud(){ public ModelSmileyCloud(){
textureWidth = 64; textureWidth = 64;
textureHeight = 64; textureHeight = 64;
@ -138,6 +133,11 @@ public class ModelSmileyCloud extends ModelBaseAA{
setRotation(s16, 0F, 0F, 0F); setRotation(s16, 0F, 0F, 0F);
} }
@Override
public boolean doesRotate(){
return true;
}
@Override @Override
public void render(float f){ public void render(float f){
s1.render(f); s1.render(f);

View file

@ -31,12 +31,16 @@ public class RenderSmileyCloud extends RenderTileEntity{
@Override @Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
if(!(tile instanceof TileEntitySmileyCloud)) return; if(!(tile instanceof TileEntitySmileyCloud)){
return;
}
TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile; TileEntitySmileyCloud theCloud = (TileEntitySmileyCloud)tile;
GL11.glPushMatrix(); GL11.glPushMatrix();
{ {
if(theCloud.flyHeight == 0) theCloud.flyHeight = new Random().nextInt(30)+30; if(theCloud.flyHeight == 0){
theCloud.flyHeight = new Random().nextInt(30)+30;
}
int bobHeight = theCloud.flyHeight; int bobHeight = theCloud.flyHeight;
long theTime = Minecraft.getSystemTime(); long theTime = Minecraft.getSystemTime();
long time = theTime/50; long time = theTime/50;
@ -60,9 +64,15 @@ public class RenderSmileyCloud extends RenderTileEntity{
{ {
if(theModel.doesRotate()){ if(theModel.doesRotate()){
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
if(meta == 0) GL11.glRotatef(180F, 0F, 1F, 0F); if(meta == 0){
if(meta == 1) GL11.glRotatef(90F, 0F, 1F, 0F); GL11.glRotatef(180F, 0F, 1F, 0F);
if(meta == 3) GL11.glRotatef(270F, 0F, 1F, 0F); }
if(meta == 1){
GL11.glRotatef(90F, 0F, 1F, 0F);
}
if(meta == 3){
GL11.glRotatef(270F, 0F, 1F, 0F);
}
} }
this.bindTexture(resLoc); this.bindTexture(resLoc);
@ -79,7 +89,9 @@ public class RenderSmileyCloud extends RenderTileEntity{
break; break;
} }
} }
if(canBreak) break; if(canBreak){
break;
}
} }
} }
} }

View file

@ -36,9 +36,15 @@ public class RenderTileEntity extends TileEntitySpecialRenderer{
if(theModel.doesRotate()){ if(theModel.doesRotate()){
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord); int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
if(meta == 0) GL11.glRotatef(180F, 0F, 1F, 0F); if(meta == 0){
if(meta == 1) GL11.glRotatef(90F, 0F, 1F, 0F); GL11.glRotatef(180F, 0F, 1F, 0F);
if(meta == 3) GL11.glRotatef(270F, 0F, 1F, 0F); }
if(meta == 1){
GL11.glRotatef(90F, 0F, 1F, 0F);
}
if(meta == 3){
GL11.glRotatef(270F, 0F, 1F, 0F);
}
} }
theModel.render(0.0625F); theModel.render(0.0625F);

View file

@ -18,9 +18,9 @@ import net.minecraft.item.ItemStack;
public class BookletChapter{ public class BookletChapter{
public final BookletPage[] pages; public final BookletPage[] pages;
private final String unlocalizedName;
public final BookletIndexEntry entry; public final BookletIndexEntry entry;
public final ItemStack displayStack; public final ItemStack displayStack;
private final String unlocalizedName;
public BookletChapter(String unlocalizedName, BookletIndexEntry entry, ItemStack displayStack, BookletPage... pages){ public BookletChapter(String unlocalizedName, BookletIndexEntry entry, ItemStack displayStack, BookletPage... pages){
this.pages = pages.clone(); this.pages = pages.clone();

View file

@ -38,39 +38,29 @@ import java.util.List;
public class GuiBooklet extends GuiScreen{ public class GuiBooklet extends GuiScreen{
public static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBooklet"); public static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBooklet");
public static final int CHAPTER_BUTTONS_AMOUNT = 13;
public static final int TOOLTIP_SPLIT_LENGTH = 200;
public FontRenderer unicodeRenderer; public FontRenderer unicodeRenderer;
public int xSize; public int xSize;
public int ySize; public int ySize;
public int guiLeft; public int guiLeft;
public int guiTop; public int guiTop;
public BookletPage currentPage; public BookletPage currentPage;
public BookletChapter currentChapter; public BookletChapter currentChapter;
public BookletIndexEntry currentIndexEntry; public BookletIndexEntry currentIndexEntry;
public int pageOpenInIndex; public int pageOpenInIndex;
public int indexPageAmount; public int indexPageAmount;
private GuiTextField searchField;
public GuiButton buttonForward; public GuiButton buttonForward;
public GuiButton buttonBackward; public GuiButton buttonBackward;
public GuiButton buttonPreviousScreen; public GuiButton buttonPreviousScreen;
public GuiButton buttonPreviouslyOpenedGui; public GuiButton buttonPreviouslyOpenedGui;
public GuiButton buttonUpdate; public GuiButton buttonUpdate;
public GuiButton buttonTwitter; public GuiButton buttonTwitter;
public GuiButton buttonForum; public GuiButton buttonForum;
public GuiButton buttonAchievements; public GuiButton buttonAchievements;
public GuiButton buttonConfig; public GuiButton buttonConfig;
public static final int CHAPTER_BUTTONS_AMOUNT = 13;
public GuiButton[] chapterButtons = new GuiButton[CHAPTER_BUTTONS_AMOUNT]; public GuiButton[] chapterButtons = new GuiButton[CHAPTER_BUTTONS_AMOUNT];
private GuiTextField searchField;
public static final int TOOLTIP_SPLIT_LENGTH = 200;
private int ticksElapsed; private int ticksElapsed;
private boolean mouseClicked; private boolean mouseClicked;
@ -303,7 +293,9 @@ public class GuiBooklet extends GuiScreen{
} }
} }
if(this.mouseClicked) this.mouseClicked = false; if(this.mouseClicked){
this.mouseClicked = false;
}
} }
private boolean isGimmicky(){ private boolean isGimmicky(){
@ -381,7 +373,9 @@ public class GuiBooklet extends GuiScreen{
if(this.currentIndexEntry != null){ if(this.currentIndexEntry != null){
if(this.currentPage != null){ if(this.currentPage != null){
BookletPage page = this.getNextPage(this.currentChapter, this.currentPage); BookletPage page = this.getNextPage(this.currentChapter, this.currentPage);
if(page != null) this.currentPage = page; if(page != null){
this.currentPage = page;
}
this.buttonForward.visible = this.getNextPage(this.currentChapter, this.currentPage) != null; this.buttonForward.visible = this.getNextPage(this.currentChapter, this.currentPage) != null;
this.buttonBackward.visible = this.getPrevPage(this.currentChapter, this.currentPage) != null; this.buttonBackward.visible = this.getPrevPage(this.currentChapter, this.currentPage) != null;
@ -395,7 +389,9 @@ public class GuiBooklet extends GuiScreen{
if(this.currentIndexEntry != null){ if(this.currentIndexEntry != null){
if(this.currentPage != null){ if(this.currentPage != null){
BookletPage page = this.getPrevPage(this.currentChapter, this.currentPage); BookletPage page = this.getPrevPage(this.currentChapter, this.currentPage);
if(page != null) this.currentPage = page; if(page != null){
this.currentPage = page;
}
this.buttonForward.visible = this.getNextPage(this.currentChapter, this.currentPage) != null; this.buttonForward.visible = this.getNextPage(this.currentChapter, this.currentPage) != null;
this.buttonBackward.visible = this.getPrevPage(this.currentChapter, this.currentPage) != null; this.buttonBackward.visible = this.getPrevPage(this.currentChapter, this.currentPage) != null;
@ -479,7 +475,9 @@ public class GuiBooklet extends GuiScreen{
} }
public void openChapter(BookletChapter chapter, BookletPage page){ public void openChapter(BookletChapter chapter, BookletPage page){
if(chapter == null) return; if(chapter == null){
return;
}
this.searchField.setVisible(false); this.searchField.setVisible(false);
this.searchField.setFocused(false); this.searchField.setFocused(false);
@ -509,8 +507,8 @@ public class GuiBooklet extends GuiScreen{
private static class IndexButton extends GuiButton{ private static class IndexButton extends GuiButton{
private GuiBooklet gui;
public BookletChapter chap; public BookletChapter chap;
private GuiBooklet gui;
public IndexButton(int id, int x, int y, int width, int height, String text, GuiBooklet gui){ public IndexButton(int id, int x, int y, int width, int height, String text, GuiBooklet gui){
super(id, x, y, width, height, text); super(id, x, y, width, height, text);
@ -569,7 +567,9 @@ public class GuiBooklet extends GuiScreen{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height; this.field_146123_n = x >= this.xPosition && y >= this.yPosition && x < this.xPosition+this.width && y < this.yPosition+this.height;
int k = this.getHoverState(this.field_146123_n); int k = this.getHoverState(this.field_146123_n);
if(k == 0) k = 1; if(k == 0){
k = 1;
}
GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0); OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

View file

@ -32,16 +32,33 @@ import java.util.Map;
public class BookletPage{ public class BookletPage{
private HashMap<String, String> textReplacements = new HashMap<String, String>();
protected int id; protected int id;
protected BookletChapter chapter; protected BookletChapter chapter;
private HashMap<String, String> textReplacements = new HashMap<String, String>();
private boolean hasNoText; private boolean hasNoText;
public BookletPage(int id){ public BookletPage(int id){
this.id = id; this.id = id;
} }
public static void renderItem(GuiBooklet gui, ItemStack stack, int x, int y, float scale){
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
GL11.glTranslated(x, y, 0);
GL11.glScalef(scale, scale, scale);
RenderItem.getInstance().renderItemAndEffectIntoGUI(gui.unicodeRenderer, gui.mc.getTextureManager(), stack, 0, 0);
RenderItem.getInstance().renderItemOverlayIntoGUI(gui.mc.fontRenderer, gui.mc.getTextureManager(), stack, 0, 0);
GL11.glPopMatrix();
RenderHelper.disableStandardItemLighting();
GL11.glPopMatrix();
}
public BookletPage setNoText(){ public BookletPage setNoText(){
this.hasNoText = true; this.hasNoText = true;
return this; return this;
@ -51,14 +68,14 @@ public class BookletPage{
return this.id; return this.id;
} }
public void setChapter(BookletChapter chapter){
this.chapter = chapter;
}
public BookletChapter getChapter(){ public BookletChapter getChapter(){
return this.chapter; return this.chapter;
} }
public void setChapter(BookletChapter chapter){
this.chapter = chapter;
}
public final String getText(){ public final String getText(){
if(this.hasNoText){ if(this.hasNoText){
return null; return null;
@ -128,22 +145,4 @@ public class BookletPage{
gui.drawHoveringText(list, x, y); gui.drawHoveringText(list, x, y);
} }
public static void renderItem(GuiBooklet gui, ItemStack stack, int x, int y, float scale){
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.enableGUIStandardItemLighting();
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
GL11.glTranslated(x, y, 0);
GL11.glScalef(scale, scale, scale);
RenderItem.getInstance().renderItemAndEffectIntoGUI(gui.unicodeRenderer, gui.mc.getTextureManager(), stack, 0, 0);
RenderItem.getInstance().renderItemOverlayIntoGUI(gui.mc.fontRenderer, gui.mc.getTextureManager(), stack, 0, 0);
GL11.glPopMatrix();
RenderHelper.disableStandardItemLighting();
GL11.glPopMatrix();
}
} }

View file

@ -78,7 +78,9 @@ public class PageCoffeeRecipe extends BookletPage{
} }
if(stack != null){ if(stack != null){
if(stack.getItemDamage() == Util.WILDCARD) stack.setItemDamage(0); if(stack.getItemDamage() == Util.WILDCARD){
stack.setItemDamage(0);
}
boolean tooltip = i == 1; boolean tooltip = i == 1;

View file

@ -136,7 +136,9 @@ public class PageCrafting extends BookletPage{
for(int y = 0; y < height; y++){ for(int y = 0; y < height; y++){
ItemStack stack = stacks[y*width+x]; ItemStack stack = stacks[y*width+x];
if(stack != null){ if(stack != null){
if(stack.getItemDamage() == Util.WILDCARD) stack.setItemDamage(0); if(stack.getItemDamage() == Util.WILDCARD){
stack.setItemDamage(0);
}
int xShow = gui.guiLeft+27+4+x*18; int xShow = gui.guiLeft+27+4+x*18;
int yShow = gui.guiTop+20+4+y*18; int yShow = gui.guiTop+20+4+y*18;
if(!tooltip){ if(!tooltip){

View file

@ -68,7 +68,9 @@ public class PageCrusherRecipe extends BookletPage{
ItemStack stack = (j == 0 ? this.recipe.input : (j == 1 ? recipe.firstOutput : (j == 2 ? recipe.secondOutput : null))); ItemStack stack = (j == 0 ? this.recipe.input : (j == 1 ? recipe.firstOutput : (j == 2 ? recipe.secondOutput : null)));
if(stack != null){ if(stack != null){
if(stack.getItemDamage() == Util.WILDCARD) stack.setItemDamage(0); if(stack.getItemDamage() == Util.WILDCARD){
stack.setItemDamage(0);
}
boolean tooltip = i == 1; boolean tooltip = i == 1;

View file

@ -71,7 +71,9 @@ public class PageFurnace extends BookletPage{
for(int i = 0; i < 2; i++){ for(int i = 0; i < 2; i++){
for(int x = 0; x < 2; x++){ for(int x = 0; x < 2; x++){
ItemStack stack = x == 0 ? input : this.result; ItemStack stack = x == 0 ? input : this.result;
if(stack.getItemDamage() == Util.WILDCARD) stack.setItemDamage(0); if(stack.getItemDamage() == Util.WILDCARD){
stack.setItemDamage(0);
}
boolean tooltip = i == 1; boolean tooltip = i == 1;
int xShow = gui.guiLeft+37+1+x*42; int xShow = gui.guiLeft+37+1+x*42;
@ -92,7 +94,9 @@ public class PageFurnace extends BookletPage{
private ItemStack getInputForOutput(ItemStack output){ private ItemStack getInputForOutput(ItemStack output){
for(Object o : FurnaceRecipes.smelting().getSmeltingList().entrySet()){ for(Object o : FurnaceRecipes.smelting().getSmeltingList().entrySet()){
ItemStack stack = (ItemStack)((Map.Entry)o).getValue(); ItemStack stack = (ItemStack)((Map.Entry)o).getValue();
if(stack.isItemEqual(output)) return (ItemStack)((Map.Entry)o).getKey(); if(stack.isItemEqual(output)){
return (ItemStack)((Map.Entry)o).getKey();
}
} }
return null; return null;
} }

View file

@ -487,7 +487,9 @@ public class ItemCrafting{
private static boolean isBlacklisted(Object item){ private static boolean isBlacklisted(Object item){
for(String except : ConfigValues.mashedFoodCraftingExceptions){ for(String except : ConfigValues.mashedFoodCraftingExceptions){
if(Item.itemRegistry.getNameForObject(item).equals(except)) return true; if(Item.itemRegistry.getNameForObject(item).equals(except)){
return true;
}
} }
return false; return false;
} }

View file

@ -25,6 +25,19 @@ import net.minecraft.item.ItemStack;
public class CraftEvent{ public class CraftEvent{
public static void checkAchievements(ItemStack gotten, EntityPlayer player, int type){
for(int i = 0; i < TheAchievements.values().length; i++){
TheAchievements ach = TheAchievements.values()[i];
if(ach.type == type){
if(gotten != null && ach.ach.theItemStack != null && gotten.getItem() == ach.ach.theItemStack.getItem()){
if(gotten.getItemDamage() == ach.ach.theItemStack.getItemDamage()){
player.addStat(ach.ach, 1);
}
}
}
}
}
@SubscribeEvent @SubscribeEvent
public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){ public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){
checkAchievements(event.crafting, event.player, InitAchievements.CRAFTING_ACH); checkAchievements(event.crafting, event.player, InitAchievements.CRAFTING_ACH);
@ -42,17 +55,4 @@ public class CraftEvent{
} }
} }
} }
public static void checkAchievements(ItemStack gotten, EntityPlayer player, int type){
for(int i = 0; i < TheAchievements.values().length; i++){
TheAchievements ach = TheAchievements.values()[i];
if(ach.type == type){
if(gotten != null && ach.ach.theItemStack != null && gotten.getItem() == ach.ach.theItemStack.getItem()){
if(gotten.getItemDamage() == ach.ach.theItemStack.getItemDamage()){
player.addStat(ach.ach, 1);
}
}
}
}
}
} }

View file

@ -23,11 +23,11 @@ import java.util.UUID;
public class RenderPlayerEventAA{ public class RenderPlayerEventAA{
public static RenderSpecial lariRender = new RenderSpecial(null);
private static RenderSpecial ellpeckRender = new RenderSpecial(new ItemStack(InitItems.itemPhantomConnector)); private static RenderSpecial ellpeckRender = new RenderSpecial(new ItemStack(InitItems.itemPhantomConnector));
private static RenderSpecial hoseRender = new RenderSpecial(new ItemStack(Blocks.torch)); private static RenderSpecial hoseRender = new RenderSpecial(new ItemStack(Blocks.torch));
private static RenderSpecial paktoRender = new RenderSpecial(new ItemStack(Blocks.wool, 1, 6)); private static RenderSpecial paktoRender = new RenderSpecial(new ItemStack(Blocks.wool, 1, 6));
private static RenderSpecial glenRender = new RenderSpecial(new ItemStack(InitBlocks.blockHeatCollector)); private static RenderSpecial glenRender = new RenderSpecial(new ItemStack(InitBlocks.blockHeatCollector));
public static RenderSpecial lariRender = new RenderSpecial(null);
@SubscribeEvent(priority = EventPriority.HIGHEST) @SubscribeEvent(priority = EventPriority.HIGHEST)
public void RenderPlayerEvent(RenderPlayerEvent.Specials.Pre event){ public void RenderPlayerEvent(RenderPlayerEvent.Specials.Pre event){

View file

@ -24,18 +24,18 @@ import org.lwjgl.opengl.GL11;
public class RenderSpecial{ public class RenderSpecial{
private double lastTimeForBobbing;
private ItemStack theThingToRender;
private static final ResourceLocation squidTextures = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/specialSquid.png"); private static final ResourceLocation squidTextures = new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/specialSquid.png");
private double lastTimeForBobbing;
private ItemStack theThingToRender;
public RenderSpecial(ItemStack stack){ public RenderSpecial(ItemStack stack){
this.theThingToRender = stack; this.theThingToRender = stack;
} }
public void render(EntityPlayer player, float size, float offsetUp){ public void render(EntityPlayer player, float size, float offsetUp){
if(player.isInvisible() || player.getHideCape()) return; if(player.isInvisible() || player.getHideCape()){
return;
}
int bobHeight = 70; int bobHeight = 70;
long theTime = Minecraft.getSystemTime(); long theTime = Minecraft.getSystemTime();

View file

@ -56,7 +56,9 @@ public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHa
wantsTwo.stackSize = MathHelper.getRandomIntegerInRange(rand, trades.get(k).minStackSize, trades.get(k).maxStackSize); wantsTwo.stackSize = MathHelper.getRandomIntegerInRange(rand, trades.get(k).minStackSize, trades.get(k).maxStackSize);
} }
} }
if(wantsOne == wantsTwo) wantsTwo = null; if(wantsOne == wantsTwo){
wantsTwo = null;
}
for(int k = 0; k < TheJams.values().length; k++){ for(int k = 0; k < TheJams.values().length; k++){
recipeList.add(new MerchantRecipe(wantsOne, wantsTwo, new ItemStack(InitItems.itemJams, rand.nextInt(3)+1, k))); recipeList.add(new MerchantRecipe(wantsOne, wantsTwo, new ItemStack(InitItems.itemJams, rand.nextInt(3)+1, k)));

View file

@ -29,9 +29,16 @@ import java.util.Random;
public class OreGen implements IWorldGenerator{ public class OreGen implements IWorldGenerator{
public static void init(){
ModUtil.LOGGER.info("Registering World Generator...");
GameRegistry.registerWorldGenerator(new OreGen(), 10);
}
@Override @Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
if(world.provider.terrainType == WorldType.FLAT) return; if(world.provider.terrainType == WorldType.FLAT){
return;
}
switch(world.provider.dimensionId){ switch(world.provider.dimensionId){
case -1: case -1:
@ -75,9 +82,4 @@ public class OreGen implements IWorldGenerator{
ModUtil.LOGGER.fatal("Couldn't generate '"+block.getUnlocalizedName()+"' into the world because the Min Y coordinate is bigger than the Max! This is definitely a Config Error! Check the Files!"); ModUtil.LOGGER.fatal("Couldn't generate '"+block.getUnlocalizedName()+"' into the world because the Min Y coordinate is bigger than the Max! This is definitely a Config Error! Check the Files!");
} }
} }
public static void init(){
ModUtil.LOGGER.info("Registering World Generator...");
GameRegistry.registerWorldGenerator(new OreGen(), 10);
}
} }

View file

@ -49,7 +49,9 @@ public class VillageComponentCustomCropField extends StructureVillagePieces.Hous
public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb){ public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb){
if(this.averageGroundLevel < 0){ if(this.averageGroundLevel < 0){
this.averageGroundLevel = this.getAverageGroundLevel(world, sbb); this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
if(this.averageGroundLevel < 0) return true; if(this.averageGroundLevel < 0){
return true;
}
this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0); this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0);
} }

View file

@ -52,7 +52,9 @@ public class VillageComponentJamHouse extends StructureVillagePieces.House1{
public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb){ public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb){
if(this.averageGroundLevel < 0){ if(this.averageGroundLevel < 0){
this.averageGroundLevel = this.getAverageGroundLevel(world, sbb); this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
if(this.averageGroundLevel < 0) return true; if(this.averageGroundLevel < 0){
return true;
}
this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0); this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize-1, 0);
} }

View file

@ -67,14 +67,18 @@ public class ContainerBreaker extends Container{
if(!this.mergeItemStack(newStack, 0, 9, false)){ if(!this.mergeItemStack(newStack, 0, 9, false)){
// //
if(slot >= inventoryStart && slot <= inventoryEnd){ if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -83,7 +87,9 @@ public class ContainerBreaker extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -69,21 +69,29 @@ public class ContainerCanolaPress extends Container{
if(slot >= inventoryStart){ if(slot >= inventoryStart){
//Shift from Inventory //Shift from Inventory
if(newStack.getItem() == InitItems.itemMisc && newStack.getItemDamage() == TheMiscItems.CANOLA.ordinal()){ if(newStack.getItem() == InitItems.itemMisc && newStack.getItemDamage() == TheMiscItems.CANOLA.ordinal()){
if(!this.mergeItemStack(newStack, 0, 1, false)) return null; if(!this.mergeItemStack(newStack, 0, 1, false)){
return null;
}
} }
else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitBlocks.fluidCanolaOil, 1), newStack) > 0){ else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitBlocks.fluidCanolaOil, 1), newStack) > 0){
if(!this.mergeItemStack(newStack, 1, 2, false)) return null; if(!this.mergeItemStack(newStack, 1, 2, false)){
return null;
}
} }
// //
else if(slot >= inventoryStart && slot <= inventoryEnd){ else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -92,7 +100,9 @@ public class ContainerCanolaPress extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -62,18 +62,24 @@ public class ContainerCoalGenerator extends Container{
if(slot >= inventoryStart){ if(slot >= inventoryStart){
//Shift from Inventory //Shift from Inventory
if(TileEntityFurnace.getItemBurnTime(newStack) > 0){ if(TileEntityFurnace.getItemBurnTime(newStack) > 0){
if(!this.mergeItemStack(newStack, 0, 1, false)) return null; if(!this.mergeItemStack(newStack, 0, 1, false)){
return null;
}
} }
// //
else if(slot >= inventoryStart && slot <= inventoryEnd){ else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -82,7 +88,9 @@ public class ContainerCoalGenerator extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -77,7 +77,9 @@ public class ContainerCoffeeMachine extends Container{
//Slots in Inventory to shift from //Slots in Inventory to shift from
if(slot == TileEntityCoffeeMachine.SLOT_OUTPUT){ if(slot == TileEntityCoffeeMachine.SLOT_OUTPUT){
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null; if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){
return null;
}
theSlot.onSlotChange(newStack, currentStack); theSlot.onSlotChange(newStack, currentStack);
} }
//Other Slots in Inventory excluded //Other Slots in Inventory excluded
@ -94,7 +96,9 @@ public class ContainerCoffeeMachine extends Container{
} }
} }
else if(ItemCoffee.getIngredientFromStack(newStack) != null){ else if(ItemCoffee.getIngredientFromStack(newStack) != null){
if(!this.mergeItemStack(newStack, 3, 11, false)) return null; if(!this.mergeItemStack(newStack, 3, 11, false)){
return null;
}
} }
else if(newStack.getItem() == InitItems.itemCoffeeBean){ else if(newStack.getItem() == InitItems.itemCoffeeBean){
if(!this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS+1, false)){ if(!this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS+1, false)){
@ -104,13 +108,17 @@ public class ContainerCoffeeMachine extends Container{
// //
else if(slot >= inventoryStart && slot <= inventoryEnd){ else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -119,7 +127,9 @@ public class ContainerCoffeeMachine extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -21,13 +21,12 @@ import net.minecraft.world.World;
@InventoryContainer @InventoryContainer
public class ContainerCrafter extends Container{ public class ContainerCrafter extends Container{
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
public IInventory craftResult = new InventoryCraftResult();
public final int x; public final int x;
public final int y; public final int y;
public final int z; public final int z;
public final World world; public final World world;
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);
public IInventory craftResult = new InventoryCraftResult();
public ContainerCrafter(EntityPlayer player){ public ContainerCrafter(EntityPlayer player){
InventoryPlayer inventory = player.inventory; InventoryPlayer inventory = player.inventory;
@ -68,7 +67,9 @@ public class ContainerCrafter extends Container{
if(!this.world.isRemote){ if(!this.world.isRemote){
for(int i = 0; i < 9; ++i){ for(int i = 0; i < 9; ++i){
ItemStack stack = this.craftMatrix.getStackInSlotOnClosing(i); ItemStack stack = this.craftMatrix.getStackInSlotOnClosing(i);
if(stack != null) player.dropPlayerItemWithRandomChoice(stack, false); if(stack != null){
player.dropPlayerItemWithRandomChoice(stack, false);
}
} }
} }
} }
@ -88,7 +89,9 @@ public class ContainerCrafter extends Container{
stack = savedStack.copy(); stack = savedStack.copy();
if(slot == 0){ if(slot == 0){
if(!this.mergeItemStack(savedStack, 10, 46, true)) return null; if(!this.mergeItemStack(savedStack, 10, 46, true)){
return null;
}
theSlot.onSlotChange(savedStack, stack); theSlot.onSlotChange(savedStack, stack);
} }
else if(slot >= 10 && slot < 37 && !this.mergeItemStack(savedStack, 37, 46, false)){ else if(slot >= 10 && slot < 37 && !this.mergeItemStack(savedStack, 37, 46, false)){
@ -97,7 +100,9 @@ public class ContainerCrafter extends Container{
else if(slot >= 37 && slot < 46 && !this.mergeItemStack(savedStack, 10, 37, false)){ else if(slot >= 37 && slot < 46 && !this.mergeItemStack(savedStack, 10, 37, false)){
return null; return null;
} }
else if(!this.mergeItemStack(savedStack, 10, 46, false)) return null; else if(!this.mergeItemStack(savedStack, 10, 46, false)){
return null;
}
if(savedStack.stackSize == 0){ if(savedStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -106,7 +111,9 @@ public class ContainerCrafter extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(savedStack.stackSize == stack.stackSize) return null; if(savedStack.stackSize == stack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, savedStack); theSlot.onPickupFromSlot(player, savedStack);
} }

View file

@ -59,7 +59,9 @@ public class ContainerDrill extends Container{
ItemStack stack = inventory.getCurrentItem(); ItemStack stack = inventory.getCurrentItem();
if(stack != null && stack.getItem() instanceof ItemDrill){ if(stack != null && stack.getItem() instanceof ItemDrill){
ItemStack[] slots = ((ItemDrill)stack.getItem()).getSlotsFromNBT(inventory.getCurrentItem()); ItemStack[] slots = ((ItemDrill)stack.getItem()).getSlotsFromNBT(inventory.getCurrentItem());
if(slots != null && slots.length > 0) this.drillInventory.slots = slots; if(slots != null && slots.length > 0){
this.drillInventory.slots = slots;
}
} }
} }
@ -106,18 +108,24 @@ public class ContainerDrill extends Container{
if(slot >= inventoryStart){ if(slot >= inventoryStart){
//Shift from Inventory //Shift from Inventory
if(newStack.getItem() instanceof ItemDrillUpgrade || newStack.getItem() instanceof IEnergyContainerItem){ if(newStack.getItem() instanceof ItemDrillUpgrade || newStack.getItem() instanceof IEnergyContainerItem){
if(!this.mergeItemStack(newStack, 0, 5, false)) return null; if(!this.mergeItemStack(newStack, 0, 5, false)){
return null;
}
} }
// //
else if(slot >= inventoryStart && slot <= inventoryEnd){ else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -126,7 +134,9 @@ public class ContainerDrill extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;
@ -214,7 +224,9 @@ public class ContainerDrill extends Container{
} }
else{ else{
stackAt = slots[i].splitStack(j); stackAt = slots[i].splitStack(j);
if(slots[i].stackSize == 0) slots[i] = null; if(slots[i].stackSize == 0){
slots[i] = null;
}
this.markDirty(); this.markDirty();
return stackAt; return stackAt;
} }

View file

@ -67,14 +67,18 @@ public class ContainerDropper extends Container{
if(!this.mergeItemStack(newStack, 0, 9, false)){ if(!this.mergeItemStack(newStack, 0, 9, false)){
// //
if(slot >= inventoryStart && slot <= inventoryEnd){ if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -83,7 +87,9 @@ public class ContainerDropper extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -88,25 +88,33 @@ public class ContainerEnergizer extends Container{
//Slots in Inventory to shift from //Slots in Inventory to shift from
if(slot == 1){ if(slot == 1){
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null; if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){
return null;
}
theSlot.onSlotChange(newStack, currentStack); theSlot.onSlotChange(newStack, currentStack);
} }
//Other Slots in Inventory excluded //Other Slots in Inventory excluded
else if(slot >= inventoryStart){ else if(slot >= inventoryStart){
//Shift from Inventory //Shift from Inventory
if(newStack.getItem() instanceof IEnergyContainerItem){ if(newStack.getItem() instanceof IEnergyContainerItem){
if(!this.mergeItemStack(newStack, 0, 1, false)) return null; if(!this.mergeItemStack(newStack, 0, 1, false)){
return null;
}
} }
// //
else if(slot >= inventoryStart && slot <= inventoryEnd){ else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -115,7 +123,9 @@ public class ContainerEnergizer extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -88,25 +88,33 @@ public class ContainerEnervator extends Container{
//Slots in Inventory to shift from //Slots in Inventory to shift from
if(slot == 1){ if(slot == 1){
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null; if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){
return null;
}
theSlot.onSlotChange(newStack, currentStack); theSlot.onSlotChange(newStack, currentStack);
} }
//Other Slots in Inventory excluded //Other Slots in Inventory excluded
else if(slot >= inventoryStart){ else if(slot >= inventoryStart){
//Shift from Inventory //Shift from Inventory
if(newStack.getItem() instanceof IEnergyContainerItem){ if(newStack.getItem() instanceof IEnergyContainerItem){
if(!this.mergeItemStack(newStack, 0, 1, false)) return null; if(!this.mergeItemStack(newStack, 0, 1, false)){
return null;
}
} }
// //
else if(slot >= inventoryStart && slot <= inventoryEnd){ else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -115,7 +123,9 @@ public class ContainerEnervator extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -62,14 +62,18 @@ public class ContainerFeeder extends Container{
if(!this.mergeItemStack(newStack, 0, 1, false)){ if(!this.mergeItemStack(newStack, 0, 1, false)){
// //
if(slot >= inventoryStart && slot <= inventoryEnd){ if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -78,7 +82,9 @@ public class ContainerFeeder extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -68,21 +68,29 @@ public class ContainerFermentingBarrel extends Container{
if(slot >= inventoryStart){ if(slot >= inventoryStart){
//Shift from Inventory //Shift from Inventory
if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitBlocks.fluidCanolaOil, 1))){ if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitBlocks.fluidCanolaOil, 1))){
if(!this.mergeItemStack(newStack, 0, 1, false)) return null; if(!this.mergeItemStack(newStack, 0, 1, false)){
return null;
}
} }
else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitBlocks.fluidOil, 1), newStack) > 0){ else if(FluidContainerRegistry.getContainerCapacity(new FluidStack(InitBlocks.fluidOil, 1), newStack) > 0){
if(!this.mergeItemStack(newStack, 2, 3, false)) return null; if(!this.mergeItemStack(newStack, 2, 3, false)){
return null;
}
} }
// //
else if(slot >= inventoryStart && slot <= inventoryEnd){ else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -91,7 +99,9 @@ public class ContainerFermentingBarrel extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -62,25 +62,33 @@ public class ContainerFluidCollector extends Container{
//Slots in Inventory to shift from //Slots in Inventory to shift from
if(slot == 1){ if(slot == 1){
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null; if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){
return null;
}
theSlot.onSlotChange(newStack, currentStack); theSlot.onSlotChange(newStack, currentStack);
} }
//Other Slots in Inventory excluded //Other Slots in Inventory excluded
else if(slot >= inventoryStart){ else if(slot >= inventoryStart){
//Shift from Inventory //Shift from Inventory
if(FluidContainerRegistry.isEmptyContainer(newStack)){ if(FluidContainerRegistry.isEmptyContainer(newStack)){
if(!this.mergeItemStack(newStack, 0, 1, false)) return null; if(!this.mergeItemStack(newStack, 0, 1, false)){
return null;
}
} }
// //
else if(slot >= inventoryStart && slot <= inventoryEnd){ else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -89,7 +97,9 @@ public class ContainerFluidCollector extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -64,7 +64,9 @@ public class ContainerFurnaceDouble extends Container{
//Slots in Inventory to shift from //Slots in Inventory to shift from
if(slot == TileEntityFurnaceDouble.SLOT_OUTPUT_1 || slot == TileEntityFurnaceDouble.SLOT_OUTPUT_2){ if(slot == TileEntityFurnaceDouble.SLOT_OUTPUT_1 || slot == TileEntityFurnaceDouble.SLOT_OUTPUT_2){
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null; if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){
return null;
}
theSlot.onSlotChange(newStack, currentStack); theSlot.onSlotChange(newStack, currentStack);
} }
//Other Slots in Inventory excluded //Other Slots in Inventory excluded
@ -80,13 +82,17 @@ public class ContainerFurnaceDouble extends Container{
// //
else if(slot >= inventoryStart && slot <= inventoryEnd){ else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -95,7 +101,9 @@ public class ContainerFurnaceDouble extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -67,14 +67,18 @@ public class ContainerGiantChest extends Container{
if(!this.mergeItemStack(newStack, 0, 117, false)){ if(!this.mergeItemStack(newStack, 0, 117, false)){
// //
if(slot >= inventoryStart && slot <= inventoryEnd){ if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -83,7 +87,9 @@ public class ContainerGiantChest extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -70,7 +70,9 @@ public class ContainerGrinder extends Container{
//Slots in Inventory to shift from //Slots in Inventory to shift from
if(slot == TileEntityGrinder.SLOT_OUTPUT_1_1 || slot == TileEntityGrinder.SLOT_OUTPUT_1_2 || (this.isDouble && (slot == TileEntityGrinder.SLOT_OUTPUT_2_1 || slot == TileEntityGrinder.SLOT_OUTPUT_2_2))){ if(slot == TileEntityGrinder.SLOT_OUTPUT_1_1 || slot == TileEntityGrinder.SLOT_OUTPUT_1_2 || (this.isDouble && (slot == TileEntityGrinder.SLOT_OUTPUT_2_1 || slot == TileEntityGrinder.SLOT_OUTPUT_2_2))){
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)) return null; if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){
return null;
}
theSlot.onSlotChange(newStack, currentStack); theSlot.onSlotChange(newStack, currentStack);
} }
//Other Slots in Inventory excluded //Other Slots in Inventory excluded
@ -91,13 +93,17 @@ public class ContainerGrinder extends Container{
// //
else if(slot >= inventoryStart && slot <= inventoryEnd){ else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -106,7 +112,9 @@ public class ContainerGrinder extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -89,14 +89,18 @@ public class ContainerInputter extends Container{
if(!this.mergeItemStack(newStack, 0, 1, false)){ if(!this.mergeItemStack(newStack, 0, 1, false)){
// //
if(slot >= inventoryStart && slot <= inventoryEnd){ if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -105,7 +109,9 @@ public class ContainerInputter extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -66,18 +66,24 @@ public class ContainerOilGenerator extends Container{
if(slot >= inventoryStart){ if(slot >= inventoryStart){
//Shift from Inventory //Shift from Inventory
if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitBlocks.fluidOil, 1))){ if(FluidContainerRegistry.containsFluid(newStack, new FluidStack(InitBlocks.fluidOil, 1))){
if(!this.mergeItemStack(newStack, 0, 1, false)) return null; if(!this.mergeItemStack(newStack, 0, 1, false)){
return null;
}
} }
// //
else if(slot >= inventoryStart && slot <= inventoryEnd){ else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -86,7 +92,9 @@ public class ContainerOilGenerator extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -75,13 +75,17 @@ public class ContainerOreMagnet extends Container{
// //
else if(slot >= inventoryStart && slot <= inventoryEnd){ else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -90,7 +94,9 @@ public class ContainerOreMagnet extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -67,14 +67,18 @@ public class ContainerPhantomPlacer extends Container{
if(!this.mergeItemStack(newStack, 0, 9, false)){ if(!this.mergeItemStack(newStack, 0, 9, false)){
// //
if(slot >= inventoryStart && slot <= inventoryEnd){ if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -83,7 +87,9 @@ public class ContainerPhantomPlacer extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -70,13 +70,17 @@ public class ContainerRepairer extends Container{
// //
else if(slot >= inventoryStart && slot <= inventoryEnd){ else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -85,7 +89,9 @@ public class ContainerRepairer extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -61,13 +61,17 @@ public class ContainerXPSolidifier extends Container{
//Other Slots in Inventory excluded //Other Slots in Inventory excluded
if(slot >= inventoryStart){ if(slot >= inventoryStart){
if(slot >= inventoryStart && slot <= inventoryEnd){ if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)) return null; if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return null;
}
} }
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){ else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return null; return null;
} }
} }
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)) return null; else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return null;
}
if(newStack.stackSize == 0){ if(newStack.stackSize == 0){
theSlot.putStack(null); theSlot.putStack(null);
@ -76,7 +80,9 @@ public class ContainerXPSolidifier extends Container{
theSlot.onSlotChanged(); theSlot.onSlotChanged();
} }
if(newStack.stackSize == currentStack.stackSize) return null; if(newStack.stackSize == currentStack.stackSize){
return null;
}
theSlot.onPickupFromSlot(player, newStack); theSlot.onPickupFromSlot(player, newStack);
return currentStack; return currentStack;

View file

@ -22,6 +22,11 @@ import net.minecraft.world.World;
public class GuiHandler implements IGuiHandler{ public class GuiHandler implements IGuiHandler{
public static void init(){
ModUtil.LOGGER.info("Initializing GuiHandler...");
NetworkRegistry.INSTANCE.registerGuiHandler(ActuallyAdditions.instance, new GuiHandler());
}
@Override @Override
public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){ public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
TileEntityBase tile = null; TileEntityBase tile = null;
@ -181,9 +186,4 @@ public class GuiHandler implements IGuiHandler{
this(true); this(true);
} }
} }
public static void init(){
ModUtil.LOGGER.info("Initializing GuiHandler...");
NetworkRegistry.INSTANCE.registerGuiHandler(ActuallyAdditions.instance, new GuiHandler());
}
} }

View file

@ -24,9 +24,8 @@ import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiBreaker extends GuiContainer{ public class GuiBreaker extends GuiContainer{
private TileEntityBreaker breaker;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker");
private TileEntityBreaker breaker;
public GuiBreaker(InventoryPlayer inventory, TileEntityBase tile){ public GuiBreaker(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerBreaker(inventory, tile)); super(new ContainerBreaker(inventory, tile));

View file

@ -27,9 +27,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiCanolaPress extends GuiContainer{ public class GuiCanolaPress extends GuiContainer{
private TileEntityCanolaPress press;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCanolaPress"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCanolaPress");
private TileEntityCanolaPress press;
public GuiCanolaPress(InventoryPlayer inventory, TileEntityBase tile){ public GuiCanolaPress(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerCanolaPress(inventory, tile)); super(new ContainerCanolaPress(inventory, tile));

View file

@ -26,9 +26,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiCoalGenerator extends GuiContainer{ public class GuiCoalGenerator extends GuiContainer{
private TileEntityCoalGenerator generator;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCoalGenerator"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCoalGenerator");
private TileEntityCoalGenerator generator;
public GuiCoalGenerator(InventoryPlayer inventory, TileEntityBase tile){ public GuiCoalGenerator(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerCoalGenerator(inventory, tile)); super(new ContainerCoalGenerator(inventory, tile));

View file

@ -34,10 +34,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiCoffeeMachine extends GuiContainer{ public class GuiCoffeeMachine extends GuiContainer{
private TileEntityCoffeeMachine machine;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCoffeeMachine"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCoffeeMachine");
private TileEntityCoffeeMachine machine;
private int x; private int x;
private int y; private int y;
private int z; private int z;

View file

@ -24,9 +24,8 @@ import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiDropper extends GuiContainer{ public class GuiDropper extends GuiContainer{
private TileEntityDropper dropper;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker");
private TileEntityDropper dropper;
public GuiDropper(InventoryPlayer inventory, TileEntityBase tile){ public GuiDropper(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerDropper(inventory, tile)); super(new ContainerDropper(inventory, tile));

View file

@ -26,9 +26,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiEnergizer extends GuiContainer{ public class GuiEnergizer extends GuiContainer{
private TileEntityEnergizer energizer;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer");
private TileEntityEnergizer energizer;
public GuiEnergizer(EntityPlayer inventory, TileEntityBase tile){ public GuiEnergizer(EntityPlayer inventory, TileEntityBase tile){
super(new ContainerEnergizer(inventory, tile)); super(new ContainerEnergizer(inventory, tile));

View file

@ -26,9 +26,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiEnervator extends GuiContainer{ public class GuiEnervator extends GuiContainer{
private TileEntityEnervator enervator;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer");
private TileEntityEnervator enervator;
public GuiEnervator(EntityPlayer inventory, TileEntityBase tile){ public GuiEnervator(EntityPlayer inventory, TileEntityBase tile){
super(new ContainerEnervator(inventory, tile)); super(new ContainerEnervator(inventory, tile));

View file

@ -27,9 +27,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiFermentingBarrel extends GuiContainer{ public class GuiFermentingBarrel extends GuiContainer{
private TileEntityFermentingBarrel press;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFermentingBarrel"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFermentingBarrel");
private TileEntityFermentingBarrel press;
public GuiFermentingBarrel(InventoryPlayer inventory, TileEntityBase tile){ public GuiFermentingBarrel(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerFermentingBarrel(inventory, tile)); super(new ContainerFermentingBarrel(inventory, tile));

View file

@ -26,9 +26,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiFluidCollector extends GuiContainer{ public class GuiFluidCollector extends GuiContainer{
private TileEntityFluidCollector collector;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFluidCollector"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFluidCollector");
private TileEntityFluidCollector collector;
public GuiFluidCollector(InventoryPlayer inventory, TileEntityBase tile){ public GuiFluidCollector(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerFluidCollector(inventory, tile)); super(new ContainerFluidCollector(inventory, tile));

View file

@ -26,17 +26,10 @@ import java.util.Collections;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiGrinder extends GuiContainer{ public class GuiGrinder extends GuiContainer{
public static class GuiGrinderDouble extends GuiGrinder{
public GuiGrinderDouble(InventoryPlayer inventory, TileEntityBase tile){
super(inventory, tile, true);
}
}
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiGrinder"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiGrinder");
private static final ResourceLocation resLocDouble = AssetUtil.getGuiLocation("guiGrinderDouble"); private static final ResourceLocation resLocDouble = AssetUtil.getGuiLocation("guiGrinderDouble");
private TileEntityGrinder tileGrinder; private TileEntityGrinder tileGrinder;
private boolean isDouble; private boolean isDouble;
public GuiGrinder(InventoryPlayer inventoryPlayer, TileEntityBase tile){ public GuiGrinder(InventoryPlayer inventoryPlayer, TileEntityBase tile){
this(inventoryPlayer, tile, false); this(inventoryPlayer, tile, false);
} }
@ -88,4 +81,10 @@ public class GuiGrinder extends GuiContainer{
this.func_146283_a(Collections.singletonList(text), x, y); this.func_146283_a(Collections.singletonList(text), x, y);
} }
} }
public static class GuiGrinderDouble extends GuiGrinder{
public GuiGrinderDouble(InventoryPlayer inventory, TileEntityBase tile){
super(inventory, tile, true);
}
}
} }

View file

@ -40,29 +40,7 @@ import java.util.List;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiInputter extends GuiContainer{ public class GuiInputter extends GuiContainer{
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter");
private static final ResourceLocation resLocAdvanced = AssetUtil.getGuiLocation("guiInputterAdvanced");
public TileEntityInputter tileInputter;
private int x;
private int y;
private int z;
private World world;
private SmallerButton whitelistPut;
private SmallerButton whitelistPull;
private GuiTextField fieldPutStart;
private GuiTextField fieldPutEnd;
private GuiTextField fieldPullStart;
private GuiTextField fieldPullEnd;
private boolean isAdvanced;
public static final int OFFSET_ADVANCED = 12+36; public static final int OFFSET_ADVANCED = 12+36;
public static final String[] sideString = new String[]{ public static final String[] sideString = new String[]{
StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.disabled"), StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.disabled"),
StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.up"), StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.up"),
@ -71,6 +49,20 @@ public class GuiInputter extends GuiContainer{
StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.east"), StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.east"),
StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.south"), StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.south"),
StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.west")}; StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.west")};
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter");
private static final ResourceLocation resLocAdvanced = AssetUtil.getGuiLocation("guiInputterAdvanced");
public TileEntityInputter tileInputter;
private int x;
private int y;
private int z;
private World world;
private SmallerButton whitelistPut;
private SmallerButton whitelistPull;
private GuiTextField fieldPutStart;
private GuiTextField fieldPutEnd;
private GuiTextField fieldPullStart;
private GuiTextField fieldPullEnd;
private boolean isAdvanced;
public GuiInputter(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world, boolean isAdvanced){ public GuiInputter(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world, boolean isAdvanced){
super(new ContainerInputter(inventory, tile, isAdvanced)); super(new ContainerInputter(inventory, tile, isAdvanced));
@ -152,10 +144,18 @@ public class GuiInputter extends GuiContainer{
@Override @Override
public void keyTyped(char theChar, int key){ public void keyTyped(char theChar, int key){
if(key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER){ if(key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER){
if(this.fieldPutStart.isFocused()) this.setVariable(this.fieldPutStart, 0); if(this.fieldPutStart.isFocused()){
if(this.fieldPutEnd.isFocused()) this.setVariable(this.fieldPutEnd, 1); this.setVariable(this.fieldPutStart, 0);
if(this.fieldPullStart.isFocused()) this.setVariable(this.fieldPullStart, 2); }
if(this.fieldPullEnd.isFocused()) this.setVariable(this.fieldPullEnd, 3); if(this.fieldPutEnd.isFocused()){
this.setVariable(this.fieldPutEnd, 1);
}
if(this.fieldPullStart.isFocused()){
this.setVariable(this.fieldPullStart, 2);
}
if(this.fieldPullEnd.isFocused()){
this.setVariable(this.fieldPullEnd, 3);
}
} }
else if(Character.isDigit(theChar) || key == Keyboard.KEY_BACK || key == Keyboard.KEY_DELETE || key == Keyboard.KEY_LEFT || key == Keyboard.KEY_RIGHT){ else if(Character.isDigit(theChar) || key == Keyboard.KEY_BACK || key == Keyboard.KEY_DELETE || key == Keyboard.KEY_LEFT || key == Keyboard.KEY_RIGHT){
this.fieldPutStart.textboxKeyTyped(theChar, key); this.fieldPutStart.textboxKeyTyped(theChar, key);
@ -298,7 +298,9 @@ public class GuiInputter extends GuiContainer{
else if(!this.enabled){ else if(!this.enabled){
color = 10526880; color = 10526880;
} }
else if(this.field_146123_n) color = 16777120; else if(this.field_146123_n){
color = 16777120;
}
this.drawCenteredString(mc.fontRenderer, this.displayString, this.xPosition+this.width/2, this.yPosition+(this.height-8)/2, color); this.drawCenteredString(mc.fontRenderer, this.displayString, this.xPosition+this.width/2, this.yPosition+(this.height-8)/2, color);
} }

View file

@ -27,9 +27,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiOilGenerator extends GuiContainer{ public class GuiOilGenerator extends GuiContainer{
private TileEntityOilGenerator generator;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiOilGenerator"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiOilGenerator");
private TileEntityOilGenerator generator;
public GuiOilGenerator(InventoryPlayer inventory, TileEntityBase tile){ public GuiOilGenerator(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerOilGenerator(inventory, tile)); super(new ContainerOilGenerator(inventory, tile));

View file

@ -28,9 +28,8 @@ import java.util.Collections;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiOreMagnet extends GuiContainer{ public class GuiOreMagnet extends GuiContainer{
private TileEntityOreMagnet magnet;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiOreMagnet"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiOreMagnet");
private TileEntityOreMagnet magnet;
public GuiOreMagnet(InventoryPlayer inventory, TileEntityBase tile){ public GuiOreMagnet(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerOreMagnet(inventory, tile)); super(new ContainerOreMagnet(inventory, tile));

View file

@ -24,9 +24,8 @@ import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiPhantomPlacer extends GuiContainer{ public class GuiPhantomPlacer extends GuiContainer{
private TileEntityPhantomPlacer placer;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker");
private TileEntityPhantomPlacer placer;
public GuiPhantomPlacer(InventoryPlayer inventory, TileEntityBase tile){ public GuiPhantomPlacer(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerPhantomPlacer(inventory, tile)); super(new ContainerPhantomPlacer(inventory, tile));

View file

@ -30,10 +30,8 @@ import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiXPSolidifier extends GuiContainer{ public class GuiXPSolidifier extends GuiContainer{
private TileEntityXPSolidifier solidifier;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiXPSolidifier"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiXPSolidifier");
private TileEntityXPSolidifier solidifier;
private int x; private int x;
private int y; private int y;
private int z; private int z;

View file

@ -27,15 +27,13 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
public class InitForeignPaxels{ public class InitForeignPaxels{
public static final String[] mtNames = new String[]{"Obsidian", "LapisLazuli", "Osmium", "Bronze", "Glowstone", "Steel"};
private static final String THERMAL_FOUNDATION = "ThermalFoundation"; private static final String THERMAL_FOUNDATION = "ThermalFoundation";
private static final String MEKANISM_TOOLS = "MekanismTools"; private static final String MEKANISM_TOOLS = "MekanismTools";
public static Item[] tfPaxels = new Item[9];
private static final String[] tfNames = new String[]{"Copper", "Tin", "Silver", "Lead", "Nickel", "Electrum", "Bronze", "Platinum", "Invar"}; private static final String[] tfNames = new String[]{"Copper", "Tin", "Silver", "Lead", "Nickel", "Electrum", "Bronze", "Platinum", "Invar"};
private static Item[] mtPaxels = new Item[6];
public static final String[] mtNames = new String[]{"Obsidian", "LapisLazuli", "Osmium", "Bronze", "Glowstone", "Steel"};
private static final String[] mtRepairNames = new String[]{"ingotRefinedObsidian", "gemLapis", "ingotOsmium", "ingotBronze", "ingotRefinedGlowstone", "ingotSteel"}; private static final String[] mtRepairNames = new String[]{"ingotRefinedObsidian", "gemLapis", "ingotOsmium", "ingotBronze", "ingotRefinedGlowstone", "ingotSteel"};
public static Item[] tfPaxels = new Item[9];
private static Item[] mtPaxels = new Item[6];
public static void init(){ public static void init(){
//MekanismTools //MekanismTools

View file

@ -64,7 +64,9 @@ public class ItemArmorAA extends ItemArmor implements IActAddItemOrBlock{
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
int[] idsStack = OreDictionary.getOreIDs(stack); int[] idsStack = OreDictionary.getOreIDs(stack);
for(int id : idsStack){ for(int id : idsStack){
if(OreDictionary.getOreName(id).equals(repairItem)) return true; if(OreDictionary.getOreName(id).equals(repairItem)){
return true;
}
} }
return false; return false;
} }

View file

@ -37,6 +37,14 @@ public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{
public static ArrayList<Ingredient> ingredients = new ArrayList<Ingredient>(); public static ArrayList<Ingredient> ingredients = new ArrayList<Ingredient>();
public ItemCoffee(){
super(8, 5.0F, false);
this.setMaxDamage(ConfigIntValues.COFFEE_DRINK_AMOUNT.getValue()-1);
this.setAlwaysEdible();
this.setMaxStackSize(1);
this.setNoRepair();
}
public static void initIngredients(){ public static void initIngredients(){
registerIngredient(new MilkIngredient(new ItemStack(Items.milk_bucket))); registerIngredient(new MilkIngredient(new ItemStack(Items.milk_bucket)));
//Pam's Soy Milk (For Jemx because he's lactose intolerant. YER HAPPY NAO!?) //Pam's Soy Milk (For Jemx because he's lactose intolerant. YER HAPPY NAO!?)
@ -56,31 +64,11 @@ public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{
registerIngredient(new Ingredient(new ItemStack(Items.fermented_spider_eye), new PotionEffect[]{new PotionEffect(Potion.invisibility.getId(), 25, 0)}, 2)); registerIngredient(new Ingredient(new ItemStack(Items.fermented_spider_eye), new PotionEffect[]{new PotionEffect(Potion.invisibility.getId(), 25, 0)}, 2));
} }
public ItemCoffee(){
super(8, 5.0F, false);
this.setMaxDamage(ConfigIntValues.COFFEE_DRINK_AMOUNT.getValue()-1);
this.setAlwaysEdible();
this.setMaxStackSize(1);
this.setNoRepair();
}
@SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
PotionEffect[] effects = getEffectsFromStack(stack);
if(effects != null){
for(PotionEffect effect : effects){
list.add(StringUtil.localize(effect.getEffectName())+" "+(effect.getAmplifier()+1)+", "+StringUtils.ticksToElapsedTime(effect.getDuration()*20));
}
}
else{
list.add("No Effects");
}
}
public static Ingredient getIngredientFromStack(ItemStack stack){ public static Ingredient getIngredientFromStack(ItemStack stack){
for(Ingredient ingredient : ingredients){ for(Ingredient ingredient : ingredients){
if(ingredient.ingredient.copy().isItemEqual(stack)) return ingredient; if(ingredient.ingredient.copy().isItemEqual(stack)){
return ingredient;
}
} }
return null; return null;
} }
@ -98,7 +86,9 @@ public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{
public static void addEffectToStack(ItemStack stack, PotionEffect effect){ public static void addEffectToStack(ItemStack stack, PotionEffect effect){
NBTTagCompound tag = stack.getTagCompound(); NBTTagCompound tag = stack.getTagCompound();
if(tag == null) tag = new NBTTagCompound(); if(tag == null){
tag = new NBTTagCompound();
}
int prevCounter = tag.getInteger("Counter"); int prevCounter = tag.getInteger("Counter");
NBTTagCompound compound = new NBTTagCompound(); NBTTagCompound compound = new NBTTagCompound();
@ -157,7 +147,9 @@ public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{
PotionEffect[] effectsStack = getEffectsFromStack(stack); PotionEffect[] effectsStack = getEffectsFromStack(stack);
if(effectsStack != null && effectsStack.length > 0){ if(effectsStack != null && effectsStack.length > 0){
for(PotionEffect effectStack : effectsStack){ for(PotionEffect effectStack : effectsStack){
if(effect.getPotionID() == effectStack.getPotionID()) return effectStack; if(effect.getPotionID() == effectStack.getPotionID()){
return effectStack;
}
} }
} }
return null; return null;
@ -172,6 +164,24 @@ public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{
} }
} }
public static void registerIngredient(Ingredient ingredient){
ingredients.add(ingredient);
}
@SuppressWarnings("unchecked")
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool){
PotionEffect[] effects = getEffectsFromStack(stack);
if(effects != null){
for(PotionEffect effect : effects){
list.add(StringUtil.localize(effect.getEffectName())+" "+(effect.getAmplifier()+1)+", "+StringUtils.ticksToElapsedTime(effect.getDuration()*20));
}
}
else{
list.add("No Effects");
}
}
@Override @Override
public boolean getShareTag(){ public boolean getShareTag(){
return true; return true;
@ -222,15 +232,11 @@ public class ItemCoffee extends ItemFood implements IActAddItemOrBlock{
return "itemCoffee"; return "itemCoffee";
} }
public static void registerIngredient(Ingredient ingredient){
ingredients.add(ingredient);
}
public static class Ingredient{ public static class Ingredient{
public final ItemStack ingredient; public final ItemStack ingredient;
protected PotionEffect[] effects;
public final int maxAmplifier; public final int maxAmplifier;
protected PotionEffect[] effects;
public Ingredient(ItemStack ingredient, PotionEffect[] effects, int maxAmplifier){ public Ingredient(ItemStack ingredient, PotionEffect[] effects, int maxAmplifier){
this.ingredient = ingredient.copy(); this.ingredient = ingredient.copy();

View file

@ -205,13 +205,17 @@ public class ItemDrill extends ItemEnergy{
*/ */
public ItemStack getHasUpgradeAsStack(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade){ public ItemStack getHasUpgradeAsStack(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade){
NBTTagCompound compound = stack.getTagCompound(); NBTTagCompound compound = stack.getTagCompound();
if(compound == null) return null; if(compound == null){
return null;
}
ItemStack[] slots = this.getSlotsFromNBT(stack); ItemStack[] slots = this.getSlotsFromNBT(stack);
if(slots != null && slots.length > 0){ if(slots != null && slots.length > 0){
for(ItemStack slotStack : slots){ for(ItemStack slotStack : slots){
if(slotStack != null && slotStack.getItem() instanceof ItemDrillUpgrade){ if(slotStack != null && slotStack.getItem() instanceof ItemDrillUpgrade){
if(((ItemDrillUpgrade)slotStack.getItem()).type == upgrade) return slotStack; if(((ItemDrillUpgrade)slotStack.getItem()).type == upgrade){
return slotStack;
}
} }
} }
} }
@ -237,7 +241,9 @@ public class ItemDrill extends ItemEnergy{
*/ */
public void writeSlotsToNBT(ItemStack[] slots, ItemStack stack){ public void writeSlotsToNBT(ItemStack[] slots, ItemStack stack){
NBTTagCompound compound = stack.getTagCompound(); NBTTagCompound compound = stack.getTagCompound();
if(compound == null) compound = new NBTTagCompound(); if(compound == null){
compound = new NBTTagCompound();
}
if(slots != null && slots.length > 0){ if(slots != null && slots.length > 0){
compound.setInteger("SlotAmount", slots.length); compound.setInteger("SlotAmount", slots.length);
@ -264,7 +270,9 @@ public class ItemDrill extends ItemEnergy{
*/ */
public ItemStack[] getSlotsFromNBT(ItemStack stack){ public ItemStack[] getSlotsFromNBT(ItemStack stack){
NBTTagCompound compound = stack.getTagCompound(); NBTTagCompound compound = stack.getTagCompound();
if(compound == null) return null; if(compound == null){
return null;
}
int slotAmount = compound.getInteger("SlotAmount"); int slotAmount = compound.getInteger("SlotAmount");
ItemStack[] slots = new ItemStack[slotAmount]; ItemStack[] slots = new ItemStack[slotAmount];
@ -301,7 +309,9 @@ public class ItemDrill extends ItemEnergy{
//Block hit //Block hit
MovingObjectPosition pos = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player); MovingObjectPosition pos = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player);
if(pos == null) return false; if(pos == null){
return false;
}
//Corrects Blocks to hit depending on Side of original Block hit //Corrects Blocks to hit depending on Side of original Block hit
int side = pos.sideHit; int side = pos.sideHit;
@ -320,7 +330,9 @@ public class ItemDrill extends ItemEnergy{
//Break Middle Block first //Break Middle Block first
int use = this.getEnergyUsePerBlock(stack); int use = this.getEnergyUsePerBlock(stack);
if(this.getEnergyStored(stack) >= use){ if(this.getEnergyStored(stack) >= use){
if(!this.tryHarvestBlock(world, x, y, z, false, stack, player, use)) return false; if(!this.tryHarvestBlock(world, x, y, z, false, stack, player, use)){
return false;
}
} }
else{ else{
return false; return false;
@ -429,7 +441,9 @@ public class ItemDrill extends ItemEnergy{
String name = Block.blockRegistry.getNameForObject(block); String name = Block.blockRegistry.getNameForObject(block);
if(name != null){ if(name != null){
for(String list : ConfigValues.drillExtraminingWhitelist){ for(String list : ConfigValues.drillExtraminingWhitelist){
if(list.equals(name)) return true; if(list.equals(name)){
return true;
}
} }
} }
return false; return false;

View file

@ -24,27 +24,22 @@ import net.minecraft.world.World;
public class ItemDrillUpgrade extends Item implements IActAddItemOrBlock{ public class ItemDrillUpgrade extends Item implements IActAddItemOrBlock{
public enum UpgradeType{
SPEED,
SPEED_II,
SPEED_III,
SILK_TOUCH,
FORTUNE,
FORTUNE_II,
THREE_BY_THREE,
FIVE_BY_FIVE,
PLACER
}
public UpgradeType type; public UpgradeType type;
public String unlocalizedName; public String unlocalizedName;
public ItemDrillUpgrade(UpgradeType type, String unlocName){ public ItemDrillUpgrade(UpgradeType type, String unlocName){
this.type = type; this.type = type;
this.unlocalizedName = unlocName; this.unlocalizedName = unlocName;
this.setMaxStackSize(1); this.setMaxStackSize(1);
} }
public static int getSlotToPlaceFrom(ItemStack stack){
NBTTagCompound compound = stack.getTagCompound();
if(compound != null){
return compound.getInteger("SlotToPlaceFrom")-1;
}
return -1;
}
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
if(!world.isRemote && this.type == UpgradeType.PLACER){ if(!world.isRemote && this.type == UpgradeType.PLACER){
@ -55,21 +50,15 @@ public class ItemDrillUpgrade extends Item implements IActAddItemOrBlock{
public void setSlotToPlaceFrom(ItemStack stack, int slot){ public void setSlotToPlaceFrom(ItemStack stack, int slot){
NBTTagCompound compound = stack.getTagCompound(); NBTTagCompound compound = stack.getTagCompound();
if(compound == null) compound = new NBTTagCompound(); if(compound == null){
compound = new NBTTagCompound();
}
compound.setInteger("SlotToPlaceFrom", slot+1); compound.setInteger("SlotToPlaceFrom", slot+1);
stack.setTagCompound(compound); stack.setTagCompound(compound);
} }
public static int getSlotToPlaceFrom(ItemStack stack){
NBTTagCompound compound = stack.getTagCompound();
if(compound != null){
return compound.getInteger("SlotToPlaceFrom")-1;
}
return -1;
}
@Override @Override
public IIcon getIcon(ItemStack stack, int pass){ public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon; return this.itemIcon;
@ -85,4 +74,16 @@ public class ItemDrillUpgrade extends Item implements IActAddItemOrBlock{
public String getName(){ public String getName(){
return this.unlocalizedName; return this.unlocalizedName;
} }
public enum UpgradeType{
SPEED,
SPEED_II,
SPEED_III,
SILK_TOUCH,
FORTUNE,
FORTUNE_II,
THREE_BY_THREE,
FIVE_BY_FIVE,
PLACER
}
} }

View file

@ -74,7 +74,9 @@ public abstract class ItemEnergy extends ItemEnergyContainer implements IActAddI
public void setEnergy(ItemStack stack, int energy){ public void setEnergy(ItemStack stack, int energy){
NBTTagCompound compound = stack.getTagCompound(); NBTTagCompound compound = stack.getTagCompound();
if(compound == null) compound = new NBTTagCompound(); if(compound == null){
compound = new NBTTagCompound();
}
compound.setInteger("Energy", energy); compound.setInteger("Energy", energy);
stack.setTagCompound(compound); stack.setTagCompound(compound);
} }

View file

@ -28,7 +28,9 @@ public class ItemFertilizer extends Item implements IActAddItemOrBlock{
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){ public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){
if(ItemDye.applyBonemeal(stack, world, x, y, z, player)){ if(ItemDye.applyBonemeal(stack, world, x, y, z, player)){
if(!world.isRemote) world.playAuxSFX(2005, x, y, z, 0); if(!world.isRemote){
world.playAuxSFX(2005, x, y, z, 0);
}
return true; return true;
} }
return super.onItemUse(stack, player, world, x, y, z, par7, par8, par9, par10); return super.onItemUse(stack, player, world, x, y, z, par7, par8, par9, par10);

View file

@ -40,7 +40,9 @@ public class ItemGrowthRing extends ItemEnergy{
@Override @Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){ public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
if(!(entity instanceof EntityPlayer) || world.isRemote) return; if(!(entity instanceof EntityPlayer) || world.isRemote){
return;
}
EntityPlayer player = (EntityPlayer)entity; EntityPlayer player = (EntityPlayer)entity;
ItemStack equipped = player.getCurrentEquippedItem(); ItemStack equipped = player.getCurrentEquippedItem();
@ -48,7 +50,9 @@ public class ItemGrowthRing extends ItemEnergy{
if(equipped != null && equipped == stack && this.getEnergyStored(stack) >= ConfigIntValues.GROWTH_RING_ENERGY_USE.getValue()){ if(equipped != null && equipped == stack && this.getEnergyStored(stack) >= ConfigIntValues.GROWTH_RING_ENERGY_USE.getValue()){
ArrayList<WorldPos> blocks = new ArrayList<WorldPos>(); ArrayList<WorldPos> blocks = new ArrayList<WorldPos>();
if(stack.stackTagCompound == null) stack.setTagCompound(new NBTTagCompound()); if(stack.stackTagCompound == null){
stack.setTagCompound(new NBTTagCompound());
}
int waitTime = stack.stackTagCompound.getInteger("WaitTime"); int waitTime = stack.stackTagCompound.getInteger("WaitTime");
//Adding all possible Blocks //Adding all possible Blocks

View file

@ -75,7 +75,9 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{
@Override @Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){ public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
if(this.getStoredPosition(stack) == null) this.clearStorage(stack); if(this.getStoredPosition(stack) == null){
this.clearStorage(stack);
}
} }
public WorldPos getStoredPosition(ItemStack stack){ public WorldPos getStoredPosition(ItemStack stack){
@ -94,7 +96,9 @@ public class ItemPhantomConnector extends Item implements IActAddItemOrBlock{
public void storeConnection(ItemStack stack, int x, int y, int z, World world){ public void storeConnection(ItemStack stack, int x, int y, int z, World world){
NBTTagCompound tag = stack.getTagCompound(); NBTTagCompound tag = stack.getTagCompound();
if(tag == null) tag = new NBTTagCompound(); if(tag == null){
tag = new NBTTagCompound();
}
tag.setInteger("XCoordOfTileStored", x); tag.setInteger("XCoordOfTileStored", x);
tag.setInteger("YCoordOfTileStored", y); tag.setInteger("YCoordOfTileStored", y);

View file

@ -44,11 +44,15 @@ public class ItemSpecialDrop extends Item implements IActAddItemOrBlock{
if(stack.getItemDamage() == TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()){ if(stack.getItemDamage() == TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()){
if(!player.isSneaking()){ if(!player.isSneaking()){
world.spawnEntityInWorld(new EntityXPOrb(world, player.posX+0.5, player.posY+0.5, player.posZ+0.5, SOLID_XP_AMOUNT)); world.spawnEntityInWorld(new EntityXPOrb(world, player.posX+0.5, player.posY+0.5, player.posZ+0.5, SOLID_XP_AMOUNT));
if(!player.capabilities.isCreativeMode) stack.stackSize--; if(!player.capabilities.isCreativeMode){
stack.stackSize--;
}
} }
else{ else{
world.spawnEntityInWorld(new EntityXPOrb(world, player.posX+0.5, player.posY+0.5, player.posZ+0.5, SOLID_XP_AMOUNT*stack.stackSize)); world.spawnEntityInWorld(new EntityXPOrb(world, player.posX+0.5, player.posY+0.5, player.posZ+0.5, SOLID_XP_AMOUNT*stack.stackSize));
if(!player.capabilities.isCreativeMode) stack.stackSize = 0; if(!player.capabilities.isCreativeMode){
stack.stackSize = 0;
}
} }
} }
} }

View file

@ -65,7 +65,9 @@ public class ItemTeleStaff extends ItemEnergy{
private void setWaitTime(ItemStack stack, int time){ private void setWaitTime(ItemStack stack, int time){
NBTTagCompound compound = stack.getTagCompound(); NBTTagCompound compound = stack.getTagCompound();
if(compound == null) compound = new NBTTagCompound(); if(compound == null){
compound = new NBTTagCompound();
}
compound.setInteger("waitTime", time); compound.setInteger("waitTime", time);

View file

@ -32,7 +32,9 @@ public class ItemWaterRemovalRing extends ItemEnergy{
@Override @Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){ public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
if(!(entity instanceof EntityPlayer) || world.isRemote) return; if(!(entity instanceof EntityPlayer) || world.isRemote){
return;
}
EntityPlayer player = (EntityPlayer)entity; EntityPlayer player = (EntityPlayer)entity;
ItemStack equipped = player.getCurrentEquippedItem(); ItemStack equipped = player.getCurrentEquippedItem();

View file

@ -77,6 +77,21 @@ public class ItemWingsOfTheBats extends Item implements IActAddItemOrBlock{
wingedPlayers.add(player.getUniqueID()+(player.worldObj.isRemote ? "-Remote" : "")); wingedPlayers.add(player.getUniqueID()+(player.worldObj.isRemote ? "-Remote" : ""));
} }
/**
* Checks if the Player has Wings in its Inventory
*
* @param player The Player
* @return The Wings
*/
public static ItemStack getWingItem(EntityPlayer player){
for(int i = 0; i < player.inventory.getSizeInventory(); i++){
if(player.inventory.getStackInSlot(i) != null && player.inventory.getStackInSlot(i).getItem() instanceof ItemWingsOfTheBats){
return player.inventory.getStackInSlot(i);
}
}
return null;
}
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic; return EnumRarity.epic;
@ -97,19 +112,4 @@ public class ItemWingsOfTheBats extends Item implements IActAddItemOrBlock{
public String getName(){ public String getName(){
return "itemWingsOfTheBats"; return "itemWingsOfTheBats";
} }
/**
* Checks if the Player has Wings in its Inventory
*
* @param player The Player
* @return The Wings
*/
public static ItemStack getWingItem(EntityPlayer player){
for(int i = 0; i < player.inventory.getSizeInventory(); i++){
if(player.inventory.getStackInSlot(i) != null && player.inventory.getStackInSlot(i).getItem() instanceof ItemWingsOfTheBats){
return player.inventory.getStackInSlot(i);
}
}
return null;
}
} }

View file

@ -38,22 +38,13 @@ public enum TheFoods implements IActAddItemOrBlock{
RICE_BREAD("RiceBread", 8, 3F, false, 25, EnumRarity.uncommon), RICE_BREAD("RiceBread", 8, 3F, false, 25, EnumRarity.uncommon),
DOUGHNUT("Doughnut", 4, 0.5F, false, 10, EnumRarity.epic); DOUGHNUT("Doughnut", 4, 0.5F, false, 10, EnumRarity.epic);
public static void setReturnItems(){
SPAGHETTI.returnItem = new ItemStack(Items.bowl);
PUMPKIN_STEW.returnItem = new ItemStack(Items.bowl);
CARROT_JUICE.returnItem = new ItemStack(Items.glass_bottle);
FRENCH_FRIES.returnItem = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal());
FISH_N_CHIPS.returnItem = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal());
}
public final String name; public final String name;
public final int healAmount; public final int healAmount;
public final float saturation; public final float saturation;
public final boolean getsDrunken; public final boolean getsDrunken;
public final int useDuration; public final int useDuration;
public ItemStack returnItem;
public final EnumRarity rarity; public final EnumRarity rarity;
public ItemStack returnItem;
TheFoods(String name, int healAmount, float saturation, boolean getsDrunken, int useDuration, EnumRarity rarity){ TheFoods(String name, int healAmount, float saturation, boolean getsDrunken, int useDuration, EnumRarity rarity){
this.name = name; this.name = name;
this.getsDrunken = getsDrunken; this.getsDrunken = getsDrunken;
@ -63,6 +54,14 @@ public enum TheFoods implements IActAddItemOrBlock{
this.rarity = rarity; this.rarity = rarity;
} }
public static void setReturnItems(){
SPAGHETTI.returnItem = new ItemStack(Items.bowl);
PUMPKIN_STEW.returnItem = new ItemStack(Items.bowl);
CARROT_JUICE.returnItem = new ItemStack(Items.glass_bottle);
FRENCH_FRIES.returnItem = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal());
FISH_N_CHIPS.returnItem = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal());
}
@Override @Override
public String getName(){ public String getName(){
return this.name; return this.name;

View file

@ -55,7 +55,9 @@ public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{
String name = Block.blockRegistry.getNameForObject(block); String name = Block.blockRegistry.getNameForObject(block);
if(name != null){ if(name != null){
for(String list : ConfigValues.paxelExtraMiningWhitelist){ for(String list : ConfigValues.paxelExtraMiningWhitelist){
if(list.equals(name)) return true; if(list.equals(name)){
return true;
}
} }
} }
return false; return false;
@ -78,7 +80,9 @@ public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{
} }
else{ else{
UseHoeEvent event = new UseHoeEvent(player, stack, world, x, y, z); UseHoeEvent event = new UseHoeEvent(player, stack, world, x, y, z);
if(MinecraftForge.EVENT_BUS.post(event)) return false; if(MinecraftForge.EVENT_BUS.post(event)){
return false;
}
if(event.getResult() == Event.Result.ALLOW){ if(event.getResult() == Event.Result.ALLOW){
stack.damageItem(1, player); stack.damageItem(1, player);
return true; return true;
@ -106,7 +110,9 @@ public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
int[] idsStack = OreDictionary.getOreIDs(stack); int[] idsStack = OreDictionary.getOreIDs(stack);
for(int id : idsStack){ for(int id : idsStack){
if(OreDictionary.getOreName(id).equals(repairItem)) return true; if(OreDictionary.getOreName(id).equals(repairItem)){
return true;
}
} }
return false; return false;
} }

View file

@ -38,7 +38,9 @@ public class ItemAxeAA extends ItemAxe implements IActAddItemOrBlock{
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
int[] idsStack = OreDictionary.getOreIDs(stack); int[] idsStack = OreDictionary.getOreIDs(stack);
for(int id : idsStack){ for(int id : idsStack){
if(OreDictionary.getOreName(id).equals(repairItem)) return true; if(OreDictionary.getOreName(id).equals(repairItem)){
return true;
}
} }
return false; return false;
} }

View file

@ -40,7 +40,9 @@ public class ItemHoeAA extends ItemHoe implements IActAddItemOrBlock{
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
int[] idsStack = OreDictionary.getOreIDs(stack); int[] idsStack = OreDictionary.getOreIDs(stack);
for(int id : idsStack){ for(int id : idsStack){
if(OreDictionary.getOreName(id).equals(repairItem)) return true; if(OreDictionary.getOreName(id).equals(repairItem)){
return true;
}
} }
return false; return false;
} }

View file

@ -38,7 +38,9 @@ public class ItemPickaxeAA extends ItemPickaxe implements IActAddItemOrBlock{
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
int[] idsStack = OreDictionary.getOreIDs(stack); int[] idsStack = OreDictionary.getOreIDs(stack);
for(int id : idsStack){ for(int id : idsStack){
if(OreDictionary.getOreName(id).equals(repairItem)) return true; if(OreDictionary.getOreName(id).equals(repairItem)){
return true;
}
} }
return false; return false;
} }

View file

@ -40,7 +40,9 @@ public class ItemShovelAA extends ItemSpade implements IActAddItemOrBlock{
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
int[] idsStack = OreDictionary.getOreIDs(stack); int[] idsStack = OreDictionary.getOreIDs(stack);
for(int id : idsStack){ for(int id : idsStack){
if(OreDictionary.getOreName(id).equals(repairItem)) return true; if(OreDictionary.getOreName(id).equals(repairItem)){
return true;
}
} }
return false; return false;
} }

View file

@ -40,7 +40,9 @@ public class ItemSwordAA extends ItemSword implements IActAddItemOrBlock{
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){ public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
int[] idsStack = OreDictionary.getOreIDs(stack); int[] idsStack = OreDictionary.getOreIDs(stack);
for(int id : idsStack){ for(int id : idsStack){
if(OreDictionary.getOreName(id).equals(repairItem)) return true; if(OreDictionary.getOreName(id).equals(repairItem)){
return true;
}
} }
return false; return false;
} }

View file

@ -46,6 +46,97 @@ public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler implements
return new ItemStack(InitBlocks.blockCoffeeMachine); return new ItemStack(InitBlocks.blockCoffeeMachine);
} }
@Override
public int recipiesPerPage(){
return 1;
}
@Override
public void loadTransferRects(){
transferRects.add(new RecipeTransferRect(new Rectangle(20, 39, 20, 16), NAME));
transferRects.add(new RecipeTransferRect(new Rectangle(64, 42, 23, 10), NAME));
}
@Override
public Class<? extends GuiContainer> getGuiClass(){
return GuiCoffeeMachine.class;
}
@Override
public String getRecipeName(){
return StringUtil.localize("container.nei."+NAME+".name");
}
@Override
public void loadCraftingRecipes(String outputId, Object... results){
if(outputId.equals(NAME) && getClass() == CoffeeMachineRecipeHandler.class){
ArrayList<ItemCoffee.Ingredient> ingredients = ItemCoffee.ingredients;
for(ItemCoffee.Ingredient ingredient : ingredients){
arecipes.add(new CachedCoffee(ingredient));
}
}
else{
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result){
ArrayList<ItemCoffee.Ingredient> ingredients = ItemCoffee.ingredients;
for(ItemCoffee.Ingredient ingredient : ingredients){
if(result.getItem() instanceof ItemCoffee){
arecipes.add(new CachedCoffee(ingredient));
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient){
ArrayList<ItemCoffee.Ingredient> ingredients = ItemCoffee.ingredients;
for(ItemCoffee.Ingredient ingr : ingredients){
if(NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemCoffeeBean), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(ingr.ingredient.copy(), ingredient)){
CachedCoffee theRecipe = new CachedCoffee(ingr);
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.ingredientStack), ingredient);
arecipes.add(theRecipe);
}
}
}
@Override
public String getGuiTexture(){
return ModUtil.MOD_ID_LOWER+":textures/gui/guiNEICoffeeMachine.png";
}
@Override
public void drawBackground(int recipeIndex){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 126, 88);
}
@Override
public void drawExtras(int recipe){
drawProgressBar(20, 39, 126, 0, 21, 16, 48, 0);
drawProgressBar(63, 42, 125, 16, 24, 12, 48, 2);
CachedCoffee cache = (CachedCoffee)this.arecipes.get(recipe);
if(cache.extraText != null){
GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.special")+":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
GuiDraw.drawString(cache.extraText, 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.shift"), 1, 75, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
if(cache.maxAmp > 0){
GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.maxAmount")+": "+cache.maxAmp, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
}
@Override
public String getOverlayIdentifier(){
return NAME;
}
public class CachedCoffee extends CachedRecipe{ public class CachedCoffee extends CachedRecipe{
public PositionedStack cup; public PositionedStack cup;
@ -84,91 +175,4 @@ public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler implements
return result; return result;
} }
} }
@Override
public int recipiesPerPage(){
return 1;
}
@Override
public void loadTransferRects(){
transferRects.add(new RecipeTransferRect(new Rectangle(20, 39, 20, 16), NAME));
transferRects.add(new RecipeTransferRect(new Rectangle(64, 42, 23, 10), NAME));
}
@Override
public Class<? extends GuiContainer> getGuiClass(){
return GuiCoffeeMachine.class;
}
@Override
public String getRecipeName(){
return StringUtil.localize("container.nei."+NAME+".name");
}
@Override
public void loadCraftingRecipes(String outputId, Object... results){
if(outputId.equals(NAME) && getClass() == CoffeeMachineRecipeHandler.class){
ArrayList<ItemCoffee.Ingredient> ingredients = ItemCoffee.ingredients;
for(ItemCoffee.Ingredient ingredient : ingredients){
arecipes.add(new CachedCoffee(ingredient));
}
}
else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack result){
ArrayList<ItemCoffee.Ingredient> ingredients = ItemCoffee.ingredients;
for(ItemCoffee.Ingredient ingredient : ingredients){
if(result.getItem() instanceof ItemCoffee) arecipes.add(new CachedCoffee(ingredient));
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient){
ArrayList<ItemCoffee.Ingredient> ingredients = ItemCoffee.ingredients;
for(ItemCoffee.Ingredient ingr : ingredients){
if(NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemCoffeeBean), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(ingr.ingredient.copy(), ingredient)){
CachedCoffee theRecipe = new CachedCoffee(ingr);
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.ingredientStack), ingredient);
arecipes.add(theRecipe);
}
}
}
@Override
public String getGuiTexture(){
return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEICoffeeMachine.png";
}
@Override
public void drawBackground(int recipeIndex){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(0, 0, 0, 0, 126, 88);
}
@Override
public void drawExtras(int recipe){
drawProgressBar(20, 39, 126, 0, 21, 16, 48, 0);
drawProgressBar(63, 42, 125, 16, 24, 12, 48, 2);
CachedCoffee cache = (CachedCoffee)this.arecipes.get(recipe);
if(cache.extraText != null){
GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.special") + ":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
GuiDraw.drawString(cache.extraText, 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.shift"), 1, 75, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
if(cache.maxAmp > 0){
GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.maxAmount") + ": " + cache.maxAmp, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
}
@Override
public String getOverlayIdentifier(){
return NAME;
}
} }

View file

@ -42,28 +42,6 @@ public class CompostRecipeHandler extends TemplateRecipeHandler implements INeiR
return new ItemStack(InitBlocks.blockCompost); return new ItemStack(InitBlocks.blockCompost);
} }
public class CachedCompostRecipe extends CachedRecipe{
public PositionedStack result;
public PositionedStack input;
public int chance;
public CachedCompostRecipe(ItemStack input, ItemStack result){
this.result = new PositionedStack(result, 67+32, 19);
this.input = new PositionedStack(input, 5+32, 19);
}
@Override
public PositionedStack getIngredient(){
return input;
}
@Override
public PositionedStack getResult(){
return result;
}
}
@Override @Override
public int recipiesPerPage(){ public int recipiesPerPage(){
return 2; return 2;
@ -89,12 +67,16 @@ public class CompostRecipeHandler extends TemplateRecipeHandler implements INeiR
if(outputId.equals(NAME) && getClass() == CompostRecipeHandler.class){ if(outputId.equals(NAME) && getClass() == CompostRecipeHandler.class){
arecipes.add(new CachedCompostRecipe(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), new ItemStack(InitItems.itemFertilizer, ConfigIntValues.COMPOST_AMOUNT.getValue()))); arecipes.add(new CachedCompostRecipe(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), new ItemStack(InitItems.itemFertilizer, ConfigIntValues.COMPOST_AMOUNT.getValue())));
} }
else super.loadCraftingRecipes(outputId, results); else{
super.loadCraftingRecipes(outputId, results);
}
} }
@Override @Override
public void loadCraftingRecipes(ItemStack result){ public void loadCraftingRecipes(ItemStack result){
if(NEIServerUtils.areStacksSameType(new ItemStack(InitItems.itemFertilizer), result)) arecipes.add(new CachedCompostRecipe(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), new ItemStack(InitItems.itemFertilizer, ConfigIntValues.COMPOST_AMOUNT.getValue()))); if(NEIServerUtils.areStacksSameType(new ItemStack(InitItems.itemFertilizer), result)){
arecipes.add(new CachedCompostRecipe(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), new ItemStack(InitItems.itemFertilizer, ConfigIntValues.COMPOST_AMOUNT.getValue())));
}
} }
@Override @Override
@ -108,7 +90,7 @@ public class CompostRecipeHandler extends TemplateRecipeHandler implements INeiR
@Override @Override
public String getGuiTexture(){ public String getGuiTexture(){
return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEISimple.png"; return ModUtil.MOD_ID_LOWER+":textures/gui/guiNEISimple.png";
} }
@Override @Override
@ -122,4 +104,26 @@ public class CompostRecipeHandler extends TemplateRecipeHandler implements INeiR
public String getOverlayIdentifier(){ public String getOverlayIdentifier(){
return NAME; return NAME;
} }
public class CachedCompostRecipe extends CachedRecipe{
public PositionedStack result;
public PositionedStack input;
public int chance;
public CachedCompostRecipe(ItemStack input, ItemStack result){
this.result = new PositionedStack(result, 67+32, 19);
this.input = new PositionedStack(input, 5+32, 19);
}
@Override
public PositionedStack getIngredient(){
return input;
}
@Override
public PositionedStack getResult(){
return result;
}
}
} }

View file

@ -31,84 +31,13 @@ import java.util.List;
public class CrusherRecipeHandler extends TemplateRecipeHandler implements INeiRecipeHandler{ public class CrusherRecipeHandler extends TemplateRecipeHandler implements INeiRecipeHandler{
@Override
public ItemStack getStackForInfo(){
return new ItemStack(InitBlocks.blockGrinder);
}
public static class CrusherDoubleRecipeHandler extends CrusherRecipeHandler{
@Override
public ItemStack getStackForInfo(){
return new ItemStack(InitBlocks.blockGrinderDouble);
}
@Override
public Class<? extends GuiContainer> getGuiClass(){
return GuiGrinder.GuiGrinderDouble.class;
}
@Override
public void loadTransferRects(){
transferRects.add(new RecipeTransferRect(new Rectangle(51, 40, 24, 22), this.getName()));
transferRects.add(new RecipeTransferRect(new Rectangle(101, 40, 24, 22), this.getName()));
}
@Override
public String getGuiTexture(){
return ModUtil.MOD_ID_LOWER+":textures/gui/guiGrinderDouble.png";
}
@Override
public void drawBackground(int recipeIndex){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(33, 20, 33, 20, 110, 70);
}
@Override
public void drawExtras(int recipe){
drawProgressBar(51, 40, 176, 0, 24, 23, 48, 1);
this.drawChanceString(66, 93, recipe);
}
}
public CrusherRecipeHandler(){ public CrusherRecipeHandler(){
RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0); RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0);
} }
public class CachedCrush extends CachedRecipe{ @Override
public ItemStack getStackForInfo(){
public PositionedStack ingredient; return new ItemStack(InitBlocks.blockGrinder);
public PositionedStack resultOne;
public PositionedStack resultTwo;
public int secondChance;
public CachedCrush(ItemStack in, ItemStack resultOne, ItemStack resultTwo, int secondChance, CrusherRecipeHandler handler){
boolean isDouble = handler instanceof CrusherDoubleRecipeHandler;
in.stackSize = 1;
this.ingredient = new PositionedStack(in, isDouble ? 51 : 80, 21);
this.resultOne = new PositionedStack(resultOne, isDouble ? 38 : 66, 69);
if(resultTwo != null) this.resultTwo = new PositionedStack(resultTwo, isDouble ? 63 : 94, 69);
this.secondChance = secondChance;
}
@Override
public List<PositionedStack> getIngredients(){
return getCycledIngredients(cycleticks/48, Collections.singletonList(ingredient));
}
@Override
public PositionedStack getResult(){
return resultOne;
}
@Override
public List<PositionedStack> getOtherStacks(){
ArrayList<PositionedStack> list = new ArrayList<PositionedStack>();
if(this.resultTwo != null) list.add(this.resultTwo);
return list;
}
} }
@Override @Override
@ -139,15 +68,18 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler implements INeiR
arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance, this)); arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance, this));
} }
} }
else super.loadCraftingRecipes(outputId, results); else{
super.loadCraftingRecipes(outputId, results);
}
} }
@Override @Override
public void loadCraftingRecipes(ItemStack result){ public void loadCraftingRecipes(ItemStack result){
ArrayList<CrusherRecipeManualRegistry.CrusherRecipe> recipes = CrusherRecipeManualRegistry.recipes; ArrayList<CrusherRecipeManualRegistry.CrusherRecipe> recipes = CrusherRecipeManualRegistry.recipes;
for(CrusherRecipeManualRegistry.CrusherRecipe recipe : recipes){ for(CrusherRecipeManualRegistry.CrusherRecipe recipe : recipes){
if(NEIServerUtils.areStacksSameType(recipe.firstOutput, result) || NEIServerUtils.areStacksSameType(recipe.secondOutput, result)) if(NEIServerUtils.areStacksSameType(recipe.firstOutput, result) || NEIServerUtils.areStacksSameType(recipe.secondOutput, result)){
arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance, this)); arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance, this));
}
} }
} }
@ -198,4 +130,79 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler implements INeiR
GuiDraw.drawString(secondString, x, y, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false); GuiDraw.drawString(secondString, x, y, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
} }
} }
public static class CrusherDoubleRecipeHandler extends CrusherRecipeHandler{
@Override
public ItemStack getStackForInfo(){
return new ItemStack(InitBlocks.blockGrinderDouble);
}
@Override
public Class<? extends GuiContainer> getGuiClass(){
return GuiGrinder.GuiGrinderDouble.class;
}
@Override
public void loadTransferRects(){
transferRects.add(new RecipeTransferRect(new Rectangle(51, 40, 24, 22), this.getName()));
transferRects.add(new RecipeTransferRect(new Rectangle(101, 40, 24, 22), this.getName()));
}
@Override
public String getGuiTexture(){
return ModUtil.MOD_ID_LOWER+":textures/gui/guiGrinderDouble.png";
}
@Override
public void drawBackground(int recipeIndex){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(33, 20, 33, 20, 110, 70);
}
@Override
public void drawExtras(int recipe){
drawProgressBar(51, 40, 176, 0, 24, 23, 48, 1);
this.drawChanceString(66, 93, recipe);
}
}
public class CachedCrush extends CachedRecipe{
public PositionedStack ingredient;
public PositionedStack resultOne;
public PositionedStack resultTwo;
public int secondChance;
public CachedCrush(ItemStack in, ItemStack resultOne, ItemStack resultTwo, int secondChance, CrusherRecipeHandler handler){
boolean isDouble = handler instanceof CrusherDoubleRecipeHandler;
in.stackSize = 1;
this.ingredient = new PositionedStack(in, isDouble ? 51 : 80, 21);
this.resultOne = new PositionedStack(resultOne, isDouble ? 38 : 66, 69);
if(resultTwo != null){
this.resultTwo = new PositionedStack(resultTwo, isDouble ? 63 : 94, 69);
}
this.secondChance = secondChance;
}
@Override
public List<PositionedStack> getIngredients(){
return getCycledIngredients(cycleticks/48, Collections.singletonList(ingredient));
}
@Override
public PositionedStack getResult(){
return resultOne;
}
@Override
public List<PositionedStack> getOtherStacks(){
ArrayList<PositionedStack> list = new ArrayList<PositionedStack>();
if(this.resultTwo != null){
list.add(this.resultTwo);
}
return list;
}
}
} }

View file

@ -42,28 +42,6 @@ public class FurnaceDoubleRecipeHandler extends TemplateRecipeHandler implements
return new ItemStack(InitBlocks.blockFurnaceDouble); return new ItemStack(InitBlocks.blockFurnaceDouble);
} }
public class CachedFurn extends CachedRecipe{
public PositionedStack ingredient;
public PositionedStack resultOne;
public CachedFurn(ItemStack in, ItemStack resultOne){
in.stackSize = 1;
this.ingredient = new PositionedStack(in, 51, 21);
this.resultOne = new PositionedStack(resultOne, 50, 69);
}
@Override
public List<PositionedStack> getIngredients(){
return getCycledIngredients(cycleticks/48, Collections.singletonList(ingredient));
}
@Override
public PositionedStack getResult(){
return resultOne;
}
}
@Override @Override
public Class<? extends GuiContainer> getGuiClass(){ public Class<? extends GuiContainer> getGuiClass(){
return GuiFurnaceDouble.class; return GuiFurnaceDouble.class;
@ -111,7 +89,9 @@ public class FurnaceDoubleRecipeHandler extends TemplateRecipeHandler implements
arecipes.add(new CachedFurn(recipe.getKey(), recipe.getValue())); arecipes.add(new CachedFurn(recipe.getKey(), recipe.getValue()));
} }
} }
else super.loadCraftingRecipes(outputId, results); else{
super.loadCraftingRecipes(outputId, results);
}
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -119,8 +99,9 @@ public class FurnaceDoubleRecipeHandler extends TemplateRecipeHandler implements
public void loadCraftingRecipes(ItemStack result){ public void loadCraftingRecipes(ItemStack result){
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>)FurnaceRecipes.smelting().getSmeltingList(); Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>)FurnaceRecipes.smelting().getSmeltingList();
for(Map.Entry<ItemStack, ItemStack> recipe : recipes.entrySet()){ for(Map.Entry<ItemStack, ItemStack> recipe : recipes.entrySet()){
if(NEIServerUtils.areStacksSameType(recipe.getValue(), result)) if(NEIServerUtils.areStacksSameType(recipe.getValue(), result)){
arecipes.add(new CachedFurn(recipe.getKey(), recipe.getValue())); arecipes.add(new CachedFurn(recipe.getKey(), recipe.getValue()));
}
} }
} }
@ -141,4 +122,26 @@ public class FurnaceDoubleRecipeHandler extends TemplateRecipeHandler implements
public String getOverlayIdentifier(){ public String getOverlayIdentifier(){
return NAME; return NAME;
} }
public class CachedFurn extends CachedRecipe{
public PositionedStack ingredient;
public PositionedStack resultOne;
public CachedFurn(ItemStack in, ItemStack resultOne){
in.stackSize = 1;
this.ingredient = new PositionedStack(in, 51, 21);
this.resultOne = new PositionedStack(resultOne, 50, 69);
}
@Override
public List<PositionedStack> getIngredients(){
return getCycledIngredients(cycleticks/48, Collections.singletonList(ingredient));
}
@Override
public PositionedStack getResult(){
return resultOne;
}
}
} }

Some files were not shown because too many files have changed in this diff Show more