-Phantom Booster

-Coffee Machine
-Paxels
This commit is contained in:
Ellpeck 2015-06-12 19:12:06 +02:00
parent aecea40bb9
commit 2c6bcd72cf
123 changed files with 2418 additions and 473 deletions

View file

@ -18,12 +18,12 @@ buildscript {
apply plugin: 'forge'
apply plugin: 'maven'
version = "1.7.10-0.0.5.3"
version = "1.7.10-0.0.5.4"
group = "ellpeck.actuallyadditions"
archivesBaseName = "ActuallyAdditions"
minecraft {
version = "1.7.10-10.13.3.1395-1710ls"
version = "1.7.10-10.13.3.1428-1.7.10"
runDir = "idea"
}
@ -39,16 +39,10 @@ repositories {
}
dependencies {
compile "mcp.mobius.waila:Waila:1.5.6_1.7.10"
}
task copyChickenBones(type: Copy, dependsOn: "extractUserDev") {
from { configurations.compile }
include "**/*Chicken*.jar", "**/*NotEnoughItems*.jar"
exclude "**/CodeChickenLib*"
into file("./run/mods")
mustRunAfter "deobfBinJar"
mustRunAfter "repackMinecraft"
compile "mcp.mobius.waila:Waila:1.5.10_1.7.10"
compile "codechicken:CodeChickenLib:1.7.10-1.1.1.99:dev"
compile "codechicken:CodeChickenCore:1.7.10-1.0.4.29:dev"
compile "codechicken:NotEnoughItems:1.7.10-1.0.3.74:dev"
}
processResources{

View file

@ -39,8 +39,8 @@ public class ActuallyAdditions{
public void preInit(FMLPreInitializationEvent event){
Util.logInfo("Starting PreInitialization Phase...");
PacketHandler.init();
ConfigurationHandler.init(event.getSuggestedConfigurationFile());
PacketHandler.init();
InitItemMaterials.init();
InitBlocks.init();
InitItems.init();

View file

@ -14,7 +14,6 @@
-Attracts/Repulses Mobs
-Has an aggressive and a friendly version
-Maybe for Items
-Crafted with an Ender Casing
-Void Bag
-Sucks up picked up Items
@ -83,7 +82,18 @@
-Ring of Water Absorption: Removes Water around
-Ring of Striptease (Or something like that): Attacker lose parts of their Armor
-Coffee
-Coffee Machine
-Coffee Cup
-Bedrockium Coffee Cup
-Food Cannon
-Shoots Food Items
-Damage varies with Food
-Furniture
-Can be put into a Crafting Table with a Banner to give it a pattern (1.8!)
-Parts of the furniture can have different types (eg. Wood, Stone etc.) -> Via Crafting or Tool?
-Tinker's Concrete
-Customizable with Items in Concrete Mixer
-(eg. Redstone->Speed Glowstone->Light etc.)
-XP Solidifier
-Block that creates Solidified Experience from Player's Levels
-Has a GUI with Buttons

View file

@ -0,0 +1,139 @@
package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.tile.TileEntityCoffeeMachine;
import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.INameableItem;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import java.util.List;
public class BlockCoffeeMachine extends BlockContainerBase implements INameableItem{
public BlockCoffeeMachine(){
super(Material.rock);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
float f = 1/16F;
this.setBlockBounds(f, 0F, f, 1F-f, 1F-2*f, 1F-f);
}
@Override
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;
if(rotation == 0) world.setBlockMetadataWithNotify(x, y, z, 2, 0);
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
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){
if(!world.isRemote){
TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine)world.getTileEntity(x, y, z);
if (machine != null) player.openGui(ActuallyAdditions.instance, GuiHandler.COFFEE_MACHINE_ID, world, x, y, z);
return true;
}
return true;
}
@Override
public IIcon getIcon(int side, int metadata){
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = Blocks.coal_block.getIcon(0, 0);
}
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
public boolean renderAsNormalBlock(){
return false;
}
@Override
public int getRenderType(){
return RenderingRegistry.getNextAvailableRenderId();
}
@Override
public TileEntity createNewTileEntity(World world, int meta){
return new TileEntityCoffeeMachine();
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
@Override
public String getName(){
return "blockCoffeeMachine";
}
@Override
public String getOredictName(){
return this.getName();
}
public static class TheItemBlock extends ItemBlock{
private Block theBlock;
public TheItemBlock(Block block){
super(block);
this.theBlock = block;
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
BlockUtil.addInformation(theBlock, list, 5, "");
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -23,10 +23,10 @@ import java.util.List;
public class BlockFurnaceSolar extends BlockContainerBase implements INameableItem{
public BlockFurnaceSolar(){
super(Material.wood);
this.setHarvestLevel("axe", 0);
super(Material.rock);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeWood);
this.setStepSound(soundTypeStone);
this.setBlockBounds(0F, 0F, 0F, 1F, 3F/16F, 1F);
}

View file

@ -45,7 +45,7 @@ public class BlockMisc extends Block implements INameableItem{
@Override
public IIcon getIcon(int side, int metadata){
return textures[metadata];
return metadata >= textures.length ? null : textures[metadata];
}
@Override
@ -79,12 +79,12 @@ public class BlockMisc extends Block implements INameableItem{
@Override
public EnumRarity getRarity(ItemStack stack){
return allMiscBlocks[stack.getItemDamage()].rarity;
return stack.getItemDamage() >= allMiscBlocks.length ? EnumRarity.common : allMiscBlocks[stack.getItemDamage()].rarity;
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allMiscBlocks[stack.getItemDamage()].getName();
return this.getUnlocalizedName() + (stack.getItemDamage() >= allMiscBlocks.length ? " ERROR!" : allMiscBlocks[stack.getItemDamage()].getName());
}
@Override

View file

@ -0,0 +1,109 @@
package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityPhantomBooster;
import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.INameableItem;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import java.util.List;
public class BlockPhantomBooster extends BlockContainerBase implements INameableItem{
public BlockPhantomBooster(){
super(Material.rock);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
float f = 1F/16F;
this.setBlockBounds(3*f, 0F, 3*f, 1-3*f, 1F, 1-3*f);
}
@Override
public String getOredictName(){
return this.getName();
}
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
public boolean renderAsNormalBlock(){
return false;
}
@Override
public int getRenderType(){
return RenderingRegistry.getNextAvailableRenderId();
}
@Override
public IIcon getIcon(int side, int metadata){
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = Blocks.lapis_block.getIcon(0, 0);
}
@Override
public String getName(){
return "blockPhantomBooster";
}
@Override
public TileEntity createNewTileEntity(World world, int i){
return new TileEntityPhantomBooster();
}
public static class TheItemBlock extends ItemBlock{
private Block theBlock;
public TheItemBlock(Block block){
super(block);
this.theBlock = block;
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic;
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
BlockUtil.addInformation(theBlock, list, 2, "");
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -63,9 +63,10 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
if(tile != null){
if(tile instanceof TileEntityPhantomface){
TileEntityPhantomface phantom = (TileEntityPhantomface)tile;
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + phantom.range));
if(phantom.hasBoundTile()){
if(phantom.isBoundTileInRage()) player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", phantom.boundTile.xCoord, phantom.boundTile.yCoord, phantom.boundTile.zCoord)));
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc", phantom.boundTile.xCoord, phantom.boundTile.yCoord, phantom.boundTile.zCoord)));
if(phantom.isBoundTileInRage()) player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", phantom.boundPosition.posX, phantom.boundPosition.posY, phantom.boundPosition.posZ)));
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc", phantom.boundPosition.posX, phantom.boundPosition.posY, phantom.boundPosition.posZ)));
}
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc")));
}
@ -73,6 +74,7 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
else if(tile instanceof TileEntityPhantomPlacer){
if(player.isSneaking()){
TileEntityPhantomPlacer phantom = (TileEntityPhantomPlacer)tile;
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + phantom.range));
if(phantom.hasBoundPosition()){
if(phantom.isBoundPositionInRange()) player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", phantom.boundPosition.posX, phantom.boundPosition.posY, phantom.boundPosition.posZ)));
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc", phantom.boundPosition.posX, phantom.boundPosition.posY, phantom.boundPosition.posZ)));
@ -159,7 +161,6 @@ public class BlockPhantomface extends BlockContainerBase implements INameableIte
if(((BlockPhantomface)this.theBlock).type == LIQUIFACE){
list.add(StringUtil.ORANGE+StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomLiquiface.desc.3"));
list.add(StringUtil.ORANGE+StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomLiquiface.desc.4"));
list.add(StringUtil.ORANGE+StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomLiquiface.desc.5"));
}
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc") + ": " + ((BlockPhantomface)theBlock).range);
}

View file

@ -1,12 +1,14 @@
package ellpeck.actuallyadditions.blocks;
import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.EnumRarity;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import org.apache.logging.log4j.Level;
import powercrystals.minefactoryreloaded.api.FactoryRegistry;
public class InitBlocks{
@ -34,6 +36,7 @@ public class InitBlocks{
public static Block blockRice;
public static Block blockCanola;
public static Block blockFlax;
public static Block blockCoffee;
public static Fluid fluidCanolaOil;
public static Block blockCanolaOil;
@ -56,6 +59,9 @@ public class InitBlocks{
public static Block blockFluidCollector;
public static Block blockLavaFactoryController;
public static Block blockCoffeeMachine;
public static Block blockPhantomBooster;
public static void init(){
Util.logInfo("Initializing Blocks...");
@ -63,20 +69,6 @@ public class InitBlocks{
blockLavaFactoryController = new BlockLavaFactoryController();
BlockUtil.register(blockLavaFactoryController, BlockLavaFactoryController.TheItemBlock.class);
fluidCanolaOil = new FluidAA("canolaoil").setDensity(1200).setViscosity(1500).setTemperature(300).setRarity(EnumRarity.uncommon);
FluidRegistry.registerFluid(fluidCanolaOil);
fluidCanolaOil = FluidRegistry.getFluid(fluidCanolaOil.getName());
blockCanolaOil = new BlockFluidFlowing(fluidCanolaOil, Material.water, "blockCanolaOil");
BlockUtil.register(blockCanolaOil, BlockFluidFlowing.TheItemBlock.class, false);
fluidOil = new FluidAA("oil").setDensity(1200).setViscosity(1500).setTemperature(300).setRarity(EnumRarity.uncommon);
FluidRegistry.registerFluid(fluidOil);
fluidOil = FluidRegistry.getFluid(fluidOil.getName());
blockOil = new BlockFluidFlowing(fluidOil, Material.water, "blockOil");
BlockUtil.register(blockOil, BlockFluidFlowing.TheItemBlock.class, false);
blockCanolaPress = new BlockCanolaPress();
BlockUtil.register(blockCanolaPress, BlockCanolaPress.TheItemBlock.class);
@ -115,10 +107,15 @@ public class InitBlocks{
FactoryRegistry.sendMessage("registerFertilizable", blockCanola);
blockFlax = new BlockPlant("blockFlax", 6, 2, 4);
BlockUtil.register(blockFlax, BlockPlant.TheItemBlock.class);
BlockUtil.register(blockFlax, BlockPlant.TheItemBlock.class, false);
FactoryRegistry.sendMessage("registerHarvestable", blockFlax);
FactoryRegistry.sendMessage("registerFertilizable", blockFlax);
blockCoffee = new BlockPlant("blockCoffee", 6, 2, 2);
BlockUtil.register(blockCoffee, BlockPlant.TheItemBlock.class, false);
FactoryRegistry.sendMessage("registerHarvestable", blockCoffee);
FactoryRegistry.sendMessage("registerFertilizable", blockCoffee);
blockCompost = new BlockCompost();
BlockUtil.register(blockCompost, BlockCompost.TheItemBlock.class);
@ -175,5 +172,57 @@ public class InitBlocks{
blockFluidCollector = new BlockFluidCollector(false);
BlockUtil.register(blockFluidCollector, BlockFluidCollector.TheItemBlock.class);
blockCoffeeMachine = new BlockCoffeeMachine();
BlockUtil.register(blockCoffeeMachine, BlockCoffeeMachine.TheItemBlock.class);
blockPhantomBooster = new BlockPhantomBooster();
BlockUtil.register(blockPhantomBooster, BlockPhantomBooster.TheItemBlock.class);
registerFluids();
}
public static void registerFluids(){
String canolaOil = "canolaoil";
if(!FluidRegistry.isFluidRegistered(canolaOil)){
fluidCanolaOil = new FluidAA(canolaOil).setDensity(1200).setViscosity(1500).setTemperature(300).setRarity(EnumRarity.uncommon);
FluidRegistry.registerFluid(fluidCanolaOil);
}
else{
errorAlreadyRegistered("Canola Oil Fluid");
}
fluidCanolaOil = FluidRegistry.getFluid(canolaOil);
if(fluidCanolaOil.getBlock() == null){
blockCanolaOil = new BlockFluidFlowing(fluidCanolaOil, Material.water, "blockCanolaOil");
BlockUtil.register(blockCanolaOil, BlockFluidFlowing.TheItemBlock.class, false);
}
else{
errorAlreadyRegistered("Canola Oil Block");
}
blockCanolaOil = fluidCanolaOil.getBlock();
String oil = "oil";
if(!FluidRegistry.isFluidRegistered(oil)){
fluidOil = new FluidAA(oil).setDensity(1200).setViscosity(1500).setTemperature(300).setRarity(EnumRarity.uncommon);
FluidRegistry.registerFluid(fluidOil);
}
else{
errorAlreadyRegistered("Oil Fluid");
}
fluidOil = FluidRegistry.getFluid(oil);
if(fluidOil.getBlock() == null){
blockOil = new BlockFluidFlowing(fluidOil, Material.water, "blockOil");
BlockUtil.register(blockOil, BlockFluidFlowing.TheItemBlock.class, false);
}
else{
errorAlreadyRegistered("Oil Block");
}
blockOil = fluidOil.getBlock();
}
public static void errorAlreadyRegistered(String str){
ModUtil.LOGGER.log(Level.WARN, str + " from Actually Additions is not getting used as it has already been registered by another Mod! Issues may (but shouldn't) occur!");
}
}

View file

@ -13,7 +13,8 @@ public enum TheMiscBlocks implements INameableItem{
STONE_CASING("StoneCasing", EnumRarity.uncommon, "blockCasingStone"),
CHARCOAL_BLOCK("Charcoal", EnumRarity.common, "blockCharcoal"),
ENDERPEARL_BLOCK("Enderpearl", EnumRarity.rare, "blockEnderpearl"),
LAVA_FACTORY_CASE("LavaFactoryCase", EnumRarity.uncommon, "blockLavaFactoryCase");
LAVA_FACTORY_CASE("LavaFactoryCase", EnumRarity.uncommon, "blockLavaFactoryCase"),
ENDER_CASING("EnderCasing", EnumRarity.epic, "blockEnderCasing");
public final String name;
public final String oredictName;

View file

@ -1,6 +1,7 @@
package ellpeck.actuallyadditions.blocks.render;
import net.minecraft.client.model.ModelBase;
import net.minecraft.tileentity.TileEntity;
public class ModelBaseAA extends ModelBase{
@ -11,4 +12,12 @@ public class ModelBaseAA extends ModelBase{
public String getName(){
return null;
}
public void renderExtra(float f, TileEntity tile){
}
public boolean doesRotate(){
return false;
}
}

View file

@ -0,0 +1,137 @@
package ellpeck.actuallyadditions.blocks.render;
import net.minecraft.client.model.ModelRenderer;
public class ModelCoffeeMachine extends ModelBaseAA{
ModelRenderer p1;
ModelRenderer p2;
ModelRenderer p3;
ModelRenderer p4;
ModelRenderer p5;
ModelRenderer p6;
ModelRenderer p7;
ModelRenderer p8;
ModelRenderer p9;
ModelRenderer p10;
ModelRenderer p11;
ModelRenderer p12;
ModelRenderer p13;
public ModelCoffeeMachine(){
textureWidth = 128;
textureHeight = 128;
p1 = new ModelRenderer(this, 0, 0);
p1.addBox(0F, 0F, 0F, 10, 1, 14);
p1.setRotationPoint(-5F, 23F, -7F);
p1.setTextureSize(128, 128);
p1.mirror = true;
setRotation(p1, 0F, 0F, 0F);
p2 = new ModelRenderer(this, 49, 0);
p2.addBox(0F, 0F, 0F, 10, 8, 6);
p2.setRotationPoint(-5F, 15F, 1F);
p2.setTextureSize(128, 128);
p2.mirror = true;
setRotation(p2, 0F, 0F, 0F);
p3 = new ModelRenderer(this, 0, 16);
p3.addBox(0F, 0F, 0F, 10, 2, 11);
p3.setRotationPoint(-5F, 13F, -4F);
p3.setTextureSize(128, 128);
p3.mirror = true;
setRotation(p3, 0F, 0F, 0F);
p4 = new ModelRenderer(this, 43, 16);
p4.addBox(0F, 0F, 0F, 8, 3, 8);
p4.setRotationPoint(-4F, 10F, -1F);
p4.setTextureSize(128, 128);
p4.mirror = true;
setRotation(p4, 0F, 0F, 0F);
p5 = new ModelRenderer(this, 0, 30);
p5.addBox(0F, 0F, 0F, 2, 1, 2);
p5.setRotationPoint(-1F, 15F, -3.5F);
p5.setTextureSize(128, 128);
p5.mirror = true;
setRotation(p5, 0F, 0F, 0F);
p6 = new ModelRenderer(this, 82, 0);
p6.addBox(0F, 0F, 0F, 4, 5, 1);
p6.setRotationPoint(-2F, 17F, -1F);
p6.setTextureSize(128, 128);
p6.mirror = true;
setRotation(p6, 0F, 0F, 0F);
p7 = new ModelRenderer(this, 82, 0);
p7.addBox(0F, 0F, 0F, 4, 5, 1);
p7.setRotationPoint(-2F, 17F, -6F);
p7.setTextureSize(128, 128);
p7.mirror = true;
setRotation(p7, 0F, 0F, 0F);
p8 = new ModelRenderer(this, 82, 0);
p8.addBox(0F, 0F, 0F, 4, 5, 1);
p8.setRotationPoint(2F, 17F, -1F);
p8.setTextureSize(128, 128);
p8.mirror = true;
setRotation(p8, 0F, 1.570796F, 0F);
p9 = new ModelRenderer(this, 82, 0);
p9.addBox(0F, 0F, 0F, 4, 5, 1);
p9.setRotationPoint(-3F, 17F, -1F);
p9.setTextureSize(128, 128);
p9.mirror = true;
setRotation(p9, 0F, 1.570796F, 0F);
p10 = new ModelRenderer(this, 93, 0);
p10.addBox(0F, 0F, 0F, 4, 1, 4);
p10.setRotationPoint(-2F, 22F, -5F);
p10.setTextureSize(128, 128);
p10.mirror = true;
setRotation(p10, 0F, 0F, 0F);
p11 = new ModelRenderer(this, 82, 7);
p11.addBox(0F, 0F, 0F, 1, 1, 2);
p11.setRotationPoint(-4F, 18F, -4F);
p11.setTextureSize(128, 128);
p11.mirror = true;
setRotation(p11, 0F, 0F, 0F);
p12 = new ModelRenderer(this, 82, 7);
p12.addBox(0F, 0F, 0F, 1, 1, 2);
p12.setRotationPoint(-4F, 21F, -4F);
p12.setTextureSize(128, 128);
p12.mirror = true;
setRotation(p12, 0F, 0F, 0F);
p13 = new ModelRenderer(this, 89, 7);
p13.addBox(0F, 0F, 0F, 1, 2, 2);
p13.setRotationPoint(-5F, 19F, -4F);
p13.setTextureSize(128, 128);
p13.mirror = true;
setRotation(p13, 0F, 0F, 0F);
}
@Override
public void render(float f){
p1.render(f);
p2.render(f);
p3.render(f);
p4.render(f);
p5.render(f);
p6.render(f);
p7.render(f);
p8.render(f);
p9.render(f);
p10.render(f);
p11.render(f);
p12.render(f);
p13.render(f);
}
private void setRotation(ModelRenderer model, float x, float y, float z){
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
@Override
public String getName(){
return "modelCoffeeMachine";
}
@Override
public boolean doesRotate(){
return true;
}
}

View file

@ -2,6 +2,7 @@ package ellpeck.actuallyadditions.blocks.render;
import ellpeck.actuallyadditions.tile.TileEntityCompost;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.tileentity.TileEntity;
public class ModelCompost extends ModelBaseAA{
@ -43,15 +44,17 @@ public class ModelCompost extends ModelBaseAA{
this.innerDone.addBox(0.0F, 0.0F, 0.0F, 12, 13, 12, 0.0F);
}
public void renderExtra(float f, TileEntityCompost tile){
@Override
public void renderExtra(float f, TileEntity tile){
TileEntityCompost tileCompost = (TileEntityCompost)tile;
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
if(meta > 0 && meta <= tile.amountNeededToConvert){
int heightToDisplay = meta*13/tile.amountNeededToConvert;
if(meta > 0 && meta <= tileCompost.amountNeededToConvert){
int heightToDisplay = meta*13/tileCompost.amountNeededToConvert;
if(heightToDisplay > 13) heightToDisplay = 13;
this.innerRawList[heightToDisplay-1].render(f);
}
if(meta == tile.amountNeededToConvert+1){
if(meta == tileCompost.amountNeededToConvert+1){
this.innerDone.render(f);
}
}

View file

@ -0,0 +1,148 @@
package ellpeck.actuallyadditions.blocks.render;
import net.minecraft.client.model.ModelRenderer;
public class ModelPhantomBooster extends ModelBaseAA{
ModelRenderer s1;
ModelRenderer s2;
ModelRenderer s3;
ModelRenderer s4;
ModelRenderer s5;
ModelRenderer s6;
ModelRenderer s7;
ModelRenderer s8;
ModelRenderer s9;
ModelRenderer s10;
ModelRenderer s11;
ModelRenderer s12;
ModelRenderer s13;
ModelRenderer s14;
ModelRenderer s15;
public ModelPhantomBooster(){
textureWidth = 128;
textureHeight = 128;
s1 = new ModelRenderer(this, 0, 0);
s1.addBox(0F, 0F, 0F, 4, 16, 4);
s1.setRotationPoint(-2F, 8F, -2F);
s1.setTextureSize(128, 128);
s1.mirror = true;
setRotation(s1, 0F, 0F, 0F);
s2 = new ModelRenderer(this, 17, 0);
s2.addBox(0F, 0F, 0F, 6, 1, 6);
s2.setRotationPoint(-3F, 9F, -3F);
s2.setTextureSize(128, 128);
s2.mirror = true;
setRotation(s2, 0F, 0F, 0F);
s3 = new ModelRenderer(this, 17, 0);
s3.addBox(0F, 0F, 0F, 6, 1, 6);
s3.setRotationPoint(-3F, 22F, -3F);
s3.setTextureSize(128, 128);
s3.mirror = true;
setRotation(s3, 0F, 0F, 0F);
s4 = new ModelRenderer(this, 17, 8);
s4.addBox(0F, 0F, 0F, 6, 2, 1);
s4.setRotationPoint(-3F, 10F, -4F);
s4.setTextureSize(128, 128);
s4.mirror = true;
setRotation(s4, 0F, 0F, 0F);
s5 = new ModelRenderer(this, 17, 8);
s5.addBox(0F, 0F, 0F, 6, 2, 1);
s5.setRotationPoint(-3F, 10F, 3F);
s5.setTextureSize(128, 128);
s5.mirror = true;
setRotation(s5, 0F, 0F, 0F);
s6 = new ModelRenderer(this, 17, 8);
s6.addBox(0F, 0F, 0F, 6, 2, 1);
s6.setRotationPoint(-4F, 10F, 3F);
s6.setTextureSize(128, 128);
s6.mirror = true;
setRotation(s6, 0F, 1.579523F, 0F);
s7 = new ModelRenderer(this, 17, 8);
s7.addBox(0F, 0F, 0F, 6, 2, 1);
s7.setRotationPoint(3F, 10F, 3F);
s7.setTextureSize(128, 128);
s7.mirror = true;
setRotation(s7, 0F, 1.579523F, 0F);
s8 = new ModelRenderer(this, 17, 12);
s8.addBox(0F, 0F, 0F, 6, 8, 1);
s8.setRotationPoint(-3F, 12F, -5F);
s8.setTextureSize(128, 128);
s8.mirror = true;
setRotation(s8, 0F, 0F, 0F);
s9 = new ModelRenderer(this, 17, 12);
s9.addBox(0F, 0F, 0F, 6, 8, 1);
s9.setRotationPoint(-3F, 12F, 4F);
s9.setTextureSize(128, 128);
s9.mirror = true;
setRotation(s9, 0F, 0F, 0F);
s10 = new ModelRenderer(this, 17, 12);
s10.addBox(0F, 0F, 0F, 6, 8, 1);
s10.setRotationPoint(-5F, 12F, 3F);
s10.setTextureSize(128, 128);
s10.mirror = true;
setRotation(s10, 0F, 1.579523F, 0F);
s11 = new ModelRenderer(this, 17, 12);
s11.addBox(0F, 0F, 0F, 6, 8, 1);
s11.setRotationPoint(4F, 12F, 3F);
s11.setTextureSize(128, 128);
s11.mirror = true;
setRotation(s11, 0F, 1.579523F, 0F);
s12 = new ModelRenderer(this, 17, 8);
s12.addBox(0F, 0F, 0F, 6, 2, 1);
s12.setRotationPoint(-4F, 20F, 3F);
s12.setTextureSize(128, 128);
s12.mirror = true;
setRotation(s12, 0F, 1.579523F, 0F);
s13 = new ModelRenderer(this, 17, 8);
s13.addBox(0F, 0F, 0F, 6, 2, 1);
s13.setRotationPoint(-3F, 20F, 3F);
s13.setTextureSize(128, 128);
s13.mirror = true;
setRotation(s13, 0F, 0F, 0F);
s14 = new ModelRenderer(this, 17, 8);
s14.addBox(0F, 0F, 0F, 6, 2, 1);
s14.setRotationPoint(3F, 20F, 3F);
s14.setTextureSize(128, 128);
s14.mirror = true;
setRotation(s14, 0F, 1.579523F, 0F);
s15 = new ModelRenderer(this, 17, 8);
s15.addBox(0F, 0F, 0F, 6, 2, 1);
s15.setRotationPoint(-3F, 20F, -4F);
s15.setTextureSize(128, 128);
s15.mirror = true;
setRotation(s15, 0F, 0F, 0F);
}
@Override
public void render(float f){
s1.render(f);
s2.render(f);
s3.render(f);
s4.render(f);
s5.render(f);
s6.render(f);
s7.render(f);
s8.render(f);
s9.render(f);
s10.render(f);
s11.render(f);
s12.render(f);
s13.render(f);
s14.render(f);
s15.render(f);
}
@Override
public String getName(){
return "modelPhantomBooster";
}
private void setRotation(ModelRenderer model, float x, float y, float z){
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -1,6 +1,5 @@
package ellpeck.actuallyadditions.blocks.render;
import ellpeck.actuallyadditions.tile.TileEntityCompost;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@ -9,7 +8,7 @@ import org.lwjgl.opengl.GL11;
public class RenderTileEntity extends TileEntitySpecialRenderer{
ModelBaseAA theModel;
public ModelBaseAA theModel;
public RenderTileEntity(ModelBaseAA model){
this.theModel = model;
@ -22,9 +21,16 @@ public class RenderTileEntity extends TileEntitySpecialRenderer{
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, -2.0F, 0.0F);
this.bindTexture(new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/" + this.theModel.getName() + ".png"));
theModel.render(0.0625F);
if(tile instanceof TileEntityCompost && theModel instanceof ModelCompost) ((ModelCompost)theModel).renderExtra(0.0625F, (TileEntityCompost)tile);
if(theModel.doesRotate()){
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
if(meta == 0) GL11.glRotatef(180F, 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.renderExtra(0.0625F, tile);
GL11.glPopMatrix();
}

View file

@ -27,7 +27,8 @@ public enum ConfigBoolValues{
DO_RICE_GEN("Rice Gen", ConfigCategories.WORLD_GEN, true, "If Rice should generate in the World"),
DO_CANOLA_GEN("Canola Gen", ConfigCategories.WORLD_GEN, true, "If Canola should generate in the World"),
DO_FLAX_GEN("Flax Gen", ConfigCategories.WORLD_GEN, true, "If Flax should generate in the World");
DO_FLAX_GEN("Flax Gen", ConfigCategories.WORLD_GEN, true, "If Flax should generate in the World"),
DO_COFFEE_GEN("Coffee Gen", ConfigCategories.WORLD_GEN, true, "If Coffee should generate in the World");
public final String name;
public final String category;

View file

@ -60,7 +60,6 @@ public enum ConfigCrafting{
RING_WATER_BREATHING("Water Breathing Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_INVISIBILITY("Invisibility Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_NIGHT_VISION("Night Vision Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_SATURATION("Saturation Ring", ConfigCategories.POTION_RING_CRAFTING, false),
DOUGH("Dough", ConfigCategories.ITEMS_CRAFTING),
PAPER_CONE("Paper Cone", ConfigCategories.ITEMS_CRAFTING),
@ -87,7 +86,15 @@ public enum ConfigCrafting{
PHANTOM_PLACER("Phantom Placer", ConfigCategories.BLOCKS_CRAFTING),
PHANTOM_BREAKER("Phantom Breaker", ConfigCategories.BLOCKS_CRAFTING),
LIQUID_PLACER("Liquid Placer", ConfigCategories.BLOCKS_CRAFTING),
LIQUID_BREAKER("Liquid Collector", ConfigCategories.BLOCKS_CRAFTING);
LIQUID_BREAKER("Liquid Collector", ConfigCategories.BLOCKS_CRAFTING),
CUP("Cup", ConfigCategories.ITEMS_CRAFTING),
PAXELS("Paxels", ConfigCategories.ITEMS_CRAFTING),
ENDER_CASING("Ender Casing", ConfigCategories.BLOCKS_CRAFTING),
PHANTOM_BOOSTER("Phantom Booster", ConfigCategories.BLOCKS_CRAFTING),
COFFEE_MACHINE("Coffee Machine", ConfigCategories.BLOCKS_CRAFTING),
LAVA_FACTORY("Lava Factory", ConfigCategories.BLOCKS_CRAFTING);
public final String name;
public final String category;

View file

@ -52,7 +52,8 @@ public enum ConfigIntValues{
RICE_AMOUNT("Rice Amount", ConfigCategories.WORLD_GEN, 15, 1, 100, "The Chance of Rice generating"),
CANOLA_AMOUNT("Canola Amount", ConfigCategories.WORLD_GEN, 10, 1, 50, "The Chance of Canola generating"),
FLAX_AMOUNT("Flax Amount", ConfigCategories.WORLD_GEN, 5, 1, 50, "The Chance of Flax generating"),
FLAX_AMOUNT("Flax Amount", ConfigCategories.WORLD_GEN, 8, 1, 50, "The Chance of Flax generating"),
COFFEE_AMOUNT("Coffee Amount", ConfigCategories.WORLD_GEN, 4, 1, 50, "The Chance of Coffee generating"),
GRINDER_ENERGY_USED("Energy Use: Crusher", ConfigCategories.MACHINE_VALUES, 40, 1, 500, "The Amount of Energy used by the Crusher per Tick"),
GRINDER_DOUBLE_ENERGY_USED("Energy Use: Double Crusher", ConfigCategories.MACHINE_VALUES, 60, 1, 500, "The Amount of Energy used by the Double Crusher per Tick"),
@ -79,7 +80,14 @@ public enum ConfigIntValues{
PHANTOM_PLACER_RANGE("Phantom Placer and Breaker: Range", ConfigCategories.MACHINE_VALUES, 3, 1, 100, "The Default Range of the Phantom Placer/Breaker"),
LAVA_FACTORY_ENERGY_USED("Lava Factory: Energy Used", ConfigCategories.MACHINE_VALUES, 150000, 10, 3000000, "The amount of Energy used by the Lava Factory per Bucket of Lava produced"),
LAVA_FACTORY_TIME("Lava Factory: Production Time", ConfigCategories.MACHINE_VALUES, 200, 5, 10000, "The amount of time it takes for the Lava Factory to produce one Bucket");
LAVA_FACTORY_TIME("Lava Factory: Production Time", ConfigCategories.MACHINE_VALUES, 200, 5, 10000, "The amount of time it takes for the Lava Factory to produce one Bucket"),
COFFEE_MACHINE_ENERGY_USED("Coffee Machine: Energy Used", ConfigCategories.MACHINE_VALUES, 150, 10, 3000, "The amount of Energy used by the Coffee Machine per Tick"),
COFFEE_CACHE_ADDED_PER_ITEM("Coffee Machine: Coffee added per Item", ConfigCategories.MACHINE_VALUES, 1, 1, 300, "The amount of Coffee added by one Coffee Item in the Coffee Machine"),
COFFEE_CACHE_USED_PER_ITEM("Coffee Machine: Coffee used per Item", ConfigCategories.MACHINE_VALUES, 10, 1, 300, "The amount of Coffee used to brew one Coffee in the Coffee Machine"),
COFFEE_MACHINE_TIME_USED("Coffee Machine: Time to Brew", ConfigCategories.MACHINE_VALUES, 500, 10, 10000, "The amount of time the Coffee Machine takes to brew a Coffee"),
COFFEE_DRINK_AMOUNT("Coffee: Drink Amount", ConfigCategories.OTHER, 4, 1, 100, "How often a Coffee can be drunk from");
public final String name;
public final String category;

View file

@ -39,6 +39,45 @@ public class BlockCrafting{
'R', "dustRedstone",
'S', "stickWood"));
//Ender Casing
if(ConfigCrafting.ENDER_CASING.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal()),
"WSW", "SRS", "WSW",
'W', TheMiscBlocks.ENDERPEARL_BLOCK.getOredictName(),
'R', TheMiscBlocks.QUARTZ.getOredictName(),
'S', Blocks.obsidian));
//Phantom Booster
if(ConfigCrafting.PHANTOM_BOOSTER.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockPhantomBooster),
"RDR", "DCD", "RDR",
'R', "dustRedstone",
'D', "gemDiamond",
'C', TheMiscBlocks.ENDER_CASING.getOredictName()));
//Coffee Machine
if(ConfigCrafting.COFFEE_MACHINE.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockCoffeeMachine),
" C ", " S ", "A A",
'C', ((INameableItem)InitItems.itemCoffeeBean).getOredictName(),
'S', TheMiscBlocks.STONE_CASING.getOredictName(),
'A', TheMiscItems.COIL.getOredictName()));
//Lava Factory
if(ConfigCrafting.LAVA_FACTORY.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockLavaFactoryController),
" C ", "ISI", " L ",
'C', TheMiscBlocks.STONE_CASING.getOredictName(),
'S', TheMiscItems.COIL_ADVANCED.getOredictName(),
'I', "blockIron",
'L', Items.lava_bucket));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 4, TheMiscBlocks.LAVA_FACTORY_CASE.ordinal()),
"ICI",
'C', TheMiscBlocks.STONE_CASING.getOredictName(),
'I', "blockIron"));
}
//Canola Press
if(ConfigCrafting.CANOLA_PRESS.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockCanolaPress),
@ -256,7 +295,7 @@ public class BlockCrafting{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGreenhouseGlass),
"GSG", "SDS", "GSG",
'G', "blockGlass",
'D', "gemDiamond",
'D', Blocks.obsidian,
'S', "treeSapling"));
//Placer

View file

@ -6,6 +6,7 @@ import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
import ellpeck.actuallyadditions.config.values.ConfigCrafting;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.*;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@ -50,6 +51,59 @@ public class ItemCrafting{
'I', "ingotIron",
'R', "dustRedstone"));
//Cup
if(ConfigCrafting.CUP.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()),
"S S", "SCS", "SSS",
'S', "stone",
'C', ((INameableItem)InitItems.itemCoffeeBean).getOredictName()));
//Paxels
if(ConfigCrafting.PAXELS.isEnabled()){
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.woodenPaxel),
new ItemStack(Items.wooden_axe),
new ItemStack(Items.wooden_pickaxe),
new ItemStack(Items.wooden_shovel),
new ItemStack(Items.wooden_sword),
new ItemStack(Items.wooden_hoe)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.stonePaxel),
new ItemStack(Items.stone_axe),
new ItemStack(Items.stone_pickaxe),
new ItemStack(Items.stone_shovel),
new ItemStack(Items.stone_sword),
new ItemStack(Items.stone_hoe)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.ironPaxel),
new ItemStack(Items.iron_axe),
new ItemStack(Items.iron_pickaxe),
new ItemStack(Items.iron_shovel),
new ItemStack(Items.iron_sword),
new ItemStack(Items.iron_hoe)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.goldPaxel),
new ItemStack(Items.golden_axe),
new ItemStack(Items.golden_pickaxe),
new ItemStack(Items.golden_shovel),
new ItemStack(Items.golden_sword),
new ItemStack(Items.golden_hoe)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.diamondPaxel),
new ItemStack(Items.diamond_axe),
new ItemStack(Items.diamond_pickaxe),
new ItemStack(Items.diamond_shovel),
new ItemStack(Items.diamond_sword),
new ItemStack(Items.diamond_hoe)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.emeraldPaxel),
new ItemStack(InitItems.itemAxeEmerald),
new ItemStack(InitItems.itemPickaxeEmerald),
new ItemStack(InitItems.itemSwordEmerald),
new ItemStack(InitItems.itemShovelEmerald),
new ItemStack(InitItems.itemHoeEmerald)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.obsidianPaxel),
new ItemStack(InitItems.itemAxeObsidian),
new ItemStack(InitItems.itemPickaxeObsidian),
new ItemStack(InitItems.itemSwordObsidian),
new ItemStack(InitItems.itemShovelObsidian),
new ItemStack(InitItems.itemHoeObsidian)));
}
//Resonant Rice
if(ConfigCrafting.RESONANT_RICE.isEnabled())
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemResonantRice),
@ -164,8 +218,6 @@ public class ItemCrafting{
if(ConfigCrafting.RING_WATER_BREATHING.isEnabled()) addRingRecipeWithStack(ThePotionRings.WATER_BREATHING.craftingItem, ThePotionRings.WATER_BREATHING.ordinal());
if(ConfigCrafting.RING_INVISIBILITY.isEnabled()) addRingRecipeWithStack(ThePotionRings.INVISIBILITY.craftingItem, ThePotionRings.INVISIBILITY.ordinal());
if(ConfigCrafting.RING_NIGHT_VISION.isEnabled()) addRingRecipeWithStack(ThePotionRings.NIGHT_VISION.craftingItem, ThePotionRings.NIGHT_VISION.ordinal());
if(ConfigCrafting.RING_SATURATION.isEnabled()) addRingRecipeWithStack(ThePotionRings.SATURATION.craftingItem, ThePotionRings.SATURATION.ordinal());
}
public static void addRingRecipeWithStack(ItemStack mainStack, int meta){

View file

@ -31,6 +31,8 @@ public class CreativeTab extends CreativeTabs{
this.addBlock(InitBlocks.blockPhantomLiquiface);
this.addBlock(InitBlocks.blockPhantomPlacer);
this.addBlock(InitBlocks.blockPhantomBreaker);
this.addBlock(InitBlocks.blockPhantomBooster);
this.addBlock(InitBlocks.blockCoffeeMachine);
this.addBlock(InitBlocks.blockInputter);
this.addBlock(InitBlocks.blockInputterAdvanced);
@ -63,6 +65,8 @@ public class CreativeTab extends CreativeTabs{
this.addItem(InitItems.itemBucketCanolaOil);
this.addItem(InitItems.itemBucketOil);
this.addItem(InitItems.itemCoffeeSeed);
this.addItem(InitItems.itemCoffeeBean);
this.addItem(InitItems.itemRiceSeed);
this.addItem(InitItems.itemCanolaSeed);
this.addItem(InitItems.itemFlaxSeed);
@ -70,6 +74,8 @@ public class CreativeTab extends CreativeTabs{
this.addItem(InitItems.itemMisc);
this.addItem(InitItems.itemResonantRice);
this.addItem(InitItems.itemFertilizer);
this.addItem(InitItems.itemCoffee);
this.addItem(InitItems.itemFoods);
this.addItem(InitItems.itemKnife);
this.addItem(InitItems.itemCrafterOnAStick);
@ -78,6 +84,14 @@ public class CreativeTab extends CreativeTabs{
this.addItem(InitItems.itemLeafBlower);
this.addItem(InitItems.itemLeafBlowerAdvanced);
this.addItem(InitItems.woodenPaxel);
this.addItem(InitItems.stonePaxel);
this.addItem(InitItems.ironPaxel);
this.addItem(InitItems.goldPaxel);
this.addItem(InitItems.diamondPaxel);
this.addItem(InitItems.emeraldPaxel);
this.addItem(InitItems.obsidianPaxel);
this.addItem(InitItems.itemPickaxeEmerald);
this.addItem(InitItems.itemSwordEmerald);
this.addItem(InitItems.itemAxeEmerald);

View file

@ -2,7 +2,6 @@ package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import ellpeck.actuallyadditions.blocks.BlockFluidFlowing;
import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.items.InitItems;
import net.minecraft.block.Block;
@ -14,16 +13,14 @@ public class BucketFillEvent{
@SubscribeEvent
public void onBucketFilled(FillBucketEvent event){
Block block = event.world.getBlock(event.target.blockX, event.target.blockY, event.target.blockZ);
if(block instanceof BlockFluidFlowing){
if(block == InitBlocks.blockCanolaOil){
event.world.setBlockToAir(event.target.blockX, event.target.blockY, event.target.blockZ);
event.result = new ItemStack(InitItems.itemBucketCanolaOil);
event.setResult(Event.Result.ALLOW);
}
if(block == InitBlocks.blockOil){
event.world.setBlockToAir(event.target.blockX, event.target.blockY, event.target.blockZ);
event.result = new ItemStack(InitItems.itemBucketOil);
}
event.setResult(Event.Result.ALLOW);
}
}

View file

@ -15,6 +15,7 @@ public class RenderPlayerEventAA{
private RenderSpecial hoseRender = new RenderSpecial(new ModelTorch());
//private RenderSpecial paktoRender = new RenderSpecial(new ModelStandardBlock("Pakto"));
private RenderSpecial glenRender = new RenderSpecial(new ModelStandardBlock("Glenthor"));
private RenderSpecial lordiRender = new RenderSpecial(new ModelStandardBlock("Lordi"));
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void RenderPlayerEvent(RenderPlayerEvent.Pre event){
@ -40,6 +41,12 @@ public class RenderPlayerEventAA{
//dqmhose
if(event.entityPlayer.getUniqueID().equals(UUID.fromString("cb7b293a-5031-484e-b5be-b4f2f4e92726"))){
hoseRender.render(event.entityPlayer, event.partialRenderTick, 0.5F, 1.3F);
return;
}
//Lordi
if(event.entityPlayer.getUniqueID().equals(UUID.fromString("990ecf6d-15dd-442c-b91b-323a6420c78e"))){
lordiRender.render(event.entityPlayer, event.partialRenderTick, 0.3F, 1F);
}
}
}

View file

@ -38,6 +38,7 @@ public class WorldDecorationEvent{
this.genPlantNormally(InitBlocks.blockCanola, ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.grass, event);
this.genPlantNormally(InitBlocks.blockFlax, ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.grass, event);
this.genPlantNormally(InitBlocks.blockCoffee, ConfigIntValues.COFFEE_AMOUNT.getValue(), ConfigBoolValues.DO_COFFEE_GEN.isEnabled(), Material.grass, event);
}
public void genPlantNormally(Block plant, int amount, boolean doIt, Material blockBelow, DecorateBiomeEvent event){

View file

@ -42,7 +42,7 @@ public class RenderSpecial{
GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
GL11.glScalef(size, size, size);
if(!(time-(bobHeight/2) < lastTimeForBobbing)){
if(time-(bobHeight/2) >= lastTimeForBobbing){
GL11.glTranslated(0, ((double)time-this.lastTimeForBobbing)/100, 0);
}
else{

View file

@ -0,0 +1,138 @@
package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityCoffeeMachine;
import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@InventoryContainer
public class ContainerCoffeeMachine extends Container{
private TileEntityCoffeeMachine machine;
private int lastCoffeeAmount;
private int lastEnergyAmount;
private int lastBrewTime;
public ContainerCoffeeMachine(InventoryPlayer inventory, TileEntityBase tile){
this.machine = (TileEntityCoffeeMachine)tile;
this.addSlotToContainer(new Slot(machine, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, 37, 6));
this.addSlotToContainer(new Slot(machine, TileEntityCoffeeMachine.SLOT_INPUT, 80, 42));
this.addSlotToContainer(new SlotOutput(machine, TileEntityCoffeeMachine.SLOT_OUTPUT, 80, 73));
for (int i = 0; i < 4; i++){
for (int j = 0; j < 2; j++){
this.addSlotToContainer(new Slot(machine, j+i*2+3, 125+j*18, 6+i*18){
@Override
public int getSlotStackLimit(){
return 1;
}
});
}
}
for (int i = 0; i < 3; i++){
for (int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
}
}
for (int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
}
}
@Override
public void addCraftingToCrafters(ICrafting iCraft){
super.addCraftingToCrafters(iCraft);
iCraft.sendProgressBarUpdate(this, 0, this.machine.storage.getEnergyStored());
iCraft.sendProgressBarUpdate(this, 1, this.machine.coffeeCacheAmount);
iCraft.sendProgressBarUpdate(this, 2, this.machine.brewTime);
}
@Override
public void detectAndSendChanges(){
super.detectAndSendChanges();
for(Object crafter : this.crafters){
ICrafting iCraft = (ICrafting)crafter;
if(this.lastEnergyAmount != this.machine.storage.getEnergyStored()) iCraft.sendProgressBarUpdate(this, 0, this.machine.storage.getEnergyStored());
if(this.lastCoffeeAmount != this.machine.coffeeCacheAmount) iCraft.sendProgressBarUpdate(this, 1, this.machine.coffeeCacheAmount);
if(this.lastBrewTime != this.machine.brewTime) iCraft.sendProgressBarUpdate(this, 2, this.machine.brewTime);
}
this.lastEnergyAmount = this.machine.storage.getEnergyStored();
this.lastCoffeeAmount = this.machine.coffeeCacheAmount;
this.lastBrewTime = this.machine.brewTime;
}
@Override
@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2){
if(par1 == 0) this.machine.storage.setEnergyStored(par2);
if(par1 == 1) this.machine.coffeeCacheAmount = par2;
if(par1 == 2) this.machine.brewTime = par2;
}
@Override
public boolean canInteractWith(EntityPlayer player){
return this.machine.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = 11;
final int inventoryEnd = inventoryStart+26;
final int hotbarStart = inventoryEnd+1;
final int hotbarEnd = hotbarStart+8;
Slot theSlot = (Slot)this.inventorySlots.get(slot);
if(theSlot.getHasStack()){
ItemStack currentStack = theSlot.getStack();
ItemStack newStack = currentStack.copy();
if(currentStack.getItem() != null){
if(slot <= hotbarEnd && slot >= inventoryStart){
if(currentStack.getItem() == InitItems.itemCoffeeBean){
this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS+1, false);
}
if(currentStack.getItem() == InitItems.itemMisc && currentStack.getItemDamage() == TheMiscItems.CUP.ordinal()){
this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_INPUT, TileEntityCoffeeMachine.SLOT_INPUT+1, false);
}
}
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
}
else if(slot <= inventoryEnd && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
}
else if(slot < inventoryStart){
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
}
if(newStack.stackSize == 0) theSlot.putStack(null);
else theSlot.onSlotChanged();
if(newStack.stackSize == currentStack.stackSize) return null;
theSlot.onPickupFromSlot(player, newStack);
return currentStack;
}
}
return null;
}
}

View file

@ -2,6 +2,7 @@ package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.gui.GuiInputter;
import ellpeck.actuallyadditions.inventory.slot.SlotFilter;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityInputter;
@ -24,6 +25,8 @@ public class ContainerInputter extends Container{
private int lastSlotToPull;
private int lastPlaceToPutSlotAmount;
private int lastPlaceToPullSlotAmount;
private int lastIsPullWhitelist;
private int lastIsPutWhitelist;
private boolean isAdvanced;
@ -35,22 +38,21 @@ public class ContainerInputter extends Container{
if(isAdvanced){
for(int i = 0; i < 2; i++){
this.addSlotToContainer(new SlotFilter(this.tileInputter, 1+i*6, 20+i*84, 6));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 2+i*6, 38+i*84, 6));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 3+i*6, 56+i*84, 6));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 4+i*6, 20+i*84, 24));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 5+i*6, 38+i*84, 24));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 6+i*6, 56+i*84, 24));
for(int x = 0; x < 3; x++){
for(int y = 0;y < 4; y++){
this.addSlotToContainer(new SlotFilter(this.tileInputter, 1+y+x*4+i*12, 20+i*84+x*18, 6+y*18));
}
}
}
}
for(int i = 0; i < 3; i++){
for (int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18 + (isAdvanced ? 12 : 0)));
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18 + (isAdvanced ? 12+GuiInputter.OFFSET_ADVANCED : 0)));
}
}
for(int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155 + (isAdvanced ? 12 : 0)));
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155 + (isAdvanced ? 12+GuiInputter.OFFSET_ADVANCED : 0)));
}
}
@ -63,6 +65,8 @@ public class ContainerInputter extends Container{
iCraft.sendProgressBarUpdate(this, 3, this.tileInputter.slotToPull);
iCraft.sendProgressBarUpdate(this, 4, this.tileInputter.placeToPullSlotAmount);
iCraft.sendProgressBarUpdate(this, 5, this.tileInputter.placeToPutSlotAmount);
iCraft.sendProgressBarUpdate(this, 6, this.tileInputter.isPullWhitelist ? 1 : 0);
iCraft.sendProgressBarUpdate(this, 7, this.tileInputter.isPutWhitelist ? 1 : 0);
}
@Override
@ -76,13 +80,18 @@ public class ContainerInputter extends Container{
if(this.lastSlotToPull != this.tileInputter.slotToPull) iCraft.sendProgressBarUpdate(this, 3, this.tileInputter.slotToPull);
if(this.lastPlaceToPullSlotAmount != this.tileInputter.placeToPullSlotAmount) iCraft.sendProgressBarUpdate(this, 4, this.tileInputter.placeToPullSlotAmount);
if(this.lastPlaceToPutSlotAmount != this.tileInputter.placeToPutSlotAmount) iCraft.sendProgressBarUpdate(this, 5, this.tileInputter.placeToPutSlotAmount);
if(this.lastIsPullWhitelist != (this.tileInputter.isPullWhitelist ? 1 : 0)) iCraft.sendProgressBarUpdate(this, 6, this.tileInputter.isPullWhitelist ? 1 : 0);
if(this.lastIsPutWhitelist != (this.tileInputter.isPutWhitelist ? 1 : 0)) iCraft.sendProgressBarUpdate(this, 7, this.tileInputter.isPutWhitelist ? 1 : 0);
}
this.lastSideToPut = this.tileInputter.sideToPut;
this.lastSlotToPut = this.tileInputter.slotToPut;
this.lastSideToPull = this.tileInputter.sideToPull;
this.lastSlotToPull = this.tileInputter.slotToPull;
this.lastPlaceToPullSlotAmount = this.tileInputter.placeToPullSlotAmount;
this.lastPlaceToPutSlotAmount = this.tileInputter.placeToPutSlotAmount;
this.lastIsPutWhitelist = this.tileInputter.isPutWhitelist ? 1 : 0;
this.lastIsPullWhitelist = this.tileInputter.isPullWhitelist ? 1 : 0;
}
@ -95,6 +104,8 @@ public class ContainerInputter extends Container{
if(par1 == 3) this.tileInputter.slotToPull = par2;
if(par1 == 4) this.tileInputter.placeToPullSlotAmount = par2;
if(par1 == 5) this.tileInputter.placeToPutSlotAmount = par2;
if(par1 == 6) this.tileInputter.isPullWhitelist = par2 == 1;
if(par1 == 7) this.tileInputter.isPutWhitelist = par2 == 1;
}
@Override
@ -104,7 +115,7 @@ public class ContainerInputter extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = this.isAdvanced ? 13 : 1;
final int inventoryStart = this.isAdvanced ? 25 : 1;
final int inventoryEnd = inventoryStart+26;
final int hotbarStart = inventoryEnd+1;
final int hotbarEnd = hotbarStart+8;

View file

@ -3,8 +3,8 @@ package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.inventory.gui.*;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityGrinder;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@ -13,57 +13,47 @@ public class GuiHandler implements IGuiHandler{
@Override
public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
TileEntityBase tile = null;
if(id != CRAFTER_ID){
tile = (TileEntityBase)world.getTileEntity(x, y, z);
}
switch(id){
case FEEDER_ID:
TileEntityBase tileFeeder = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerFeeder(entityPlayer.inventory, tileFeeder);
return new ContainerFeeder(entityPlayer.inventory, tile);
case GIANT_CHEST_ID:
TileEntityBase tileChest = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerGiantChest(entityPlayer.inventory, tileChest);
return new ContainerGiantChest(entityPlayer.inventory, tile);
case CRAFTER_ID:
return new ContainerCrafter(entityPlayer);
case GRINDER_ID:
TileEntityBase tileGrinder = (TileEntityGrinder)world.getTileEntity(x, y, z);
return new ContainerGrinder(entityPlayer.inventory, tileGrinder, false);
return new ContainerGrinder(entityPlayer.inventory, tile, false);
case GRINDER_DOUBLE_ID:
TileEntityBase tileGrinderDouble = (TileEntityGrinder)world.getTileEntity(x, y, z);
return new ContainerGrinder(entityPlayer.inventory, tileGrinderDouble, true);
return new ContainerGrinder(entityPlayer.inventory, tile, true);
case FURNACE_DOUBLE_ID:
TileEntityBase tileFurnace = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerFurnaceDouble(entityPlayer.inventory, tileFurnace);
return new ContainerFurnaceDouble(entityPlayer.inventory, tile);
case INPUTTER_ID:
TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerInputter(entityPlayer.inventory, tileInputter, false);
return new ContainerInputter(entityPlayer.inventory, tile, false);
case INPUTTER_ADVANCED_ID:
TileEntityBase tileInputterAdvanced = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerInputter(entityPlayer.inventory, tileInputterAdvanced, true);
return new ContainerInputter(entityPlayer.inventory, tile, true);
case REPAIRER_ID:
TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerRepairer(entityPlayer.inventory, tileRepairer);
return new ContainerRepairer(entityPlayer.inventory, tile);
case BREAKER_ID:
TileEntityBase tileBreaker = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerBreaker(entityPlayer.inventory, tileBreaker);
return new ContainerBreaker(entityPlayer.inventory, tile);
case DROPPER_ID:
TileEntityBase tileDropper = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerDropper(entityPlayer.inventory, tileDropper);
return new ContainerDropper(entityPlayer.inventory, tile);
case CANOLA_PRESS_ID:
TileEntityBase tilePress = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerCanolaPress(entityPlayer.inventory, tilePress);
return new ContainerCanolaPress(entityPlayer.inventory, tile);
case FERMENTING_BARREL_ID:
TileEntityBase tileBarrel = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerFermentingBarrel(entityPlayer.inventory, tileBarrel);
return new ContainerFermentingBarrel(entityPlayer.inventory, tile);
case COAL_GENERATOR_ID:
TileEntityBase tileGenerator = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerCoalGenerator(entityPlayer.inventory, tileGenerator);
return new ContainerCoalGenerator(entityPlayer.inventory, tile);
case OIL_GENERATOR_ID:
TileEntityBase tileOilGen = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerOilGenerator(entityPlayer.inventory, tileOilGen);
return new ContainerOilGenerator(entityPlayer.inventory, tile);
case PHANTOM_PLACER_ID:
TileEntityBase tilePlacer = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerPhantomPlacer(entityPlayer.inventory, tilePlacer);
return new ContainerPhantomPlacer(entityPlayer.inventory, tile);
case FLUID_COLLECTOR_ID:
TileEntityBase tileCollector = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerFluidCollector(entityPlayer.inventory, tileCollector);
return new ContainerFluidCollector(entityPlayer.inventory, tile);
case COFFEE_MACHINE_ID:
return new ContainerCoffeeMachine(entityPlayer.inventory, tile);
default:
return null;
}
@ -71,57 +61,47 @@ public class GuiHandler implements IGuiHandler{
@Override
public Object getClientGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
TileEntityBase tile = null;
if(id != CRAFTER_ID){
tile = (TileEntityBase)world.getTileEntity(x, y, z);
}
switch(id){
case FEEDER_ID:
TileEntityBase tileFeeder = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiFeeder(entityPlayer.inventory, tileFeeder);
return new GuiFeeder(entityPlayer.inventory, tile);
case GIANT_CHEST_ID:
TileEntityBase tileChest = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiGiantChest(entityPlayer.inventory, tileChest);
return new GuiGiantChest(entityPlayer.inventory, tile);
case CRAFTER_ID:
return new GuiCrafter(entityPlayer);
case GRINDER_ID:
TileEntityBase tileGrinder = (TileEntityGrinder)world.getTileEntity(x, y, z);
return new GuiGrinder(entityPlayer.inventory, tileGrinder, false);
return new GuiGrinder(entityPlayer.inventory, tile, false);
case GRINDER_DOUBLE_ID:
TileEntityBase tileGrinderDouble = (TileEntityGrinder)world.getTileEntity(x, y, z);
return new GuiGrinder(entityPlayer.inventory, tileGrinderDouble, true);
return new GuiGrinder(entityPlayer.inventory, tile, true);
case FURNACE_DOUBLE_ID:
TileEntityBase tileFurnace = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiFurnaceDouble(entityPlayer.inventory, tileFurnace);
return new GuiFurnaceDouble(entityPlayer.inventory, tile);
case INPUTTER_ID:
TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiInputter(entityPlayer.inventory, tileInputter, x, y, z, world, false);
return new GuiInputter(entityPlayer.inventory, tile, x, y, z, world, false);
case INPUTTER_ADVANCED_ID:
TileEntityBase tileInputterAdvanced = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiInputter(entityPlayer.inventory, tileInputterAdvanced, x, y, z, world, true);
return new GuiInputter(entityPlayer.inventory, tile, x, y, z, world, true);
case REPAIRER_ID:
TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiRepairer(entityPlayer.inventory, tileRepairer);
return new GuiRepairer(entityPlayer.inventory, tile);
case BREAKER_ID:
TileEntityBase tileBreaker = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiBreaker(entityPlayer.inventory, tileBreaker);
return new GuiBreaker(entityPlayer.inventory, tile);
case DROPPER_ID:
TileEntityBase tileDropper = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiDropper(entityPlayer.inventory, tileDropper);
return new GuiDropper(entityPlayer.inventory, tile);
case CANOLA_PRESS_ID:
TileEntityBase tilePress = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiCanolaPress(entityPlayer.inventory, tilePress);
return new GuiCanolaPress(entityPlayer.inventory, tile);
case FERMENTING_BARREL_ID:
TileEntityBase tileBarrel = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiFermentingBarrel(entityPlayer.inventory, tileBarrel);
return new GuiFermentingBarrel(entityPlayer.inventory, tile);
case COAL_GENERATOR_ID:
TileEntityBase tileGenerator = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiCoalGenerator(entityPlayer.inventory, tileGenerator);
return new GuiCoalGenerator(entityPlayer.inventory, tile);
case OIL_GENERATOR_ID:
TileEntityBase tileOilGen = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiOilGenerator(entityPlayer.inventory, tileOilGen);
return new GuiOilGenerator(entityPlayer.inventory, tile);
case PHANTOM_PLACER_ID:
TileEntityBase tilePlacer = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiPhantomPlacer(entityPlayer.inventory, tilePlacer);
return new GuiPhantomPlacer(entityPlayer.inventory, tile);
case FLUID_COLLECTOR_ID:
TileEntityBase tileCollector = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiFluidCollector(entityPlayer.inventory, tileCollector);
return new GuiFluidCollector(entityPlayer.inventory, tile);
case COFFEE_MACHINE_ID:
return new GuiCoffeeMachine(entityPlayer.inventory, tile, x, y, z, world);
default:
return null;
}
@ -144,6 +124,7 @@ public class GuiHandler implements IGuiHandler{
public static final int OIL_GENERATOR_ID = 14;
public static final int PHANTOM_PLACER_ID = 15;
public static final int FLUID_COLLECTOR_ID = 16;
public static final int COFFEE_MACHINE_ID = 17;
public static void init(){
Util.logInfo("Initializing GuiHandler...");

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerBreaker;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityBreaker;
import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerCanolaPress;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityCanolaPress;
import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerCoalGenerator;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityCoalGenerator;
import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -0,0 +1,109 @@
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerCoffeeMachine;
import ellpeck.actuallyadditions.network.PacketHandler;
import ellpeck.actuallyadditions.network.gui.PacketGuiButton;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityCoffeeMachine;
import ellpeck.actuallyadditions.util.AssetUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiCoffeeMachine extends GuiContainer{
private TileEntityCoffeeMachine machine;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCoffeeMachine");
private int x;
private int y;
private int z;
private World world;
public GuiCoffeeMachine(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world){
super(new ContainerCoffeeMachine(inventory, tile));
this.machine = (TileEntityCoffeeMachine)tile;
this.xSize = 176;
this.ySize = 93+86;
this.x = x;
this.y = y;
this.z = z;
this.world = world;
}
@SuppressWarnings("unchecked")
@Override
public void initGui(){
super.initGui();
GuiButton buttonOkay = new GuiButton(0, guiLeft+60, guiTop+11, 58, 20, "OK");
this.buttonList.add(buttonOkay);
}
@Override
public void actionPerformed(GuiButton button){
PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer));
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.machine.getInventoryName());
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.machine.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
int i = this.machine.getEnergyScaled(83);
drawTexturedModalRect(this.guiLeft+17, this.guiTop+89-i, 176, 0, 16, i);
}
if(this.machine.coffeeCacheAmount > 0){
int i = this.machine.getCoffeeScaled(30);
drawTexturedModalRect(this.guiLeft+41, this.guiTop+56-i, 192, 0, 8, i);
}
if(this.machine.brewTime > 0){
int i = this.machine.getBrewScaled(23);
drawTexturedModalRect(this.guiLeft+53, this.guiTop+42, 192, 30, i, 16);
int j = this.machine.getBrewScaled(26);
drawTexturedModalRect(this.guiLeft+99+25-j, this.guiTop+44, 192+25-j, 46, j, 12);
}
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text1 = this.machine.getEnergyStored(ForgeDirection.UNKNOWN) + "/" + this.machine.getMaxEnergyStored(ForgeDirection.UNKNOWN) + " RF";
if(x >= guiLeft+16 && y >= guiTop+5 && x <= guiLeft+33 && y <= guiTop+89){
this.func_146283_a(Collections.singletonList(text1), x, y);
}
String text2 = this.machine.coffeeCacheAmount + "/" + this.machine.coffeeCacheMaxAmount+" "+StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.coffee");
if(x >= guiLeft+40 && y >= guiTop+25 && x <= guiLeft+49 && y <= guiTop+56){
this.func_146283_a(Collections.singletonList(text2), x, y);
}
}
}

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerCrafter;
import ellpeck.actuallyadditions.util.AssetUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.gui.inventory.GuiContainer;

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerDropper;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityDropper;
import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerFeeder;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityFeeder;
import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerFermentingBarrel;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityFermentingBarrel;
import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerFluidCollector;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityFluidCollector;
import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerFurnaceDouble;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble;
import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerGiantChest;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityGiantChest;
import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerGrinder;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityGrinder;
import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -1,13 +1,15 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerInputter;
import ellpeck.actuallyadditions.network.PacketHandler;
import ellpeck.actuallyadditions.network.PacketInputterButton;
import ellpeck.actuallyadditions.network.gui.PacketGuiButton;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityInputter;
import ellpeck.actuallyadditions.util.AssetUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
@ -19,6 +21,8 @@ import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiInputter extends GuiContainer{
@ -37,8 +41,13 @@ public class GuiInputter extends GuiContainer{
private SmallerButton buttonSlotPutM;
private SmallerButton buttonSlotPullM;
private SmallerButton whitelistPut;
private SmallerButton whitelistPull;
private boolean isAdvanced;
public static final int OFFSET_ADVANCED = 35;
public static final String[] sideString = new String[]{
StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.disabled"),
StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.up"),
@ -56,7 +65,7 @@ public class GuiInputter extends GuiContainer{
this.z = z;
this.world = world;
this.xSize = 176;
this.ySize = 93+86 + (isAdvanced ? 12 : 0);
this.ySize = 93+86 + (isAdvanced ? 12+OFFSET_ADVANCED : 0);
this.isAdvanced = isAdvanced;
}
@ -70,15 +79,18 @@ public class GuiInputter extends GuiContainer{
public void initGui(){
super.initGui();
SmallerButton buttonSidePutP = new SmallerButton(0, guiLeft + 70, guiTop + 43 + (isAdvanced ? 12 : 0), ">");
SmallerButton buttonSidePutM = new SmallerButton(1, guiLeft + 5, guiTop + 43 + (isAdvanced ? 12 : 0), "<");
buttonSlotPutP = new SmallerButton(2, guiLeft + 70, guiTop + 64 + (isAdvanced ? 12 : 0), "+");
buttonSlotPutM = new SmallerButton(3, guiLeft + 5, guiTop + 64 + (isAdvanced ? 12 : 0), "-");
SmallerButton buttonSidePutP = new SmallerButton(0, guiLeft + 155, guiTop + 43 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), ">");
SmallerButton buttonSidePutM = new SmallerButton(1, guiLeft + 90, guiTop + 43 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), "<");
buttonSlotPutP = new SmallerButton(2, guiLeft+ 155, guiTop + 64 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), "+");
buttonSlotPutM = new SmallerButton(3, guiLeft + 90, guiTop + 64 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), "-");
SmallerButton buttonSidePullP = new SmallerButton(4, guiLeft + 155, guiTop + 43 + (isAdvanced ? 12 : 0), ">");
SmallerButton buttonSidePullM = new SmallerButton(5, guiLeft + 90, guiTop + 43 + (isAdvanced ? 12 : 0), "<");
buttonSlotPullP = new SmallerButton(6, guiLeft+ 155, guiTop + 64 + (isAdvanced ? 12 : 0), "+");
buttonSlotPullM = new SmallerButton(7, guiLeft + 90, guiTop + 64 + (isAdvanced ? 12 : 0), "-");
SmallerButton buttonSidePullP = new SmallerButton(4, guiLeft + 70, guiTop + 43 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), ">");
SmallerButton buttonSidePullM = new SmallerButton(5, guiLeft + 5, guiTop + 43 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), "<");
buttonSlotPullP = new SmallerButton(6, guiLeft + 70, guiTop + 64 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), "+");
buttonSlotPullM = new SmallerButton(7, guiLeft + 5, guiTop + 64 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), "-");
whitelistPull = new SmallerButton(TileEntityInputter.WHITELIST_PULL_BUTTON_ID, guiLeft+3, guiTop+16, "");
whitelistPut = new SmallerButton(TileEntityInputter.WHITELIST_PUT_BUTTON_ID, guiLeft+157, guiTop+16, "");
this.buttonList.add(buttonSidePutP);
this.buttonList.add(buttonSlotPutP);
@ -88,6 +100,10 @@ public class GuiInputter extends GuiContainer{
this.buttonList.add(buttonSlotPutM);
this.buttonList.add(buttonSidePullM);
this.buttonList.add(buttonSlotPullM);
if(this.isAdvanced){
this.buttonList.add(whitelistPut);
this.buttonList.add(whitelistPull);
}
}
@Override
@ -95,19 +111,19 @@ public class GuiInputter extends GuiContainer{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93 + (isAdvanced ? 12 : 0), 0, 0, 176, 86);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(this.isAdvanced ? resLocAdvanced : resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93 + (isAdvanced ? 12 : 0));
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93 + (isAdvanced ? 12+OFFSET_ADVANCED : 0));
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.put"), guiLeft + 22 + 3, guiTop + 32 + (isAdvanced ? 12 : 0), 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.pull"), guiLeft + 107 + 3, guiTop + 32 + (isAdvanced ? 12 : 0), 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.pull"), guiLeft + 22 + 3, guiTop + 32 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.put"), guiLeft + 107 + 3, guiTop + 32 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), 4210752);
this.fontRendererObj.drawString(sideString[tileInputter.sideToPut+1], guiLeft + 24 + 1, guiTop + 45 + 3 + (isAdvanced ? 12 : 0), 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPut == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPut).toString(), guiLeft + 24 + 3, guiTop + 66 + 3 + (isAdvanced ? 12 : 0), 4210752);
this.fontRendererObj.drawString(sideString[tileInputter.sideToPull+1], guiLeft + 24 + 1, guiTop + 45 + 3 + (isAdvanced ? 12+36 : 0), 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPut == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPull).toString(), guiLeft + 24 + 3, guiTop + 66 + 3 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
this.fontRendererObj.drawString(sideString[tileInputter.sideToPull+1], guiLeft + 109 + 1, guiTop + 45 + 3 + (isAdvanced ? 12 : 0), 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPull == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPull).toString(), guiLeft + 109 + 3, guiTop + 66 + 3 + (isAdvanced ? 12 : 0), 4210752);
this.fontRendererObj.drawString(sideString[tileInputter.sideToPut+1], guiLeft + 109 + 1, guiTop + 45 + 3 + (isAdvanced ? 12+36 : 0), 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPut == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPut).toString(), guiLeft + 109 + 3, guiTop + 66 + 3 + (isAdvanced ? 12+OFFSET_ADVANCED : 0), StringUtil.DECIMAL_COLOR_GRAY_TEXT);
}
@Override
@ -119,11 +135,25 @@ public class GuiInputter extends GuiContainer{
this.buttonSlotPutP.enabled = this.tileInputter.placeToPutSlotAmount > 0;
this.buttonSlotPutM.enabled = this.tileInputter.placeToPutSlotAmount > 0;
this.whitelistPull.displayString = this.tileInputter.isPullWhitelist ? "O" : "X";
this.whitelistPut.displayString = this.tileInputter.isPutWhitelist ? "O" : "X";
if(this.isAdvanced){
String text1 = this.tileInputter.isPullWhitelist ? StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.whitelist") : StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.blacklist");
if(x >= guiLeft+3 && y >= guiTop+16 && x <= guiLeft+18 && y <= guiTop+31){
this.func_146283_a(Collections.singletonList(text1), x, y);
}
String text2 = this.tileInputter.isPutWhitelist ? StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.whitelist") : StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.blacklist");
if(x >= guiLeft+157 && y >= guiTop+16 && x <= guiLeft+172 && y <= guiTop+31){
this.func_146283_a(Collections.singletonList(text2), x, y);
}
}
}
@Override
public void actionPerformed(GuiButton button){
PacketHandler.theNetwork.sendToServer(new PacketInputterButton(x, y, z, world, button.id));
PacketHandler.theNetwork.sendToServer(new PacketGuiButton(x, y, z, world, button.id, Minecraft.getMinecraft().thePlayer));
}
public class SmallerButton extends GuiButton{

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerOilGenerator;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityOilGenerator;
import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerPhantomPlacer;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityPhantomPlacer;
import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -1,7 +1,8 @@
package ellpeck.actuallyadditions.inventory;
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerRepairer;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityItemRepairer;
import ellpeck.actuallyadditions.util.AssetUtil;

View file

@ -13,4 +13,5 @@ public class SlotFilter extends Slot{
public int getSlotStackLimit(){
return 1;
}
}

View file

@ -50,6 +50,7 @@ public class InitItems{
public static Item itemRiceSeed;
public static Item itemCanolaSeed;
public static Item itemFlaxSeed;
public static Item itemCoffeeSeed;
public static Item itemResonantRice;
public static Item itemBucketOil;
@ -57,6 +58,17 @@ public class InitItems{
public static Item itemPhantomConnector;
public static Item itemCoffeeBean;
public static Item itemCoffee;
public static Item woodenPaxel;
public static Item stonePaxel;
public static Item ironPaxel;
public static Item diamondPaxel;
public static Item goldPaxel;
public static Item emeraldPaxel;
public static Item obsidianPaxel;
public static void init(){
Util.logInfo("Initializing Items...");
@ -114,6 +126,9 @@ public class InitItems{
ItemUtil.register(itemHairyBall);
HairyBallHandler.init();
itemCoffeeBean = new ItemCoffeeBean();
ItemUtil.register(itemCoffeeBean);
itemRiceSeed = new ItemSeed("itemRiceSeed", InitBlocks.blockRice, Blocks.water, EnumPlantType.Water, new ItemStack(itemFoods, 1, TheFoods.RICE.ordinal()));
ItemUtil.register(itemRiceSeed);
FactoryRegistry.sendMessage("registerPlantable", itemRiceSeed);
@ -126,6 +141,10 @@ public class InitItems{
ItemUtil.register(itemFlaxSeed);
FactoryRegistry.sendMessage("registerPlantable", itemFlaxSeed);
itemCoffeeSeed = new ItemSeed("itemCoffeeSeed", InitBlocks.blockCoffee, Blocks.grass, EnumPlantType.Plains, new ItemStack(itemCoffeeBean));
ItemUtil.register(itemCoffeeSeed);
FactoryRegistry.sendMessage("registerPlantable", itemCoffeeSeed);
itemPickaxeEmerald = new ItemPickaxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemPickaxeEmerald", EnumRarity.rare);
itemAxeEmerald = new ItemAxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemAxeEmerald", EnumRarity.rare);
itemShovelEmerald = new ItemShovelAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemShovelEmerald", EnumRarity.rare);
@ -140,5 +159,16 @@ public class InitItems{
itemHoeObsidian = new ItemHoeAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "itemHoeObsidian", EnumRarity.uncommon);
ItemUtil.registerItems(new Item[]{itemPickaxeObsidian, itemAxeObsidian, itemShovelObsidian, itemSwordObsidian, itemHoeObsidian});
woodenPaxel = new ItemAllToolAA(Item.ToolMaterial.WOOD, new ItemStack(Blocks.planks), "woodenPaxel", EnumRarity.uncommon);
stonePaxel = new ItemAllToolAA(Item.ToolMaterial.STONE, new ItemStack(Blocks.stone), "stonePaxel", EnumRarity.uncommon);
ironPaxel = new ItemAllToolAA(Item.ToolMaterial.IRON, new ItemStack(Items.iron_ingot), "ironPaxel", EnumRarity.rare);
goldPaxel = new ItemAllToolAA(Item.ToolMaterial.GOLD, new ItemStack(Items.gold_ingot), "goldPaxel", EnumRarity.rare);
diamondPaxel = new ItemAllToolAA(Item.ToolMaterial.EMERALD, new ItemStack(Items.diamond), "diamondPaxel", EnumRarity.epic);
emeraldPaxel = new ItemAllToolAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "emeraldPaxel", EnumRarity.epic);
obsidianPaxel = new ItemAllToolAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "obsidianPaxel", EnumRarity.epic);
ItemUtil.registerItems(new Item[]{woodenPaxel, stonePaxel, ironPaxel, goldPaxel, diamondPaxel, emeraldPaxel, obsidianPaxel});
itemCoffee = new ItemCoffee();
ItemUtil.register(itemCoffee);
}
}

View file

@ -0,0 +1,253 @@
package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.List;
public class ItemCoffee extends ItemFood implements INameableItem{
public static ArrayList<Ingredient> ingredients = new ArrayList<Ingredient>();
public void initIngredients(){
this.registerIngredient(new Ingredient(new ItemStack(Items.milk_bucket), null){
@Override
public void effect(ItemStack stack){
PotionEffect[] effects = getEffectsFromStack(stack);
ArrayList<PotionEffect> effectsNew = new ArrayList<PotionEffect>();
if(effects != null && effects.length > 0){
for(PotionEffect effect : effects){
if(effect.getAmplifier() > 0) effectsNew.add(new PotionEffect(effect.getPotionID(), effect.getDuration()+150, effect.getAmplifier()-1));
}
stack.setTagCompound(new NBTTagCompound());
if(effectsNew.size() > 0){
this.effects = effectsNew.toArray(new PotionEffect[effectsNew.size()]);
ItemCoffee.addEffectToStack(stack, this);
}
}
}
@Override
public String getExtraText(){
return StatCollector.translateToLocal("container.nei." + ModUtil.MOD_ID_LOWER + ".coffee.extra.milk");
}
});
this.registerIngredient(new Ingredient(new ItemStack(Items.sugar), new PotionEffect[]{new PotionEffect(Potion.moveSpeed.getId(), 30, 0)}));
this.registerIngredient(new Ingredient(new ItemStack(Items.magma_cream), new PotionEffect[]{new PotionEffect(Potion.fireResistance.getId(), 10, 0)}));
this.registerIngredient(new Ingredient(new ItemStack(Items.fish, 1, 3), new PotionEffect[]{new PotionEffect(Potion.waterBreathing.getId(), 15, 0)}));
this.registerIngredient(new Ingredient(new ItemStack(Items.golden_carrot), new PotionEffect[]{new PotionEffect(Potion.nightVision.getId(), 60, 0)}));
this.registerIngredient(new Ingredient(new ItemStack(Items.ghast_tear), new PotionEffect[]{new PotionEffect(Potion.regeneration.getId(), 10, 0)}));
this.registerIngredient(new Ingredient(new ItemStack(Items.blaze_powder), new PotionEffect[]{new PotionEffect(Potion.damageBoost.getId(), 15, 0)}));
this.registerIngredient(new Ingredient(new ItemStack(Items.fermented_spider_eye), new PotionEffect[]{new PotionEffect(Potion.invisibility.getId(), 25, 0)}));
}
public ItemCoffee(){
super(2, 2.0F, false);
this.setMaxDamage(ConfigIntValues.COFFEE_DRINK_AMOUNT.getValue()-1);
this.setAlwaysEdible();
this.setMaxStackSize(1);
this.initIngredients();
}
public static Ingredient getIngredientFromStack(ItemStack stack){
for(Ingredient ingredient : ingredients){
if(ingredient.ingredient.isItemEqual(stack)) return ingredient;
}
return null;
}
public static void addEffectProperties(ItemStack stack, PotionEffect effect, boolean addDur, boolean addAmp){
PotionEffect[] effects = getEffectsFromStack(stack);
stack.setTagCompound(new NBTTagCompound());
for(int i = 0; i < effects.length; i++){
if(effects[i].getPotionID() == effect.getPotionID()){
effects[i] = new PotionEffect(effects[i].getPotionID(), effects[i].getDuration()+(addDur ? effect.getDuration() : 0), effects[i].getAmplifier()+(addAmp ? (effect.getAmplifier() > 0 ? effect.getAmplifier() : 1) : 0));
}
addEffectToStack(stack, effects[i]);
}
}
public static void addEffectToStack(ItemStack stack, PotionEffect effect){
NBTTagCompound tag = stack.getTagCompound();
if(tag == null) tag = new NBTTagCompound();
int prevCounter = tag.getInteger("Counter");
NBTTagCompound compound = new NBTTagCompound();
compound.setInteger("ID", effect.getPotionID());
compound.setInteger("Duration", effect.getDuration());
compound.setInteger("Amplifier", effect.getAmplifier());
int counter = prevCounter+1;
tag.setTag(counter+"", compound);
tag.setInteger("Counter", counter);
stack.setTagCompound(tag);
}
public static void addEffectToStack(ItemStack stack, Ingredient ingredient){
if(ingredient != null){
PotionEffect[] effects = ingredient.getEffects();
if(effects != null && effects.length > 0){
for(PotionEffect effect : effects){
if(hasEffect(stack, effect)) addEffectProperties(stack, effect, false, true);
else addEffectToStack(stack, effect);
}
}
}
}
public static PotionEffect[] getEffectsFromStack(ItemStack stack){
ArrayList<PotionEffect> effects = new ArrayList<PotionEffect>();
NBTTagCompound tag = stack.getTagCompound();
if(tag != null){
int counter = tag.getInteger("Counter");
while(counter > 0){
NBTTagCompound compound = (NBTTagCompound)tag.getTag(counter + "");
PotionEffect effect = new PotionEffect(compound.getInteger("ID"), compound.getInteger("Duration"), compound.getByte("Amplifier"));
if(effect.getPotionID() > 0){
effects.add(effect);
}
counter--;
}
}
return effects.size() > 0 ? effects.toArray(new PotionEffect[effects.size()]) : null;
}
public static boolean hasEffect(ItemStack stack, PotionEffect effect){
PotionEffect[] effectsStack = getEffectsFromStack(stack);
if(effectsStack != null && effectsStack.length > 0){
for(PotionEffect effectStack : effectsStack){
if(effect.getPotionID() == effectStack.getPotionID()) return true;
}
}
return false;
}
public static void applyPotionEffectsFromStack(ItemStack stack, EntityPlayer player){
PotionEffect[] effects = getEffectsFromStack(stack);
if(effects != null && effects.length > 0){
for(PotionEffect effect : effects){
player.addPotionEffect(new PotionEffect(effect.getPotionID(), effect.getDuration()*20, effect.getAmplifier()));
}
}
}
@Override
public boolean getShareTag(){
return true;
}
@Override
public EnumAction getItemUseAction(ItemStack stack){
return EnumAction.drink;
}
@Override
public String getOredictName(){
return this.getName();
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
public int getMetadata(int damage){
return damage;
}
@Override
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player){
ItemStack theStack = stack.copy();
super.onEaten(stack, world, player);
applyPotionEffectsFromStack(stack, player);
theStack.setItemDamage(theStack.getItemDamage()+1);
if(theStack.getMaxDamage()-theStack.getItemDamage() < 0) return new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal());
else return theStack;
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+".desc.1"));
list.add(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+".desc.2", this.getMaxDamage()+1));
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".hunger.desc")+": "+this.func_150905_g(stack));
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".saturation.desc")+": "+this.func_150906_h(stack));
list.add("");
PotionEffect[] effects = getEffectsFromStack(stack);
if(effects != null && effects.length > 0){
for(PotionEffect effect : effects){
list.add(StatCollector.translateToLocal(effect.getEffectName())+" "+(effect.getAmplifier()+1)+ " (" + Potion.getDurationString(new PotionEffect(0, effect.getDuration()*20, 0)) + ")");
}
}
else list.add("No Effects");
}
else list.add(ItemUtil.shiftForInfo());
}
@Override
public IIcon getIconFromDamage(int par1){
return this.itemIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){
itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public String getName(){
return "itemCoffee";
}
public void registerIngredient(Ingredient ingredient){
ingredients.add(ingredient);
}
public static class Ingredient{
public ItemStack ingredient;
protected PotionEffect[] effects;
public Ingredient(ItemStack ingredient, PotionEffect[] effects){
this.ingredient = ingredient.copy();
this.effects = effects;
}
public String getExtraText(){
return null;
}
public PotionEffect[] getEffects(){
return this.effects;
}
public void effect(ItemStack stack){
ItemCoffee.addEffectToStack(stack, this);
}
}
}

View file

@ -0,0 +1,57 @@
package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import java.util.List;
public class ItemCoffeeBean extends ItemFood implements INameableItem{
public ItemCoffeeBean(){
super(1, 1F, false);
this.setMaxDamage(0);
}
@Override
public String getOredictName(){
return this.getName();
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
ItemUtil.addInformation(this, list, 1, "");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public String getName(){
return "itemCoffeeBeans";
}
}

View file

@ -41,7 +41,7 @@ public class ItemDust extends Item implements INameableItem{
@Override
public EnumRarity getRarity(ItemStack stack){
return allDusts[stack.getItemDamage()].rarity;
return stack.getItemDamage() >= allDusts.length ? EnumRarity.common : allDusts[stack.getItemDamage()].rarity;
}
@SuppressWarnings("all")
@ -54,14 +54,14 @@ public class ItemDust extends Item implements INameableItem{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allDusts[stack.getItemDamage()].name;
return this.getUnlocalizedName() + (stack.getItemDamage() >= allDusts.length ? " ERROR!" : allDusts[stack.getItemDamage()].getName());
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
ItemUtil.addInformation(this, list, 1, allDusts[stack.getItemDamage()].getName());
if(stack.getItemDamage() < allDusts.length) ItemUtil.addInformation(this, list, 1, allDusts[stack.getItemDamage()].getName());
}
@Override
@ -72,7 +72,7 @@ public class ItemDust extends Item implements INameableItem{
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass){
return allDusts[stack.getItemDamage()].color;
return stack.getItemDamage() >= allDusts.length ? 0 : allDusts[stack.getItemDamage()].color;
}
@Override

View file

@ -37,27 +37,27 @@ public class ItemFoods extends ItemFood implements INameableItem{
@Override
public EnumRarity getRarity(ItemStack stack){
return allFoods[stack.getItemDamage()].rarity;
return stack.getItemDamage() >= allFoods.length ? EnumRarity.common : allFoods[stack.getItemDamage()].rarity;
}
@Override
public int func_150905_g(ItemStack stack){
return allFoods[stack.getItemDamage()].healAmount;
return stack.getItemDamage() >= allFoods.length ? 0 : allFoods[stack.getItemDamage()].healAmount;
}
@Override
public float func_150906_h(ItemStack stack){
return allFoods[stack.getItemDamage()].saturation;
return stack.getItemDamage() >= allFoods.length ? 0 : allFoods[stack.getItemDamage()].saturation;
}
@Override
public EnumAction getItemUseAction(ItemStack stack){
return allFoods[stack.getItemDamage()].getsDrunken ? EnumAction.drink : EnumAction.eat;
return stack.getItemDamage() >= allFoods.length ? EnumAction.eat : (allFoods[stack.getItemDamage()].getsDrunken ? EnumAction.drink : EnumAction.eat);
}
@Override
public int getMaxItemUseDuration(ItemStack stack){
return allFoods[stack.getItemDamage()].useDuration;
return stack.getItemDamage() >= allFoods.length ? 0 : allFoods[stack.getItemDamage()].useDuration;
}
@Override
@ -75,14 +75,14 @@ public class ItemFoods extends ItemFood implements INameableItem{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allFoods[stack.getItemDamage()].getName();
return this.getUnlocalizedName() + (stack.getItemDamage() >= allFoods.length ? " ERROR!" : allFoods[stack.getItemDamage()].getName());
}
@Override
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player){
ItemStack stackToReturn = super.onEaten(stack, world, player);
ItemStack returnItem = allFoods[stack.getItemDamage()].returnItem;
if (returnItem != null){
ItemStack returnItem = stack.getItemDamage() >= allFoods.length ? null : allFoods[stack.getItemDamage()].returnItem;
if(returnItem != null){
if(!player.inventory.addItemStackToInventory(returnItem.copy())){
if(!world.isRemote){
EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem.copy());
@ -98,17 +98,19 @@ public class ItemFoods extends ItemFood implements INameableItem{
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
if(stack.getItemDamage() < allFoods.length){
if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + allFoods[stack.getItemDamage()].getName() + ".desc"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".hunger.desc") + ": " + allFoods[stack.getItemDamage()].healAmount);
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".saturation.desc") + ": " + allFoods[stack.getItemDamage()].saturation);
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+allFoods[stack.getItemDamage()].getName()+".desc"));
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".hunger.desc")+": "+allFoods[stack.getItemDamage()].healAmount);
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".saturation.desc")+": "+allFoods[stack.getItemDamage()].saturation);
}
else list.add(ItemUtil.shiftForInfo());
}
}
@Override
public IIcon getIconFromDamage(int par1){
return textures[par1];
return par1 >= textures.length ? null : textures[par1];
}
@Override

View file

@ -41,17 +41,17 @@ public class ItemJams extends ItemFood implements INameableItem{
@Override
public EnumRarity getRarity(ItemStack stack){
return allJams[stack.getItemDamage()].rarity;
return stack.getItemDamage() >= allJams.length ? EnumRarity.common : allJams[stack.getItemDamage()].rarity;
}
@Override
public int func_150905_g(ItemStack stack){
return allJams[stack.getItemDamage()].healAmount;
return stack.getItemDamage() >= allJams.length ? 0 : allJams[stack.getItemDamage()].healAmount;
}
@Override
public float func_150906_h(ItemStack stack){
return allJams[stack.getItemDamage()].saturation;
return stack.getItemDamage() >= allJams.length ? 0 : allJams[stack.getItemDamage()].saturation;
}
@Override
@ -69,20 +69,20 @@ public class ItemJams extends ItemFood implements INameableItem{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allJams[stack.getItemDamage()].getName();
return this.getUnlocalizedName() + (stack.getItemDamage() >= allJams.length ? " ERROR!" : allJams[stack.getItemDamage()].getName());
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass){
return pass > 0 ? allJams[stack.getItemDamage()].color : super.getColorFromItemStack(stack, pass);
return pass > 0 ? (stack.getItemDamage() >= allJams.length ? 0 : allJams[stack.getItemDamage()].color) : super.getColorFromItemStack(stack, pass);
}
@Override
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player){
ItemStack stackToReturn = super.onEaten(stack, world, player);
if(!world.isRemote){
if(!world.isRemote && stack.getItemDamage() < allJams.length){
PotionEffect firstEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].firstEffectToGet, 200);
player.addPotionEffect(firstEffectToGet);
@ -103,15 +103,17 @@ public class ItemJams extends ItemFood implements INameableItem{
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
if(stack.getItemDamage() < allJams.length){
if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc.1"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + allJams[stack.getItemDamage()].getName() + ".desc"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc.2"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".hunger.desc") + ": " + allJams[stack.getItemDamage()].healAmount);
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".saturation.desc") + ": " + allJams[stack.getItemDamage()].saturation);
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+".desc.1"));
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+allJams[stack.getItemDamage()].getName()+".desc"));
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+"."+this.getName()+".desc.2"));
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".hunger.desc")+": "+allJams[stack.getItemDamage()].healAmount);
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".saturation.desc")+": "+allJams[stack.getItemDamage()].saturation);
}
else list.add(ItemUtil.shiftForInfo());
}
}
@Override
@SideOnly(Side.CLIENT)

View file

@ -37,7 +37,7 @@ public class ItemMisc extends Item implements INameableItem{
@Override
public EnumRarity getRarity(ItemStack stack){
return allMiscItems[stack.getItemDamage()].rarity;
return stack.getItemDamage() >= allMiscItems.length ? EnumRarity.common : allMiscItems[stack.getItemDamage()].rarity;
}
@Override
@ -55,19 +55,19 @@ public class ItemMisc extends Item implements INameableItem{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allMiscItems[stack.getItemDamage()].name;
return this.getUnlocalizedName() + (stack.getItemDamage() >= allMiscItems.length ? " ERROR!" : allMiscItems[stack.getItemDamage()].getName());
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
ItemUtil.addInformation(this, list, 1, allMiscItems[stack.getItemDamage()].getName());
if(stack.getItemDamage() < allMiscItems.length) ItemUtil.addInformation(this, list, 1, allMiscItems[stack.getItemDamage()].getName());
}
@Override
public IIcon getIconFromDamage(int par1){
return textures[par1];
return par1 >= textures.length ? null : textures[par1];
}
@Override

View file

@ -39,24 +39,22 @@ public class ItemPhantomConnector extends Item implements INameableItem{
if(tile != null){
//Passing to Face
if(tile instanceof TileEntityPhantomface){
if(this.checkHasConnection(stack, player)){
ChunkCoordinates coords = this.getStoredPosition(stack);
TileEntity toStore = this.getStoredWorld(stack).getTileEntity(coords.posX, coords.posY, coords.posZ);
if(toStore != null && ((TileEntityPhantomface)tile).canConnectTo(toStore)){
((TileEntityPhantomface)tile).boundTile = toStore;
if(this.checkHasConnection(stack, player, tile)){
((TileEntityPhantomface)tile).boundPosition = this.getStoredPosition(stack);
((TileEntityPhantomface)tile).boundWorld = this.getStoredWorld(stack);
TileEntityPhantomface.updateAround(tile);
this.clearStorage(stack);
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc")));
return true;
}
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notInventory.desc")));
}
return false;
}
//Passing to Placer
else if(tile instanceof TileEntityPhantomPlacer){
if(this.checkHasConnection(stack, player)){
if(this.checkHasConnection(stack, player, tile)){
((TileEntityPhantomPlacer)tile).boundPosition = this.getStoredPosition(stack);
((TileEntityPhantomPlacer)tile).boundWorld = this.getStoredWorld(stack);
tile.markDirty();
this.clearStorage(stack);
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc")));
return true;
@ -71,12 +69,20 @@ public class ItemPhantomConnector extends Item implements INameableItem{
return true;
}
public boolean checkHasConnection(ItemStack stack, EntityPlayer player){
public boolean checkHasConnection(ItemStack stack, EntityPlayer player, TileEntity tile){
if(this.getStoredPosition(stack) != null && this.getStoredWorld(stack) != null){
return true;
}
else{
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.noBound.desc")));
if(tile instanceof TileEntityPhantomPlacer){
((TileEntityPhantomPlacer)tile).boundWorld = null;
((TileEntityPhantomPlacer)tile).boundPosition = null;
}
if(tile instanceof TileEntityPhantomface){
((TileEntityPhantomface)tile).boundWorld = null;
((TileEntityPhantomface)tile).boundPosition = null;
}
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.unbound.desc")));
return false;
}
}

View file

@ -3,7 +3,9 @@ package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.items.metalists.ThePotionRings;
import ellpeck.actuallyadditions.util.*;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
@ -40,7 +42,7 @@ public class ItemPotionRing extends Item implements INameableItem{
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5){
super.onUpdate(stack, world, player, par4, par5);
if(!world.isRemote){
if(!world.isRemote && stack.getItemDamage() < allRings.length){
if(player instanceof EntityPlayer){
EntityPlayer thePlayer = (EntityPlayer)player;
ItemStack equippedStack = ((EntityPlayer)player).getCurrentEquippedItem();
@ -71,7 +73,7 @@ public class ItemPotionRing extends Item implements INameableItem{
@Override
public EnumRarity getRarity(ItemStack stack){
return allRings[stack.getItemDamage()].rarity;
return stack.getItemDamage() >= allRings.length ? EnumRarity.common : allRings[stack.getItemDamage()].rarity;
}
@SuppressWarnings("all")
@ -84,20 +86,15 @@ public class ItemPotionRing extends Item implements INameableItem{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allRings[stack.getItemDamage()].name;
return this.getUnlocalizedName() + (stack.getItemDamage() >= allRings.length ? " ERROR!" : allRings[stack.getItemDamage()].getName());
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
if(stack.getItemDamage() < allRings.length){
ItemUtil.addInformation(this, list, 2, "");
if(KeyUtil.isShiftPressed()){
if(stack.getItemDamage() == ThePotionRings.SATURATION.ordinal()){
list.add(StringUtil.RED + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemPotionRing.desc.off.1"));
list.add(StringUtil.RED + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemPotionRing.desc.off.2"));
}
}
}
@ -109,7 +106,7 @@ public class ItemPotionRing extends Item implements INameableItem{
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass){
return allRings[stack.getItemDamage()].color;
return stack.getItemDamage() >= allRings.length ? 0 : allRings[stack.getItemDamage()].color;
}
@Override
@ -121,8 +118,10 @@ public class ItemPotionRing extends Item implements INameableItem{
@Override
public String getItemStackDisplayName(ItemStack stack){
String standardName = StatCollector.translateToLocal(this.getUnlocalizedName() + ".name");
String name = allRings[stack.getItemDamage()].getName();
String effect = StatCollector.translateToLocal("effect." + ModUtil.MOD_ID_LOWER + "." + name.substring(0, 1).toLowerCase() + name.substring(1) + ".name");
return standardName + " " + effect;
if(stack.getItemDamage() < allRings.length){
String effect = StatCollector.translateToLocal(allRings[stack.getItemDamage()].getName());
return standardName+" "+effect;
}
return standardName;
}
}

View file

@ -17,10 +17,11 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import java.util.List;
import java.util.Random;
public class ItemSpecialDrop extends Item implements INameableItem{
public static final int SOLID_XP_AMOUNT = 8;
public static final TheSpecialDrops[] allDrops = TheSpecialDrops.values();
public IIcon[] textures = new IIcon[allDrops.length];
@ -32,9 +33,15 @@ public class ItemSpecialDrop extends Item implements INameableItem{
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
if(!world.isRemote){
if(stack.getItemDamage() == TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()){
world.spawnEntityInWorld(new EntityXPOrb(world, player.posX+0.5, player.posY+0.5, player.posZ+0.5, 5+new Random().nextInt(6)));
if(!player.isSneaking()){
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--;
}
else{
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;
}
}
}
return stack;
}
@ -46,7 +53,7 @@ public class ItemSpecialDrop extends Item implements INameableItem{
@Override
public EnumRarity getRarity(ItemStack stack){
return allDrops[stack.getItemDamage()].rarity;
return stack.getItemDamage() >= allDrops.length ? EnumRarity.common : allDrops[stack.getItemDamage()].rarity;
}
@Override
@ -69,19 +76,19 @@ public class ItemSpecialDrop extends Item implements INameableItem{
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allDrops[stack.getItemDamage()].name;
return this.getUnlocalizedName() + (stack.getItemDamage() >= allDrops.length ? " ERROR!" : allDrops[stack.getItemDamage()].getName());
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
ItemUtil.addInformation(this, list, 1, allDrops[stack.getItemDamage()].getName());
if(stack.getItemDamage() < allDrops.length) ItemUtil.addInformation(this, list, stack.getItemDamage() == TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal() ? 2 : 1, allDrops[stack.getItemDamage()].getName());
}
@Override
public IIcon getIconFromDamage(int par1){
return textures[par1];
return par1 >= textures.length ? null : textures[par1];
}
@Override

View file

@ -18,7 +18,8 @@ public enum TheMiscItems implements INameableItem{
TINY_COAL("TinyCoal", EnumRarity.common, "itemTinyCoal"),
TINY_CHAR("TinyCharcoal", EnumRarity.common, "itemTinyChar"),
RICE_SLIME("RiceSlime", EnumRarity.uncommon, "slimeball"),
CANOLA("Canola", EnumRarity.uncommon, "itemCanola");
CANOLA("Canola", EnumRarity.uncommon, "itemCanola"),
CUP("Cup", EnumRarity.uncommon, "itemCup");
public final String name;
public final String oredictName;

View file

@ -5,32 +5,32 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
public enum ThePotionRings implements INameableItem{
SPEED("Speed", 8171462, 1, 0, 1, 10, false, EnumRarity.uncommon, new ItemStack(Items.sugar)),
//TODO Slowness
HASTE("Haste", 14270531, 3, 0, 1, 10, false, EnumRarity.epic, new ItemStack(Items.repeater)),
//TODO Mining Fatigue
STRENGTH("Strength", 9643043, 5, 0, 1, 10, false, EnumRarity.rare, new ItemStack(Items.blaze_powder)),
SPEED(Potion.moveSpeed.getName(), 8171462, Potion.moveSpeed.getId(), 0, 1, 10, false, EnumRarity.uncommon, new ItemStack(Items.sugar)),
//Slowness
HASTE(Potion.digSpeed.getName(), 14270531, Potion.digSpeed.getId(), 0, 1, 10, false, EnumRarity.epic, new ItemStack(Items.repeater)),
//Mining Fatigue
STRENGTH(Potion.damageBoost.getName(), 9643043, Potion.damageBoost.getId(), 0, 1, 10, false, EnumRarity.rare, new ItemStack(Items.blaze_powder)),
//Health (Not Happening)
//TODO Damage
JUMP_BOOST("JumpBoost", 7889559, 8, 0, 1, 10, false, EnumRarity.rare, new ItemStack(Blocks.piston)),
//TODO Nausea
REGEN("Regen", 13458603, 10, 0, 1, 50, true, EnumRarity.rare, new ItemStack(Items.ghast_tear)),
RESISTANCE("Resistance", 10044730, 11, 0, 1, 10, false, EnumRarity.epic, new ItemStack(Items.slime_ball)),
FIRE_RESISTANCE("FireResistance", 14981690, 12, 0, 0, 10, false, EnumRarity.uncommon, new ItemStack(Items.magma_cream)),
WATER_BREATHING("WaterBreathing", 3035801, 13, 0, 0, 10, false, EnumRarity.rare, new ItemStack(Items.fish, 1, 3)),
INVISIBILITY("Invisibility", 8356754, 14, 0, 0, 10, false, EnumRarity.epic, new ItemStack(Items.fermented_spider_eye)),
//TODO Blindness
NIGHT_VISION("NightVision", 2039713, 16, 0, 0, 300, false, EnumRarity.rare, new ItemStack(Items.golden_carrot)),
//TODO Hunger
//TODO Weakness
//TODO Poison
//TODO Withering
//Damage
JUMP_BOOST(Potion.jump.getName(), 7889559, Potion.jump.getId(), 0, 1, 10, false, EnumRarity.rare, new ItemStack(Blocks.piston)),
//Nausea
REGEN(Potion.regeneration.getName(), 13458603, Potion.regeneration.getId(), 0, 1, 50, true, EnumRarity.rare, new ItemStack(Items.ghast_tear)),
RESISTANCE(Potion.resistance.getName(), 10044730, Potion.resistance.getId(), 0, 1, 10, false, EnumRarity.epic, new ItemStack(Items.slime_ball)),
FIRE_RESISTANCE(Potion.fireResistance.getName(), 14981690, Potion.fireResistance.getId(), 0, 0, 10, false, EnumRarity.uncommon, new ItemStack(Items.magma_cream)),
WATER_BREATHING(Potion.waterBreathing.getName(), 3035801, Potion.waterBreathing.getId(), 0, 0, 10, false, EnumRarity.rare, new ItemStack(Items.fish, 1, 3)),
INVISIBILITY(Potion.invisibility.getName(), 8356754, Potion.invisibility.getId(), 0, 0, 10, false, EnumRarity.epic, new ItemStack(Items.fermented_spider_eye)),
//Blindness
NIGHT_VISION(Potion.nightVision.getName(), 2039713, Potion.nightVision.getId(), 0, 0, 300, false, EnumRarity.rare, new ItemStack(Items.golden_carrot));
//Hunger
//Weakness
//Poison
//Withering
//Health Boost (Not Happening)
//Absorption (Not Happening)
SATURATION("Saturation", 16262179, 23, 0, 1, 10, false, EnumRarity.epic, new ItemStack(Items.cooked_beef));
public final String name;
public final int color;

View file

@ -0,0 +1,133 @@
package ellpeck.actuallyadditions.items.tools;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.UseHoeEvent;
import java.util.List;
import java.util.Set;
@SuppressWarnings("unchecked")
public class ItemAllToolAA extends ItemTool implements INameableItem{
private static final Set axeSet = Sets.newHashSet(Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2, Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin);
private static final Set pickSet = Sets.newHashSet(Blocks.cobblestone, Blocks.double_stone_slab, Blocks.stone_slab, Blocks.stone, Blocks.sandstone, Blocks.mossy_cobblestone, Blocks.iron_ore, Blocks.iron_block, Blocks.coal_ore, Blocks.gold_block, Blocks.gold_ore, Blocks.diamond_ore, Blocks.diamond_block, Blocks.ice, Blocks.netherrack, Blocks.lapis_ore, Blocks.lapis_block, Blocks.redstone_ore, Blocks.lit_redstone_ore, Blocks.rail, Blocks.detector_rail, Blocks.golden_rail, Blocks.activator_rail);
private static final Set shovelSet = Sets.newHashSet(Blocks.grass, Blocks.dirt, Blocks.sand, Blocks.gravel, Blocks.snow_layer, Blocks.snow, Blocks.clay, Blocks.farmland, Blocks.soul_sand, Blocks.mycelium);
private static final Set allSet = Sets.newHashSet();
static{
allSet.addAll(axeSet);
allSet.addAll(pickSet);
allSet.addAll(shovelSet);
}
private String name;
private EnumRarity rarity;
private ItemStack repairItem;
private String oredictName;
public ItemAllToolAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
super(5.0F, toolMat, allSet);
this.repairItem = repairItem;
this.name = unlocalizedName;
this.oredictName = unlocalizedName;
this.rarity = rarity;
this.setMaxDamage(this.getMaxDamage()*4);
}
@Override
public float func_150893_a(ItemStack stack, Block block){
return block.getMaterial() != Material.iron && block.getMaterial() != Material.anvil && block.getMaterial() != Material.rock && block.getMaterial() != Material.wood && block.getMaterial() != Material.plants && block.getMaterial() != Material.vine ? super.func_150893_a(stack, block) : this.efficiencyOnProperMaterial;
}
@Override
public boolean func_150897_b(Block block){
return block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock || (block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2));
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".paxel.desc"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage());
}
else list.add(ItemUtil.shiftForInfo());
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ){
if (!player.canPlayerEdit(x, y, z, side, stack)) return false;
else{
UseHoeEvent event = new UseHoeEvent(player, stack, world, x, y, z);
if(MinecraftForge.EVENT_BUS.post(event)) return false;
if(event.getResult() == Event.Result.ALLOW){
stack.damageItem(1, player);
return true;
}
Block block = world.getBlock(x, y, z);
if(side != 0 && world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) && (block == Blocks.grass || block == Blocks.dirt)){
Block block1 = Blocks.farmland;
world.playSoundEffect((double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), block1.stepSound.getStepResourcePath(), (block1.stepSound.getVolume() + 1.0F) / 2.0F, block1.stepSound.getPitch() * 0.8F);
if (world.isRemote) return true;
else{
world.setBlock(x, y, z, block1);
stack.damageItem(1, player);
return true;
}
}
else return false;
}
}
@Override
public boolean getIsRepairable(ItemStack itemToRepair, ItemStack stack){
return stack.getItem() == repairItem.getItem();
}
@Override
public EnumRarity getRarity(ItemStack stack){
return this.rarity;
}
@Override
public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public String getName(){
return name;
}
@Override
public String getOredictName(){
return oredictName;
}
}

View file

@ -0,0 +1,152 @@
package ellpeck.actuallyadditions.nei;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import ellpeck.actuallyadditions.inventory.gui.GuiCoffeeMachine;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.ItemCoffee;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class CoffeeMachineRecipeHandler extends TemplateRecipeHandler{
public static final String NAME = "actuallyadditions.coffee";
public CoffeeMachineRecipeHandler(){
super();
RecipeInfo.setGuiOffset(this.getGuiClass(), 32, 3);
}
public class CachedCoffee extends CachedRecipe{
public PositionedStack cup;
public PositionedStack coffeeBeans;
public PositionedStack result;
public PositionedStack ingredientStack;
public String extraText;
public CachedCoffee(ItemCoffee.Ingredient ingredient){
this.cup = new PositionedStack(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal()), 45, 39);
this.coffeeBeans = new PositionedStack(new ItemStack(InitItems.itemCoffeeBean), 2, 39);
this.ingredientStack = new PositionedStack(ingredient.ingredient, 90, 21);
this.setupResult(ingredient);
this.extraText = ingredient.getExtraText();
}
public void setupResult(ItemCoffee.Ingredient ingredient){
ItemStack result = new ItemStack(InitItems.itemCoffee);
ItemCoffee.addEffectToStack(result, ingredient);
this.result = new PositionedStack(result.copy(), 45, 70);
}
@Override
public List<PositionedStack> getIngredients(){
ArrayList<PositionedStack> list = new ArrayList<PositionedStack>();
list.add(this.ingredientStack);
list.add(this.cup);
list.add(this.coffeeBeans);
return list;
}
@Override
public PositionedStack getResult(){
return result;
}
}
@Override
public int recipiesPerPage(){
return 1;
}
@Override
public void loadTransferRects(){
transferRects.add(new RecipeTransferRect(new Rectangle(21, 39, 22, 16), NAME));
transferRects.add(new RecipeTransferRect(new Rectangle(67, 42, 22, 10), NAME));
}
@Override
public Class<? extends GuiContainer> getGuiClass(){
return GuiCoffeeMachine.class;
}
@Override
public String getRecipeName(){
return StatCollector.translateToLocal("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, 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(21, 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(StatCollector.translateToLocal("container.nei." + ModUtil.MOD_ID_LOWER + ".coffee.special"), 2, 6, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
GuiDraw.drawString(cache.extraText, 2, 18, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
GuiDraw.drawString("[SHIFT]!", 1, 75, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
@Override
public String getOverlayIdentifier(){
return NAME;
}
}

View file

@ -19,7 +19,7 @@ import java.util.Collections;
public class CompostRecipeHandler extends TemplateRecipeHandler{
public static final String NAME = "compost";
public static final String NAME = "actuallyadditions.compost";
public CompostRecipeHandler(){
super();
@ -60,7 +60,7 @@ public class CompostRecipeHandler extends TemplateRecipeHandler{
@Override
public String getRecipeName(){
return StatCollector.translateToLocal("container." + ModUtil.MOD_ID_LOWER + ".nei." + NAME + ".name");
return StatCollector.translateToLocal("container.nei." + NAME + ".name");
}
@Override

View file

@ -5,7 +5,7 @@ import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import ellpeck.actuallyadditions.inventory.GuiGrinder;
import ellpeck.actuallyadditions.inventory.gui.GuiGrinder;
import ellpeck.actuallyadditions.recipe.GrinderRecipes;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
@ -21,7 +21,7 @@ import java.util.List;
public class CrusherRecipeHandler extends TemplateRecipeHandler{
public static final String NAME = "crushing";
public static final String NAME = "actuallyadditions.crushing";
public CrusherRecipeHandler(){
super();
@ -78,7 +78,7 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{
@Override
public String getRecipeName(){
return StatCollector.translateToLocal("container." + ModUtil.MOD_ID_LOWER + ".nei." + NAME + ".name");
return StatCollector.translateToLocal("container.nei." + NAME + ".name");
}
@Override

View file

@ -19,7 +19,7 @@ import java.util.Collections;
public class HairyBallRecipeHandler extends TemplateRecipeHandler{
public static final String NAME = "ballOfHair";
public static final String NAME = "actuallyadditions.ballOfHair";
public HairyBallRecipeHandler(){
super();
@ -61,7 +61,7 @@ public class HairyBallRecipeHandler extends TemplateRecipeHandler{
@Override
public String getRecipeName(){
return StatCollector.translateToLocal("container." + ModUtil.MOD_ID_LOWER + ".nei." + NAME + ".name");
return StatCollector.translateToLocal("container.nei." + NAME + ".name");
}
@Override

View file

@ -4,7 +4,7 @@ import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import codechicken.nei.recipe.DefaultOverlayHandler;
import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.inventory.GuiCrafter;
import ellpeck.actuallyadditions.inventory.gui.GuiCrafter;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.item.ItemStack;
@ -30,9 +30,14 @@ public class NEIActuallyAdditionsConfig implements IConfigureNEI{
API.registerRecipeHandler(compostRecipeHandler);
API.registerUsageHandler(compostRecipeHandler);
CoffeeMachineRecipeHandler coffeeMachineRecipeHandler = new CoffeeMachineRecipeHandler();
API.registerRecipeHandler(coffeeMachineRecipeHandler);
API.registerUsageHandler(coffeeMachineRecipeHandler);
API.hideItem(new ItemStack(InitBlocks.blockRice));
API.hideItem(new ItemStack(InitBlocks.blockCanola));
API.hideItem(new ItemStack(InitBlocks.blockFlax));
API.hideItem(new ItemStack(InitBlocks.blockCoffee));
}
@Override

View file

@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.network;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;
import ellpeck.actuallyadditions.network.gui.PacketGuiButton;
import ellpeck.actuallyadditions.util.ModUtil;
public class PacketHandler{
@ -13,7 +14,7 @@ public class PacketHandler{
theNetwork = NetworkRegistry.INSTANCE.newSimpleChannel(ModUtil.MOD_ID_LOWER);
theNetwork.registerMessage(PacketTileEntityFeeder.Handler.class, PacketTileEntityFeeder.class, 0, Side.CLIENT);
theNetwork.registerMessage(PacketInputterButton.Handler.class, PacketInputterButton.class, 1, Side.SERVER);
theNetwork.registerMessage(PacketGuiButton.Handler.class, PacketGuiButton.class, 1, Side.SERVER);
theNetwork.registerMessage(PacketFluidCollectorToClient.Handler.class, PacketFluidCollectorToClient.class, 2, Side.CLIENT);
}
}

View file

@ -6,7 +6,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.GuiFeeder;
import ellpeck.actuallyadditions.inventory.gui.GuiFeeder;
import ellpeck.actuallyadditions.tile.TileEntityFeeder;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.Minecraft;

View file

@ -0,0 +1,8 @@
package ellpeck.actuallyadditions.network.gui;
import net.minecraft.entity.player.EntityPlayer;
public interface IButtonReactor{
void onButtonPressed(int buttonID, EntityPlayer player);
}

View file

@ -1,33 +1,35 @@
package ellpeck.actuallyadditions.network;
package ellpeck.actuallyadditions.network.gui;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import ellpeck.actuallyadditions.tile.TileEntityInputter;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
public class PacketInputterButton implements IMessage{
public class PacketGuiButton implements IMessage{
private int tileX;
private int tileY;
private int tileZ;
private int worldID;
private int buttonID;
private int playerID;
@SuppressWarnings("unused")
public PacketInputterButton(){
public PacketGuiButton(){
}
public PacketInputterButton(int x, int y, int z, World world, int buttonID){
public PacketGuiButton(int x, int y, int z, World world, int buttonID, EntityPlayer player){
this.tileX = x;
this.tileY = y;
this.tileZ = z;
this.worldID = world.provider.dimensionId;
this.buttonID = buttonID;
this.playerID = player.getEntityId();
}
@Override
@ -37,6 +39,7 @@ public class PacketInputterButton implements IMessage{
this.tileZ = buf.readInt();
this.worldID = buf.readInt();
this.buttonID = buf.readInt();
this.playerID = buf.readInt();
}
@Override
@ -46,18 +49,19 @@ public class PacketInputterButton implements IMessage{
buf.writeInt(this.tileZ);
buf.writeInt(this.worldID);
buf.writeInt(this.buttonID);
buf.writeInt(this.playerID);
}
public static class Handler implements IMessageHandler<PacketInputterButton, IMessage>{
public static class Handler implements IMessageHandler<PacketGuiButton, IMessage>{
@Override
public IMessage onMessage(PacketInputterButton message, MessageContext ctx){
public IMessage onMessage(PacketGuiButton message, MessageContext ctx){
World world = DimensionManager.getWorld(message.worldID);
TileEntity tile = world.getTileEntity(message.tileX, message.tileY, message.tileZ);
if(tile instanceof TileEntityInputter){
TileEntityInputter inputter = (TileEntityInputter)tile;
inputter.onButtonPressed(message.buttonID);
if(tile instanceof IButtonReactor){
IButtonReactor reactor = (IButtonReactor)tile;
reactor.onButtonPressed(message.buttonID, (EntityPlayer)world.getEntityByID(message.playerID));
}
return null;

View file

@ -8,9 +8,7 @@ import ellpeck.actuallyadditions.blocks.render.*;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.event.RenderPlayerEventAA;
import ellpeck.actuallyadditions.tile.TileEntityCompost;
import ellpeck.actuallyadditions.tile.TileEntityFishingNet;
import ellpeck.actuallyadditions.tile.TileEntityFurnaceSolar;
import ellpeck.actuallyadditions.tile.*;
import ellpeck.actuallyadditions.update.UpdateChecker;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
@ -43,6 +41,12 @@ public class ClientProxy implements IProxy{
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFurnaceSolar.class, new RenderTileEntity(new ModelFurnaceSolar()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockFurnaceSolar), new RenderItems(new ModelFurnaceSolar()));
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCoffeeMachine.class, new RenderTileEntity(new ModelCoffeeMachine()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockCoffeeMachine), new RenderItems(new ModelCoffeeMachine()));
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPhantomBooster.class, new RenderTileEntity(new ModelPhantomBooster()));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.blockPhantomBooster), new RenderItems(new ModelPhantomBooster()));
VillagerRegistry.instance().registerVillagerSkin(ConfigIntValues.JAM_VILLAGER_ID.getValue(), new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/entity/villager/jamVillager.png"));
Util.registerEvent(new RenderPlayerEventAA());

View file

@ -19,6 +19,12 @@ public class FuelHandler implements IFuelHandler{
private static HashMap<Pair<Item, Integer>, Integer> fuelList = new HashMap<Pair<Item, Integer>, Integer>();
public static void setFuelValues(){
addFuel(InitItems.itemMisc, TheMiscItems.TINY_CHAR.ordinal(), 200);
addFuel(InitItems.itemMisc, TheMiscItems.TINY_COAL.ordinal(), 200);
addFuel(InitBlocks.blockMisc, TheMiscBlocks.CHARCOAL_BLOCK.ordinal(), 16000);
}
public static void init(){
Util.logInfo("Initializing Fuelstuffs...");
@ -31,28 +37,14 @@ public class FuelHandler implements IFuelHandler{
return getFuelValue(fuel);
}
public static void setFuelValues(){
addFuel(InitItems.itemMisc, TheMiscItems.TINY_CHAR.ordinal(), 200);
addFuel(InitItems.itemMisc, TheMiscItems.TINY_COAL.ordinal(), 200);
addFuel(InitBlocks.blockMisc, TheMiscBlocks.CHARCOAL_BLOCK.ordinal(), 16000);
}
private static void addFuel(Item item, int metadata, int value){
fuelList.put(Pair.of(item, metadata), value);
}
private static void addFuel(Item item, int value){
addFuel(item, 0, value);
}
private static void addFuel(Block block, int metadata, int value){
addFuel(Item.getItemFromBlock(block), metadata, value);
}
private static void addFuel(Block block, int value){
addFuel(Item.getItemFromBlock(block), 0, value);
}
private static int getFuelValue(ItemStack stack){
if(stack != null && stack.getItem() != null){
Pair<Item, Integer> pair = Pair.of(stack.getItem(), stack.getItemDamage());

View file

@ -39,6 +39,7 @@ public class TileEntityBase extends TileEntity{
GameRegistry.registerTileEntity(TileEntityFluidCollector.class, ModUtil.MOD_ID_LOWER + ":tileEntityFluidCollector");
GameRegistry.registerTileEntity(TileEntityFluidCollector.TileEntityFluidPlacer.class, ModUtil.MOD_ID_LOWER + ":tileEntityFluidPlacer");
GameRegistry.registerTileEntity(TileEntityLavaFactoryController.class, ModUtil.MOD_ID_LOWER + ":tileEntityLavaFactoryController");
GameRegistry.registerTileEntity(TileEntityCoffeeMachine.class, ModUtil.MOD_ID_LOWER + ":tileEntityCoffeeMachine");
}
@Override

View file

@ -39,15 +39,6 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
//TODO Remove after some Updating
if(this.isPlacer && this.getClass() != TileEntityPlacer.class){
ItemStack[] theSlots = this.slots.clone();
worldObj.removeTileEntity(xCoord, yCoord, zCoord);
worldObj.setTileEntity(xCoord, yCoord, zCoord, new TileEntityPlacer());
((TileEntityPlacer)worldObj.getTileEntity(xCoord, yCoord, zCoord)).slots = theSlots.clone();
}
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){
if(this.currentTime > 0){
this.currentTime--;

View file

@ -17,7 +17,7 @@ import net.minecraftforge.fluids.*;
public class TileEntityCanolaPress extends TileEntityInventoryBase implements IEnergyReceiver, IFluidHandler{
public EnergyStorage storage = new EnergyStorage(40000, energyUsedPerTick+50);
public EnergyStorage storage = new EnergyStorage(40000);
public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);

View file

@ -13,7 +13,7 @@ import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityCoalGenerator extends TileEntityInventoryBase implements IEnergyProvider{
public EnergyStorage storage = new EnergyStorage(60000, energyProducedPerTick+50);
public EnergyStorage storage = new EnergyStorage(60000);
public static int energyProducedPerTick = ConfigIntValues.COAL_GEN_ENERGY_PRODUCED.getValue();
@ -34,10 +34,11 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
this.storage.receiveEnergy(energyProducedPerTick, false);
}
if(energyProducedPerTick*100 <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN)){
if(this.currentBurnTime <= 0 && this.slots[0] != null && TileEntityFurnace.getItemBurnTime(this.slots[0]) > 0){
this.maxBurnTime = TileEntityFurnace.getItemBurnTime(this.slots[0]);
this.currentBurnTime = this.maxBurnTime;
int burnTime = TileEntityFurnace.getItemBurnTime(this.slots[0]);
if(energyProducedPerTick*burnTime <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN)){
this.maxBurnTime = burnTime;
this.currentBurnTime = burnTime;
this.slots[0].stackSize--;
if(this.slots[0].stackSize == 0) this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]);
}

View file

@ -0,0 +1,169 @@
package ellpeck.actuallyadditions.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.ItemCoffee;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.network.gui.IButtonReactor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements IButtonReactor, IEnergyReceiver{
public static final int SLOT_COFFEE_BEANS = 0;
public static final int SLOT_INPUT = 1;
public static final int SLOT_OUTPUT = 2;
public EnergyStorage storage = new EnergyStorage(300000);
public static int energyUsePerTick = ConfigIntValues.COFFEE_MACHINE_ENERGY_USED.getValue();
public final int coffeeCacheMaxAmount = 300;
public final int coffeeCacheAddPerItem = ConfigIntValues.COFFEE_CACHE_ADDED_PER_ITEM.getValue();
public final int coffeeCacheUsePerItem = ConfigIntValues.COFFEE_CACHE_USED_PER_ITEM.getValue();
public int coffeeCacheAmount;
public final int maxBrewTime = ConfigIntValues.COFFEE_MACHINE_TIME_USED.getValue();
public int brewTime;
public TileEntityCoffeeMachine(){
super(11, "coffeeMachine");
}
@Override
public void updateEntity(){
if(!worldObj.isRemote){
this.storeCoffee();
if(this.brewTime > 0 || worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){
this.brew();
}
}
}
public void storeCoffee(){
if(this.slots[SLOT_COFFEE_BEANS] != null && this.slots[SLOT_COFFEE_BEANS].getItem() == InitItems.itemCoffeeBean){
if(this.coffeeCacheAddPerItem <= this.coffeeCacheMaxAmount-this.coffeeCacheAmount){
this.slots[SLOT_COFFEE_BEANS].stackSize--;
if(this.slots[SLOT_COFFEE_BEANS].stackSize <= 0) this.slots[SLOT_COFFEE_BEANS] = null;
this.coffeeCacheAmount += this.coffeeCacheAddPerItem;
}
}
}
public void brew(){
if(!worldObj.isRemote){
if(this.slots[SLOT_INPUT] != null && this.slots[SLOT_INPUT].getItem() == InitItems.itemMisc && this.slots[SLOT_INPUT].getItemDamage() == TheMiscItems.CUP.ordinal() && this.slots[SLOT_OUTPUT] == null && this.storage.getEnergyStored() >= energyUsePerTick && this.coffeeCacheAmount >= this.coffeeCacheUsePerItem){
this.brewTime++;
if(this.brewTime >= this.maxBrewTime){
this.brewTime = 0;
ItemStack output = new ItemStack(InitItems.itemCoffee);
while(getFirstAvailIngredient() > 0){
int ingr = this.getFirstAvailIngredient();
ItemCoffee.Ingredient ingredient = ItemCoffee.getIngredientFromStack(this.slots[ingr]);
if(ingredient != null){
ingredient.effect(output);
}
this.slots[ingr].stackSize--;
if(this.slots[ingr].stackSize <= 0) this.slots[ingr] = this.slots[ingr].getItem().getContainerItem(this.slots[ingr]);
}
this.slots[SLOT_OUTPUT] = output.copy();
this.slots[SLOT_INPUT].stackSize--;
if(this.slots[SLOT_INPUT].stackSize <= 0) this.slots[SLOT_INPUT] = null;
this.coffeeCacheAmount -= this.coffeeCacheUsePerItem;
}
}
else this.brewTime = 0;
if(this.brewTime > 0) this.storage.extractEnergy(energyUsePerTick, false);
}
}
public int getFirstAvailIngredient(){
for(int i = 3; i < this.slots.length; i++){
if(this.slots[i] != null && this.slots[i].stackSize == 1 && ItemCoffee.getIngredientFromStack((this.slots[i])) != null){
return i;
}
}
return 0;
}
@SideOnly(Side.CLIENT)
public int getCoffeeScaled(int i){
return this.coffeeCacheAmount * i / this.coffeeCacheMaxAmount;
}
@SideOnly(Side.CLIENT)
public int getEnergyScaled(int i){
return this.getEnergyStored(ForgeDirection.UNKNOWN) * i / this.getMaxEnergyStored(ForgeDirection.UNKNOWN);
}
@SideOnly(Side.CLIENT)
public int getBrewScaled(int i){
return this.brewTime * i / this.maxBrewTime;
}
@Override
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
this.storage.writeToNBT(compound);
compound.setInteger("Cache", this.coffeeCacheAmount);
compound.setInteger("Time", this.brewTime);
}
@Override
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
this.storage.readFromNBT(compound);
this.coffeeCacheAmount = compound.getInteger("Cache");
this.brewTime = compound.getInteger("Time");
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null && (this.slots[i] == null || this.slots[i].stackSize < 1)) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal());
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return slot == SLOT_OUTPUT || (slot >= 3 && ItemCoffee.getIngredientFromStack(stack) == null);
}
@Override
public void onButtonPressed(int buttonID, EntityPlayer player){
if(buttonID == 0 && this.brewTime <= 0){
this.brew();
}
}
@Override
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
return this.storage.receiveEnergy(maxReceive, simulate);
}
@Override
public int getEnergyStored(ForgeDirection from){
return this.storage.getEnergyStored();
}
@Override
public int getMaxEnergyStored(ForgeDirection from){
return this.storage.getMaxEnergyStored();
}
@Override
public boolean canConnectEnergy(ForgeDirection from){
return true;
}
}

View file

@ -101,7 +101,7 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == 0 && FluidContainerRegistry.containsFluid(this.slots[0], new FluidStack(InitBlocks.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))) || (i == 2 && stack.getItem() == Items.bucket);
return (i == 0 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))) || (i == 2 && stack.getItem() == Items.bucket);
}
@Override

View file

@ -49,12 +49,12 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
@Override
public boolean canFill(ForgeDirection from, Fluid fluid){
return this.isPlacer && from != ForgeDirection.DOWN;
return this.isPlacer;
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid){
return !this.isPlacer && from != ForgeDirection.UP;
return !this.isPlacer;
}
@Override

View file

@ -17,7 +17,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
public static final int SLOT_INPUT_2 = 2;
public static final int SLOT_OUTPUT_2 = 3;
public EnergyStorage storage = new EnergyStorage(30000, energyUsePerTick+30);
public EnergyStorage storage = new EnergyStorage(30000);
public static int energyUsePerTick = ConfigIntValues.FURNACE_ENERGY_USED.getValue();

View file

@ -29,7 +29,7 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro
return from != ForgeDirection.UP;
}
public EnergyStorage storage = new EnergyStorage(30000, energyProducedPerTick+50);
public EnergyStorage storage = new EnergyStorage(30000);
public static int energyProducedPerTick = ConfigIntValues.FURNACE_SOLAR_ENERGY_PRODUCED.getValue();

View file

@ -14,7 +14,7 @@ import java.util.Random;
public class TileEntityGrinder extends TileEntityInventoryBase implements IEnergyReceiver{
public EnergyStorage storage = new EnergyStorage(60000, energyUsePerTick+20);
public EnergyStorage storage = new EnergyStorage(60000);
@Override
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
@ -78,15 +78,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
//TODO Remove after some Updating
if(this.isDouble && this.getClass() != TileEntityGrinderDouble.class){
ItemStack[] theSlots = this.slots.clone();
worldObj.removeTileEntity(xCoord, yCoord, zCoord);
worldObj.setTileEntity(xCoord, yCoord, zCoord, new TileEntityGrinderDouble());
((TileEntityGrinderDouble)worldObj.getTileEntity(xCoord, yCoord, zCoord)).slots = theSlots.clone();
}
boolean canCrushOnFirst = this.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2);
boolean canCrushOnSecond = false;
if(this.isDouble) canCrushOnSecond = this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2);

View file

@ -17,7 +17,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr
private int randomChance = ConfigIntValues.HEAT_COLLECTOR_LAVA_CHANCE.getValue();
private int blocksNeeded = ConfigIntValues.HEAT_COLLECTOR_BLOCKS.getValue();
public EnergyStorage storage = new EnergyStorage(30000, energyProducedPerTick+50);
public EnergyStorage storage = new EnergyStorage(30000);
public static int energyProducedPerTick = ConfigIntValues.HEAT_COLLECTOR_ENERGY_PRODUCED.getValue();

View file

@ -1,25 +1,30 @@
package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.network.gui.IButtonReactor;
import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
public class TileEntityInputter extends TileEntityInventoryBase{
public class TileEntityInputter extends TileEntityInventoryBase implements IButtonReactor{
public static class TileEntityInputterAdvanced extends TileEntityInputter{
public TileEntityInputterAdvanced(){
super(13, "inputterAdvanced");
super(25, "inputterAdvanced");
this.isAdvanced = true;
}
}
public static final int PUT_FILTER_START = 1;
public static final int PULL_FILTER_START = 7;
public static final int PUT_FILTER_START = 13;
public static final int PULL_FILTER_START = 1;
public static final int WHITELIST_PULL_BUTTON_ID = 87;
public static final int WHITELIST_PUT_BUTTON_ID = 88;
public int sideToPut = -1;
public int slotToPut = -1;
@ -33,6 +38,9 @@ public class TileEntityInputter extends TileEntityInventoryBase{
public boolean isAdvanced;
public boolean isPullWhitelist = true;
public boolean isPutWhitelist = true;
public TileEntityInputter(int slots, String name){
super(slots, name);
}
@ -45,15 +53,6 @@ public class TileEntityInputter extends TileEntityInventoryBase{
@Override
public void updateEntity(){
if(!worldObj.isRemote){
//TODO Remove after some Updating
if(this.isAdvanced && this.getClass() != TileEntityInputterAdvanced.class){
ItemStack[] theSlots = this.slots.clone();
worldObj.removeTileEntity(xCoord, yCoord, zCoord);
worldObj.setTileEntity(xCoord, yCoord, zCoord, new TileEntityInputterAdvanced());
((TileEntityInputterAdvanced)worldObj.getTileEntity(xCoord, yCoord, zCoord)).slots = theSlots.clone();
}
this.initVars();
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){
@ -80,7 +79,7 @@ public class TileEntityInputter extends TileEntityInventoryBase{
if(tempStack.getMaxStackSize() < this.getInventoryStackLimit()) maxSize = tempStack.getMaxStackSize();
else maxSize = this.getInventoryStackLimit();
}
if(tempStack != null && (this.slots[0] == null || (tempStack.isItemEqual(this.slots[0]) && this.slots[0].stackSize < maxSize)) && this.checkFilters(tempStack, true)){
if(tempStack != null && (this.slots[0] == null || (tempStack.isItemEqual(this.slots[0]) && this.slots[0].stackSize < maxSize)) && this.checkFilters(tempStack, true, isPullWhitelist)){
if(theSided != null){
for(int j = 0; j < 5; j++){
if(theSided.canExtractItem(i, tempStack, j)){
@ -138,7 +137,7 @@ public class TileEntityInputter extends TileEntityInventoryBase{
if(tempStack.getMaxStackSize() < theInventory.getInventoryStackLimit()) maxSize = tempStack.getMaxStackSize();
else maxSize = theInventory.getInventoryStackLimit();
}
if((tempStack == null || (theInventory.isItemValidForSlot(i, this.slots[0]) && tempStack.isItemEqual(this.slots[0]) && tempStack.stackSize < maxSize)) && this.checkFilters(this.slots[0], false)){
if((tempStack == null || (theInventory.isItemValidForSlot(i, this.slots[0]) && tempStack.isItemEqual(this.slots[0]) && tempStack.stackSize < maxSize)) && this.checkFilters(this.slots[0], false, isPutWhitelist)){
if(theSided != null){
for(int j = 0; j < 5; j++){
if(theSided.canInsertItem(i, this.slots[0], j)){
@ -182,16 +181,16 @@ public class TileEntityInputter extends TileEntityInventoryBase{
}
}
public boolean checkFilters(ItemStack stack, boolean isPull){
public boolean checkFilters(ItemStack stack, boolean isPull, boolean isWhitelist){
if(!this.isAdvanced) return true;
int slotStart = isPull ? PULL_FILTER_START : PUT_FILTER_START;
int slotStop = slotStart+6;
int slotStop = slotStart+12;
for(int i = slotStart; i < slotStop; i++){
if(this.slots[i] != null && this.slots[i].isItemEqual(stack)) return true;
if(this.slots[i] != null && this.slots[i].isItemEqual(stack)) return isWhitelist;
}
return false;
return !isWhitelist;
}
public void initVars(){
@ -216,7 +215,17 @@ public class TileEntityInputter extends TileEntityInventoryBase{
}
}
public void onButtonPressed(int buttonID){
@Override
public void onButtonPressed(int buttonID, EntityPlayer player){
if(buttonID == WHITELIST_PULL_BUTTON_ID){
this.isPullWhitelist = !this.isPullWhitelist;
return;
}
if(buttonID == WHITELIST_PUT_BUTTON_ID){
this.isPutWhitelist = !this.isPutWhitelist;
return;
}
if(buttonID == 0) this.sideToPut++;
if(buttonID == 1) this.sideToPut--;
if(buttonID == 2) this.slotToPut++;
@ -244,6 +253,8 @@ public class TileEntityInputter extends TileEntityInventoryBase{
compound.setInteger("SlotToPut", this.slotToPut);
compound.setInteger("SideToPull", this.sideToPull);
compound.setInteger("SlotToPull", this.slotToPull);
compound.setBoolean("PullWhitelist", this.isPullWhitelist);
compound.setBoolean("PutWhitelist", this.isPutWhitelist);
}
@Override
@ -252,6 +263,8 @@ public class TileEntityInputter extends TileEntityInventoryBase{
this.slotToPut = compound.getInteger("SlotToPut");
this.sideToPull = compound.getInteger("SideToPull");
this.slotToPull = compound.getInteger("SlotToPull");
this.isPullWhitelist = compound.getBoolean("PullWhitelist");
this.isPutWhitelist = compound.getBoolean("PutWhitelist");
super.readFromNBT(compound);
}

View file

@ -14,7 +14,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
public static final int SLOT_INPUT = 0;
public static final int SLOT_OUTPUT = 1;
public EnergyStorage storage = new EnergyStorage(300000, energyUsePerTick+100);
public EnergyStorage storage = new EnergyStorage(300000);
private final int speedSlowdown = ConfigIntValues.REPAIRER_SPEED_SLOWDOWN.getValue();

View file

@ -13,7 +13,7 @@ import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityLavaFactoryController extends TileEntityBase implements IEnergyReceiver{
public EnergyStorage storage = new EnergyStorage(3000000, energyNeededToProduceLava*2);
public EnergyStorage storage = new EnergyStorage(3000000);
public static int energyNeededToProduceLava = ConfigIntValues.LAVA_FACTORY_ENERGY_USED.getValue();

View file

@ -15,7 +15,7 @@ import net.minecraftforge.fluids.*;
public class TileEntityOilGenerator extends TileEntityInventoryBase implements IEnergyProvider, IFluidHandler{
public EnergyStorage storage = new EnergyStorage(30000, energyProducedPerTick+50);
public EnergyStorage storage = new EnergyStorage(30000);
public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
@ -40,7 +40,7 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
this.storage.receiveEnergy(energyProducedPerTick, false);
}
if(energyProducedPerTick*this.maxBurnTime/2 <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN)){
if(energyProducedPerTick*this.maxBurnTime <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN)){
if(this.currentBurnTime <= 0 && this.tank.getFluidAmount() >= this.fuelUsedPerBurnup){
this.currentBurnTime = this.maxBurnTime;
this.tank.drain(this.fuelUsedPerBurnup, true);
@ -102,7 +102,7 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return FluidContainerRegistry.containsFluid(this.slots[0], new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;
}
@Override

View file

@ -0,0 +1,5 @@
package ellpeck.actuallyadditions.tile;
public class TileEntityPhantomBooster extends TileEntityBase{
}

View file

@ -29,7 +29,8 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
public int currentTime;
public final int timeNeeded = ConfigIntValues.PHANTOM_PLACER_TIME.getValue();
public final int range = ConfigIntValues.PHANTOM_PLACER_RANGE.getValue();
public final int defaultRange = ConfigIntValues.PHANTOM_PLACER_RANGE.getValue();
public int range;
public boolean isBreaker;
@ -45,6 +46,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
@Override
public void updateEntity(){
if(!worldObj.isRemote){
this.range = TileEntityPhantomface.upgradeRange(defaultRange, worldObj, xCoord, yCoord, zCoord);
if(!this.hasBoundPosition()){
this.boundPosition = null;
@ -134,6 +136,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
if(x != 0 && y != 0 && z != 0){
this.boundPosition = new ChunkCoordinates(x, y, z);
this.boundWorld = DimensionManager.getWorld(compound.getInteger("WorldOfTileStored"));
this.markDirty();
}
}

View file

@ -4,14 +4,17 @@ import cofh.api.energy.IEnergyHandler;
import cofh.api.energy.IEnergyProvider;
import cofh.api.energy.IEnergyReceiver;
import ellpeck.actuallyadditions.blocks.BlockPhantomface;
import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.ForgeDirection;
@ -22,25 +25,43 @@ import net.minecraftforge.fluids.IFluidHandler;
public class TileEntityPhantomface extends TileEntityInventoryBase{
public TileEntity boundTile;
public ChunkCoordinates boundPosition;
public World boundWorld;
public int type;
public final int range = ConfigIntValues.PHANTOMFACE_RANGE.getValue();
public final int defaultRange = ConfigIntValues.PHANTOMFACE_RANGE.getValue();
public int range;
public TileEntityPhantomface(String name){
super(0, name);
}
public boolean canConnectTo(TileEntity tile){
return false;
public static int upgradeRange(int defaultRange, World world, int x, int y, int z){
int newRange = defaultRange;
for(int i = 0; i < 3; i++){
Block block = world.getBlock(x, y+1+i, z);
if(block == InitBlocks.blockPhantomBooster) newRange = newRange*2;
else break;
}
return newRange;
}
public static void updateAround(TileEntity tile){
tile.getWorldObj().markBlockForUpdate(tile.xCoord+1, tile.yCoord, tile.zCoord);
tile.getWorldObj().markBlockForUpdate(tile.xCoord-1, tile.yCoord, tile.zCoord);
tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord+1, tile.zCoord);
tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord-1, tile.zCoord);
tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord+1);
tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord-1);
tile.markDirty();
}
public boolean isBoundTileInRage(){
if(this.hasBoundTile()){
int xDif = this.boundTile.xCoord-this.xCoord;
int yDif = this.boundTile.yCoord-this.yCoord;
int zDif = this.boundTile.zCoord-this.zCoord;
int xDif = this.boundPosition.posX-this.xCoord;
int yDif = this.boundPosition.posY-this.yCoord;
int zDif = this.boundPosition.posZ-this.zCoord;
if(xDif >= -this.range && xDif <= this.range){
if(yDif >= -this.range && yDif <= this.range){
@ -54,34 +75,23 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
@Override
public void updateEntity(){
if(!worldObj.isRemote){
this.range = upgradeRange(defaultRange, worldObj, xCoord, yCoord, zCoord);
//TODO Remove after some Updating
if(this.type == BlockPhantomface.FACE && this.getClass() != TileEntityPhantomItemface.class){
ItemStack[] theSlots = this.slots.clone();
worldObj.removeTileEntity(xCoord, yCoord, zCoord);
worldObj.setTileEntity(xCoord, yCoord, zCoord, new TileEntityPhantomItemface());
((TileEntityPhantomItemface)worldObj.getTileEntity(xCoord, yCoord, zCoord)).slots = theSlots.clone();
}
if(!this.hasBoundTile()) this.boundTile = null;
if(this.tempX > 0 || this.tempY > 0 || this.tempZ > 0){
this.boundTile = tempWorld.getTileEntity(tempX, tempY, tempZ);
this.tempX = 0;
this.tempY = 0;
this.tempZ = 0;
this.tempWorld = null;
if(!this.hasBoundTile()){
this.boundPosition = null;
this.boundWorld = null;
}
}
}
public boolean hasBoundTile(){
if(this.boundTile != null){
if(this.xCoord == this.boundTile.xCoord && this.yCoord == this.boundTile.yCoord && this.zCoord == this.boundTile.zCoord && this.worldObj == this.boundTile.getWorldObj()){
this.boundTile = null;
if(this.boundPosition != null && this.boundWorld != null){
if(this.boundWorld.getTileEntity(boundPosition.posX, boundPosition.posY, boundPosition.posZ) instanceof TileEntityPhantomface || (this.xCoord == this.boundPosition.posX && this.yCoord == this.boundPosition.posY && this.zCoord == this.boundPosition.posZ && this.worldObj == this.boundWorld)){
this.boundPosition = null;
this.boundWorld = null;
return false;
}
return boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord) == boundTile && boundTile.getWorldObj() == this.worldObj;
return this.boundWorld == this.worldObj;
}
return false;
}
@ -90,25 +100,24 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
if(this.hasBoundTile()){
compound.setInteger("XCoordOfTileStored", boundTile.xCoord);
compound.setInteger("YCoordOfTileStored", boundTile.yCoord);
compound.setInteger("ZCoordOfTileStored", boundTile.zCoord);
compound.setInteger("WorldOfTileStored", boundTile.getWorldObj().provider.dimensionId);
compound.setInteger("XCoordOfTileStored", boundPosition.posX);
compound.setInteger("YCoordOfTileStored", boundPosition.posY);
compound.setInteger("ZCoordOfTileStored", boundPosition.posZ);
compound.setInteger("WorldOfTileStored", boundWorld.provider.dimensionId);
}
}
public int tempX;
public int tempY;
public int tempZ;
public World tempWorld;
@Override
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
this.tempX = compound.getInteger("XCoordOfTileStored");
this.tempY = compound.getInteger("YCoordOfTileStored");
this.tempZ = compound.getInteger("ZCoordOfTileStored");
this.tempWorld = DimensionManager.getWorld(compound.getInteger("WorldOfTileStored"));
int x = compound.getInteger("XCoordOfTileStored");
int y = compound.getInteger("YCoordOfTileStored");
int z = compound.getInteger("ZCoordOfTileStored");
if(x != 0 && y != 0 && z != 0){
this.boundPosition = new ChunkCoordinates(x, y, z);
this.boundWorld = DimensionManager.getWorld(compound.getInteger("WorldOfTileStored"));
this.markDirty();
}
}
@Override
@ -133,7 +142,7 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
super.updateEntity();
if(!worldObj.isRemote){
if(this.isBoundTileInRage() && this.getHandler() != null){
if(worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) && this.isBoundTileInRage() && this.getHandler() != null){
this.pushFluid(ForgeDirection.UP);
this.pushFluid(ForgeDirection.DOWN);
this.pushFluid(ForgeDirection.NORTH);
@ -165,23 +174,18 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
}
@Override
public boolean canConnectTo(TileEntity tile){
return tile instanceof IFluidHandler;
public boolean isBoundTileInRage(){
return super.isBoundTileInRage() && this.boundWorld.getTileEntity(boundPosition.posX, boundPosition.posY, boundPosition.posZ) instanceof IFluidHandler;
}
public IFluidHandler getHandler(){
TileEntity tile = boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord);
if(tile != null && tile instanceof IFluidHandler){
return (IFluidHandler)tile;
if(this.boundPosition != null && this.boundWorld != null){
TileEntity tile = boundWorld.getTileEntity(boundPosition.posX, boundPosition.posY, boundPosition.posZ);
if(tile instanceof IFluidHandler) return (IFluidHandler)tile;
}
return null;
}
@Override
public boolean hasBoundTile(){
return super.hasBoundTile() && this.boundTile instanceof IFluidHandler;
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){
if(this.isBoundTileInRage()) return this.getHandler().fill(from, resource, doFill);
@ -224,6 +228,11 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
this.type = BlockPhantomface.ENERGYFACE;
}
@Override
public boolean isBoundTileInRage(){
return super.isBoundTileInRage() && (this.boundWorld.getTileEntity(boundPosition.posX, boundPosition.posY, boundPosition.posZ) instanceof IEnergyReceiver || this.boundWorld.getTileEntity(boundPosition.posX, boundPosition.posY, boundPosition.posZ) instanceof IEnergyProvider);
}
@Override
public void updateEntity(){
super.updateEntity();
@ -252,32 +261,22 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
}
}
@Override
public boolean canConnectTo(TileEntity tile){
return tile instanceof IEnergyProvider || tile instanceof IEnergyReceiver;
}
public IEnergyProvider getProvider(){
TileEntity tile = boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord);
if(tile != null && tile instanceof IEnergyProvider){
return (IEnergyProvider)tile;
if(this.boundPosition != null && this.boundWorld != null){
TileEntity tile = boundWorld.getTileEntity(boundPosition.posX, boundPosition.posY, boundPosition.posZ);
if(tile instanceof IEnergyProvider) return (IEnergyProvider)tile;
}
return null;
}
public IEnergyReceiver getReceiver(){
TileEntity tile = boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord);
if(tile != null && tile instanceof IEnergyReceiver){
return (IEnergyReceiver)tile;
if(this.boundPosition != null && this.boundWorld != null){
TileEntity tile = boundWorld.getTileEntity(boundPosition.posX, boundPosition.posY, boundPosition.posZ);
if(tile instanceof IEnergyReceiver) return (IEnergyReceiver)tile;
}
return null;
}
@Override
public boolean hasBoundTile(){
return super.hasBoundTile() && (this.boundTile instanceof IEnergyReceiver || this.boundTile instanceof IEnergyProvider);
}
@Override
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
return this.isBoundTileInRage() && this.getReceiver() != null ? this.getReceiver().receiveEnergy(from, maxReceive, simulate) : 0;
@ -323,24 +322,19 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
this.type = BlockPhantomface.FACE;
}
@Override
public boolean canConnectTo(TileEntity tile){
return tile instanceof IInventory;
}
@Override
public boolean hasBoundTile(){
return super.hasBoundTile() && this.boundTile instanceof IInventory;
}
public IInventory getInventory(){
TileEntity tile = boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord);
if(tile != null && tile instanceof IInventory){
return (IInventory)tile;
if(this.boundPosition != null && this.boundWorld != null){
TileEntity tile = boundWorld.getTileEntity(boundPosition.posX, boundPosition.posY, boundPosition.posZ);
if(tile instanceof IInventory) return (IInventory)tile;
}
return null;
}
@Override
public boolean isBoundTileInRage(){
return super.isBoundTileInRage() && this.boundWorld.getTileEntity(boundPosition.posX, boundPosition.posY, boundPosition.posZ) instanceof IInventory;
}
public ISidedInventory getSided(){
return this.getInventory() instanceof ISidedInventory ? (ISidedInventory)this.getInventory() : null;
}

View file

@ -0,0 +1,67 @@
package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.ItemSpecialDrop;
import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops;
import ellpeck.actuallyadditions.network.gui.IButtonReactor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor{
public TileEntityXPSolidifier(){
super(12, "xpSolidifier");
}
public int getFirstSlot(int itemsNeeded){
for(int i = 0; i < this.slots.length; i++){
if(this.slots[i] == null || this.slots[i].stackSize <= this.slots[i].getMaxStackSize()-itemsNeeded){
return i;
}
}
return -1;
}
@Override
public boolean canUpdate(){
return false;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return false;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return true;
}
@Override
public void onButtonPressed(int buttonID, EntityPlayer player){
if(!player.worldObj.isRemote){
if(buttonID == 0 && player.experienceTotal >= ItemSpecialDrop.SOLID_XP_AMOUNT){
int slot = this.getFirstSlot(1);
if(slot >= 0){
if(this.slots[slot] != null){
this.slots[slot].stackSize++;
}
else this.slots[slot] = new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal());
player.addExperience(ItemSpecialDrop.SOLID_XP_AMOUNT);
}
}
else if(buttonID == 1 && player.experienceTotal >= 64*ItemSpecialDrop.SOLID_XP_AMOUNT){
int slot = this.getFirstSlot(64);
if(slot >= 0){
this.slots[slot] = new ItemStack(InitItems.itemSpecialDrop, 64, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal());
player.addExperience(64*ItemSpecialDrop.SOLID_XP_AMOUNT);
}
}
}
}
}

View file

@ -5,7 +5,7 @@ import org.apache.logging.log4j.Logger;
public class ModUtil{
public static final String VERSION = "1.7.10-0.0.5.3";
public static final String VERSION = "1.7.10-0.0.5.4";
public static final String MOD_ID = "ActuallyAdditions";
public static final String NAME = "Actually Additions";

View file

@ -8,6 +8,7 @@ import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -47,7 +48,7 @@ public class WailaDataProvider implements IWailaDataProvider{
}
@Override
public NBTTagCompound getNBTData(TileEntity te, NBTTagCompound tag, World world, int x, int y, int z){
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z){
return tag;
}

View file

@ -61,10 +61,9 @@ tooltip.actuallyadditions.blockPhantomEnergyface.desc.2=Put RF through me!
tile.actuallyadditions.blockPhantomLiquiface.name=Phantom Liquiface
tooltip.actuallyadditions.blockPhantomLiquiface.desc.1=Like a Pipe, only Wireless! Connect me with a Phantom Connector!
tooltip.actuallyadditions.blockPhantomLiquiface.desc.2=Put Fluids through me! Auto-Outputs too!
tooltip.actuallyadditions.blockPhantomLiquiface.desc.3=Important: When having a linked Fluid Container that can input and output
tooltip.actuallyadditions.blockPhantomLiquiface.desc.4=the same Fluid, set possible Pipes to Input/Output Only Mode,
tooltip.actuallyadditions.blockPhantomLiquiface.desc.5=otherwise fluids will flow back and forward indefinitely!
tooltip.actuallyadditions.blockPhantomLiquiface.desc.2=Put Fluids through me! Apply Redstone Power to Auto-Output!
tooltip.actuallyadditions.blockPhantomLiquiface.desc.3=Important: Watch out when setting the Liquiface to Auto-Output! Doing that
tooltip.actuallyadditions.blockPhantomLiquiface.desc.4=could produce Fluids flowing back and forward indefinitely in some cases!
tile.actuallyadditions.blockPhantomPlacer.name=Phantom Placer
tooltip.actuallyadditions.blockPhantomPlacer.desc.1=Places Blocks from a distance! Connect me with a Phantom Connector!
@ -85,13 +84,42 @@ tooltip.actuallyadditions.blockMiscLavaFactoryCase.desc=Helps the Lava Factory C
tile.actuallyadditions.blockFluidPlacer.name=Fluid Placer
tooltip.actuallyadditions.blockFluidPlacer.desc=Places Fluids stored inside it
tooltip.actuallyadditions.paxel.desc=It's an Axe, Shovel, Sword, Hoe and Pickaxe! Combined!
item.actuallyadditions.woodenPaxel.name=Wooden Paxel
item.actuallyadditions.stonePaxel.name=Stone Paxel
item.actuallyadditions.ironPaxel.name=Iron Paxel
item.actuallyadditions.goldPaxel.name=Golden Paxel
item.actuallyadditions.diamondPaxel.name=Diamond Paxel
item.actuallyadditions.emeraldPaxel.name=Emerald Paxel
item.actuallyadditions.obsidianPaxel.name=Obsidian Paxel
tile.actuallyadditions.blockFluidCollector.name=Fluid Collector
tooltip.actuallyadditions.blockFluidCollector.desc=Stores Fluids in front of it inside it
tile.actuallyadditions.blockPhantomBooster.name=Phantom Booster
tooltip.actuallyadditions.blockPhantomBooster.desc.1=When placed above a Phantom Machine, it doubles its Range
tooltip.actuallyadditions.blockPhantomBooster.desc.2=(Max Amount above one Phantom Machine: 3)
item.actuallyadditions.itemPhantomConnector.name=Phantom Connector
tooltip.actuallyadditions.itemPhantomConnector.desc.1=Connects a Phantom Face to any Inventory Block!
tooltip.actuallyadditions.itemPhantomConnector.desc.2=Hold ALT to clear the stored TileEntity
item.actuallyadditions.itemMiscCup.name=Empty Cup
tooltip.actuallyadditions.itemMiscCup.desc=Used to make Coffee in a Coffee Machine!
item.actuallyadditions.itemCoffee.name=Cup with Coffee
tooltip.actuallyadditions.itemCoffee.desc.1=Brewed in a Coffee Machine! See Effects below!
tooltip.actuallyadditions.itemCoffee.desc.2=You can drink me %s times!
item.actuallyadditions.itemCoffeeSeed.name=Coffee Seeds
tooltip.actuallyadditions.itemCoffeeSeed.desc=Grows Coffee on Grass Blocks
tile.actuallyadditions.blockCoffee.name=Coffee Plant
tooltip.actuallyadditions.blockCoffee.desc=Grows Coffee! Noms!
item.actuallyadditions.itemCoffeeBeans.name=Coffee Beans
tooltip.actuallyadditions.itemCoffeeBeans.desc=Used in a Coffee Machine... delicious!
item.actuallyadditions.itemCanolaSeed.name=Canola Seeds
tooltip.actuallyadditions.itemCanolaSeed.desc=Grows on Grass!
item.actuallyadditions.itemMiscCanola.name=Canola
@ -141,14 +169,16 @@ tile.actuallyadditions.blockInputter.add.13.name=Efficient Sucking Dilettant
tile.actuallyadditions.blockInputter.add.14.name=Extreme Sand Digger
tile.actuallyadditions.blockInputter.add.15.name=MISSINGNO
tile.actuallyadditions.blockMiscEnderCasing.name=Ender Casing
tooltip.actuallyadditions.blockMiscEnderCasing.desc=Extremely sturdy casing, used for crafting
tooltip.actuallyadditions.phantom.connected.desc=<Block connected!>
tooltip.actuallyadditions.phantom.stored.desc=<Block stored to this Connector!>
tooltip.actuallyadditions.phantom.noBound.desc=The Connector has no Information stored!
tooltip.actuallyadditions.phantom.notInventory.desc=The stored Block is not the right type of Inventory!
tooltip.actuallyadditions.phantom.unbound.desc=The Connection was cleared!
tooltip.actuallyadditions.phantom.inWorld.desc=In World
tooltip.actuallyadditions.phantom.boundTo.desc=Bound to
tooltip.actuallyadditions.phantom.connectedBlock.desc=Connected to Block at %s, %s, %s
tooltip.actuallyadditions.phantom.connectedNoRange.desc=Connected to Block at %s, %s, %s but it is not in Range!
tooltip.actuallyadditions.phantom.connectedNoRange.desc=Connected to Block at %s, %s, %s but it is not in Range, not loaded or not the right type of Inventory!
tooltip.actuallyadditions.phantom.notConnected.desc=This isn't connected to anything!
tooltip.actuallyadditions.factory.notPart.desc=The Controller isn't part of the right Multi-Block! Look at the Controller's Description!
@ -218,6 +248,13 @@ item.actuallyadditions.itemSpecialHeartPart.name=Part of a Heart
item.actuallyadditions.itemSpecialPearlShard.name=Ender Pearl Shard
item.actuallyadditions.itemSpecialEmeraldShard.name=Emerald Shard
tile.actuallyadditions.blockCoffeeMachine.name=Coffee Machine
tooltip.actuallyadditions.blockCoffeeMachine.desc.1=Makes endless different Coffee Combinations!
tooltip.actuallyadditions.blockCoffeeMachine.desc.2=Just add Coffee Beans and a Cup and the Ingredients:
tooltip.actuallyadditions.blockCoffeeMachine.desc.3=There's a lot of ingredients that add different Effects
tooltip.actuallyadditions.blockCoffeeMachine.desc.4=to the Coffee! Just put them into the slots on the right
tooltip.actuallyadditions.blockCoffeeMachine.desc.5=in the desired Order! It'll be your CUSTOM COFFEE!
item.actuallyadditions.itemDustIron.name=Crushed Iron
item.actuallyadditions.itemDustGold.name=Crushed Gold
item.actuallyadditions.itemDustDiamond.name=Crushed Diamond
@ -284,6 +321,11 @@ tooltip.actuallyadditions.blockHeatCollector.desc.2=Needs a bunch of Lava around
tooltip.actuallyadditions.blockHeatCollector.desc.3=Occasionally steals the Lava. Watch out!
tooltip.actuallyadditions.blockItemRepairer.desc=Repairs Tools and Armor automatically
tile.actuallyadditions.blockFlax.name=Flax Plant
tooltip.actuallyadditions.blockFlax.desc=Gives you String when grown! Yay!
item.actuallyadditions.itemFlaxSeed.name=Flax Seeds
tooltip.actuallyadditions.itemFlaxSeed.desc=Grows Plants that give you String!
tooltip.actuallyadditions.blockBreaker.desc=Breaks Blocks and stores them in its internal Inventory
tooltip.actuallyadditions.blockPlacer.desc=Places Blocks stored in its internal Inventory
tooltip.actuallyadditions.blockDropper.desc=Drops Items automatically (Without spewing them all over the Place!)
@ -304,8 +346,6 @@ tooltip.actuallyadditions.blockCrafter.desc=Automatically crafts Items without n
tooltip.actuallyadditions.itemPotionRing.desc.1=Gives Potion Effect of Level 1
tooltip.actuallyadditions.itemPotionRing.desc.2=Needs to be held in Hand
tooltip.actuallyadditions.itemPotionRing.desc.off.1=Crafting Recipe of this particular Potion Effect is turned OFF by default
tooltip.actuallyadditions.itemPotionRing.desc.off.2=as it is extremely overpowered! Turn it on in the Config File if needed.
tooltip.actuallyadditions.itemMiscCoil.desc=Lower Tier Coil, used for Crafting
tooltip.actuallyadditions.itemMiscCoilAdvanced.desc=Higher Tier Coil, used for Crafting
@ -348,7 +388,8 @@ tooltip.actuallyadditions.itemFoodPumpkinStew.desc=Like Mushroom Stew or Rabbit
tooltip.actuallyadditions.itemFoodCheese.desc=Cheese.
tooltip.actuallyadditions.itemSpecialUnknownSubstance.desc=Dropped by Skeletons. BETA INFO: Useless as of yet.
tooltip.actuallyadditions.itemSpecialSolidifiedExperience.desc=Dropped by everyone. Right-Click to get XP.
tooltip.actuallyadditions.itemSpecialSolidifiedExperience.desc.1=Dropped by everyone. Right-Click to get XP.
tooltip.actuallyadditions.itemSpecialSolidifiedExperience.desc.2=Sneak-Right-Click to consume the whole Stack.
tooltip.actuallyadditions.itemSpecialBloodFragment.desc=Dropped by everyone. BETA INFO: Useless as of yet.
tooltip.actuallyadditions.itemSpecialHeartPart.desc=Dropped by everyone. BETA INFO: Useless as of yet.
tooltip.actuallyadditions.itemSpecialPearlShard.desc=Dropped by Endermen. 3x3 Crafting to an Ender Pearl
@ -378,22 +419,13 @@ info.actuallyadditions.gui.all=All
info.actuallyadditions.gui.slot=Slot
info.actuallyadditions.gui.put=Put
info.actuallyadditions.gui.pull=Pull
info.actuallyadditions.gui.whitelist=Whitelist
info.actuallyadditions.gui.blacklist=Blacklist
info.actuallyadditions.gui.coffee=Coffee
tooltip.actuallyadditions.uses.desc=Uses
tooltip.actuallyadditions.produces.desc=Produces
effect.actuallyadditions.speed.name=Speed
effect.actuallyadditions.haste.name=Haste
effect.actuallyadditions.strength.name=Strength
effect.actuallyadditions.jumpBoost.name=Jump Boost
effect.actuallyadditions.regen.name=Regeneration
effect.actuallyadditions.resistance.name=Resistance
effect.actuallyadditions.fireResistance.name=Fire Resistance
effect.actuallyadditions.waterBreathing.name=Water Breathing
effect.actuallyadditions.invisibility.name=Invisibility
effect.actuallyadditions.nightVision.name=Night Vision
effect.actuallyadditions.saturation.name=Saturation
container.actuallyadditions.inputter.name=ESD
container.actuallyadditions.inputterAdvanced.name=Advanced ESD
container.actuallyadditions.grinder.name=Crusher
@ -417,10 +449,15 @@ container.actuallyadditions.liquiface.name=Liquiface
container.actuallyadditions.energyface.name=Energyface
container.actuallyadditions.fluidPlacer.name=Fluid Placer
container.actuallyadditions.fluidCollector.name=Fluid Collector
container.actuallyadditions.coffeeMachine.name=Coffee Machine
container.actuallyadditions.nei.crushing.name=Crusher
container.actuallyadditions.nei.ballOfHair.name=Ball Of Hair Usage
container.actuallyadditions.nei.compost.name=Compost
container.nei.actuallyadditions.crushing.name=Crusher
container.nei.actuallyadditions.ballOfHair.name=Ball Of Hair Usage
container.nei.actuallyadditions.compost.name=Compost
container.nei.actuallyadditions.coffee.name=Coffee Machine
container.nei.actuallyadditions.coffee.special=Special Feature:
container.nei.actuallyadditions.coffee.extra.milk=+02:30, -1 Level
info.actuallyadditions.update.generic.desc=[{"text":"There is an "},{"text":"Update ","bold":"true"},{"text":"for ","bold":"false"},{"text":"Actually Additions ","color":"dark_green","bold":"true"},{"text":"available!","color":"none","bold":"false"}]
info.actuallyadditions.update.versionComp.desc=[{"text":"You have Version "},{"text":"%s","color":"dark_red","italic":"false"},{"text":", the newest one is ","color":"none","italic":"false"},{"text":"%s","color":"dark_green","underlined":"false"},{"text":"!","color":"none","underlined":"false"}]

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

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