-Ready for Version 0.0.5.3

This commit is contained in:
Ellpeck 2015-05-30 17:47:57 +02:00
parent 9f7031fdfe
commit 505162cfd0
37 changed files with 724 additions and 54 deletions

View file

@ -18,7 +18,7 @@ buildscript {
apply plugin: 'forge'
apply plugin: 'maven'
version = "1.7.10-0.0.5.2"
version = "1.7.10-0.0.5.3"
group = "ellpeck.actuallyadditions"
archivesBaseName = "ActuallyAdditions"

View file

@ -70,10 +70,11 @@
-On Activation, all blocks in the area get a Signal
-Lava Factory
-2x3 Multi Block
-Bowl-Looking Multi Block
-Requires Energy
-Produces Lava from Cobblestone
-Has Upgrade Slots
-Produces Lava
-Has a Controller in the Middle
-Places produced Lava Blocks on top of the Controller
-Thermopile
-Needs a hot and a cold fluid

View file

@ -0,0 +1,135 @@
package ellpeck.actuallyadditions.blocks;
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.TileEntityFluidCollector;
import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
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.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.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
public class BlockFluidCollector extends BlockContainerBase implements INameableItem{
private IIcon frontIcon;
private IIcon topIcon;
private boolean isPlacer;
public BlockFluidCollector(boolean isPlacer){
super(Material.rock);
this.isPlacer = isPlacer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
}
@Override
public String getOredictName(){
return this.getName();
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return this.isPlacer ? new TileEntityFluidCollector.TileEntityFluidPlacer() : new TileEntityFluidCollector();
}
@Override
public IIcon getIcon(int side, int meta){
if(side == 0 || side == 1) return this.topIcon;
if(side == 3) return this.frontIcon;
return this.blockIcon;
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
int meta = world.getBlockMetadata(x, y, z);
if(side != meta && (side == 0 || side == 1)) return this.topIcon;
if(side == meta) return this.frontIcon;
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Front");
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top");
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
if(!world.isRemote){
TileEntityFluidCollector collector = (TileEntityFluidCollector)world.getTileEntity(x, y, z);
if (collector != null) player.openGui(ActuallyAdditions.instance, GuiHandler.FLUID_COLLECTOR_ID, world, x, y, z);
return true;
}
return true;
}
@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 this.isPlacer ? "blockFluidPlacer" : "blockFluidCollector";
}
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, 1, "");
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -51,6 +51,9 @@ public class InitBlocks{
public static Block blockPhantomLiquiface;
public static Block blockPhantomEnergyface;
public static Block blockFluidPlacer;
public static Block blockFluidCollector;
public static void init(){
Util.logInfo("Initializing Blocks...");
@ -151,5 +154,11 @@ public class InitBlocks{
blockDropper = new BlockDropper();
BlockUtil.register(blockDropper, BlockDropper.TheItemBlock.class);
blockFluidPlacer = new BlockFluidCollector(true);
BlockUtil.register(blockFluidPlacer, BlockFluidCollector.TheItemBlock.class);
blockFluidCollector = new BlockFluidCollector(false);
BlockUtil.register(blockFluidCollector, BlockFluidCollector.TheItemBlock.class);
}
}

View file

@ -80,7 +80,14 @@ public enum ConfigCrafting{
COAL_GENERATOR("Coal Generator", ConfigCategories.BLOCKS_CRAFTING),
OIL_GENERATOR("Oil Generator", ConfigCategories.BLOCKS_CRAFTING),
PHANTOMFACE("Phantomface", ConfigCategories.BLOCKS_CRAFTING),
PHANTOM_CONNECTOR("Phantom Connector", ConfigCategories.ITEMS_CRAFTING);
PHANTOM_CONNECTOR("Phantom Connector", ConfigCategories.ITEMS_CRAFTING),
PHANTOM_ENERGYFACE("Phantom Energyface", ConfigCategories.BLOCKS_CRAFTING),
PHANTOM_LIQUIFACE("Phantom Liquiface", ConfigCategories.BLOCKS_CRAFTING),
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);
public final String name;
public final String category;

View file

@ -60,12 +60,52 @@ public class BlockCrafting{
//Phantomface
if(ConfigCrafting.PHANTOMFACE.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockPhantomface),
"ECE", "EBE", "ESE",
" C ", "EBE", " S ",
'E', Items.ender_eye,
'C', Blocks.chest,
'S', TheMiscItems.COIL_ADVANCED.getOredictName(),
'B', TheMiscBlocks.ENDERPEARL_BLOCK.getOredictName()));
//Phantom Placer
if(ConfigCrafting.PHANTOM_PLACER.isEnabled())
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockPhantomPlacer),
((INameableItem)InitBlocks.blockPlacer).getOredictName(),
((INameableItem)InitBlocks.blockPhantomface).getOredictName()));
//Phantom Breaker
if(ConfigCrafting.PHANTOM_BREAKER.isEnabled())
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockPhantomBreaker),
((INameableItem)InitBlocks.blockBreaker).getOredictName(),
((INameableItem)InitBlocks.blockPhantomface).getOredictName()));
//Phantom Energyface
if(ConfigCrafting.PHANTOM_ENERGYFACE.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockPhantomEnergyface),
" R ", "RFR", " R ",
'R', "dustRedstone",
'F', ((INameableItem)InitBlocks.blockPhantomface).getOredictName()));
//Phantom Liquiface
if(ConfigCrafting.PHANTOM_LIQUIFACE.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockPhantomLiquiface),
"RFR",
'R', Items.bucket,
'F', ((INameableItem)InitBlocks.blockPhantomface).getOredictName()));
//Liquid Placer
if(ConfigCrafting.LIQUID_PLACER.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFluidPlacer),
"RFR",
'R', Items.bucket,
'F', ((INameableItem)InitBlocks.blockPlacer).getOredictName()));
//Liquid Breaker
if(ConfigCrafting.LIQUID_BREAKER.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFluidCollector),
"RFR",
'R', Items.bucket,
'F', ((INameableItem)InitBlocks.blockBreaker).getOredictName()));
//Oil Generator
if(ConfigCrafting.OIL_GENERATOR.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockOilGenerator),
@ -233,7 +273,7 @@ public class BlockCrafting{
"CCC", "CRP", "CCC",
'C', "cobblestone",
'R', TheMiscItems.COIL.getOredictName(),
'P', Items.diamond_pickaxe));
'P', Items.iron_pickaxe));
//Dropper
if(ConfigCrafting.DROPPER.isEnabled())

View file

@ -48,6 +48,8 @@ public class CreativeTab extends CreativeTabs{
this.addBlock(InitBlocks.blockBreaker);
this.addBlock(InitBlocks.blockPlacer);
this.addBlock(InitBlocks.blockDropper);
this.addBlock(InitBlocks.blockFluidPlacer);
this.addBlock(InitBlocks.blockFluidCollector);
this.addBlock(InitBlocks.blockMisc);
this.addBlock(InitBlocks.blockFeeder);
@ -94,7 +96,7 @@ public class CreativeTab extends CreativeTabs{
@Override
public Item getTabIconItem(){
return Item.getItemFromBlock(InitBlocks.blockPhantomPlacer);
return Item.getItemFromBlock(InitBlocks.blockPhantomLiquiface);
}
@Override

View file

@ -0,0 +1,88 @@
package ellpeck.actuallyadditions.inventory;
import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityFluidCollector;
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.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidContainerRegistry;
@InventoryContainer
public class ContainerFluidCollector extends Container{
private TileEntityFluidCollector collector;
public ContainerFluidCollector(InventoryPlayer inventory, TileEntityBase tile){
this.collector = (TileEntityFluidCollector)tile;
this.addSlotToContainer(new Slot(collector, 0, 90, 73));
this.addSlotToContainer(new SlotOutput(collector, 1, 90, 42));
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 boolean canInteractWith(EntityPlayer player){
return this.collector.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = 2;
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(this.collector.isPlacer){
if(FluidContainerRegistry.isBucket(currentStack) && !newStack.isItemEqual(FluidContainerRegistry.EMPTY_BUCKET)){
this.mergeItemStack(newStack, 0, 1, false);
}
}
else{
if(newStack.isItemEqual(FluidContainerRegistry.EMPTY_BUCKET)){
this.mergeItemStack(newStack, 0, 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

@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityOilGenerator;
@ -29,7 +30,7 @@ public class ContainerOilGenerator extends Container{
this.generator = (TileEntityOilGenerator)tile;
this.addSlotToContainer(new Slot(this.generator, 0, 98, 74));
this.addSlotToContainer(new Slot(this.generator, 1, 98, 43));
this.addSlotToContainer(new SlotOutput(this.generator, 1, 98, 43));
for (int i = 0; i < 3; i++){
for (int j = 0; j < 9; j++){

View file

@ -0,0 +1,59 @@
package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityFluidCollector;
import ellpeck.actuallyadditions.util.AssetUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiFluidCollector extends GuiContainer{
private TileEntityFluidCollector collector;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFluidCollector");
public GuiFluidCollector(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerFluidCollector(inventory, tile));
this.collector = (TileEntityFluidCollector)tile;
this.xSize = 176;
this.ySize = 93+86;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.collector.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.collector.tank.getFluidAmount() > 0){
int i = this.collector.getTankScaled(83);
drawTexturedModalRect(this.guiLeft+68, this.guiTop+89-i, 176, 0, 16, i);
}
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text2 = this.collector.tank.getFluidAmount()+"/"+this.collector.tank.getCapacity()+" mB "+ (this.collector.tank.getFluidAmount() > 0 ? this.collector.tank.getFluid().getLocalizedName() : "");
if(x >= guiLeft+68 && y >= guiTop+6 && x <= guiLeft+83 && y <= guiTop+88){
this.func_146283_a(Collections.singletonList(text2), x, y);
}
}
}

View file

@ -61,6 +61,9 @@ public class GuiHandler implements IGuiHandler{
case PHANTOM_PLACER_ID:
TileEntityBase tilePlacer = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerPhantomPlacer(entityPlayer.inventory, tilePlacer);
case FLUID_COLLECTOR_ID:
TileEntityBase tileCollector = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerFluidCollector(entityPlayer.inventory, tileCollector);
default:
return null;
}
@ -116,6 +119,9 @@ public class GuiHandler implements IGuiHandler{
case PHANTOM_PLACER_ID:
TileEntityBase tilePlacer = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiPhantomPlacer(entityPlayer.inventory, tilePlacer);
case FLUID_COLLECTOR_ID:
TileEntityBase tileCollector = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiFluidCollector(entityPlayer.inventory, tileCollector);
default:
return null;
}
@ -137,6 +143,7 @@ public class GuiHandler implements IGuiHandler{
public static final int COAL_GENERATOR_ID = 13;
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 void init(){
Util.logInfo("Initializing GuiHandler...");

View file

@ -5,12 +5,12 @@ import net.minecraft.item.EnumRarity;
public enum TheJams implements INameableItem{
CU_BA_RA("CuBaRa", 4, 5F, EnumRarity.rare, "jamCuBaRa", 5, 12, 12595273),
GRA_KI_BA("GraKiBa", 4, 5F, EnumRarity.rare, "jamGraKiBa", 16, 13, 5492820),
PL_AP_LE("PlApLe", 4, 5F, EnumRarity.rare, "jamPlApLe", 15, 3, 13226009),
CH_AP_CI("ChApCi", 4, 5F, EnumRarity.rare, "jamChApCi", 10, 1, 13189222),
HO_ME_KI("HoMeKi", 4, 5F, EnumRarity.rare, "jamHoMeKi", 10, 14, 2031360),
PI_CO("PiCo", 4, 5F, EnumRarity.rare, "jamPiCo", 9, 1, 16056203);
CU_BA_RA("CuBaRa", 4, 2F, EnumRarity.rare, "jamCuBaRa", 5, 12, 12595273),
GRA_KI_BA("GraKiBa", 4, 2F, EnumRarity.rare, "jamGraKiBa", 16, 13, 5492820),
PL_AP_LE("PlApLe", 4, 2F, EnumRarity.rare, "jamPlApLe", 15, 3, 13226009),
CH_AP_CI("ChApCi", 4, 2F, EnumRarity.rare, "jamChApCi", 10, 1, 13189222),
HO_ME_KI("HoMeKi", 4, 2F, EnumRarity.rare, "jamHoMeKi", 10, 14, 2031360),
PI_CO("PiCo", 4, 2F, EnumRarity.rare, "jamPiCo", 9, 1, 16056203);
public final String name;
public final String oredictName;

View file

@ -2,7 +2,9 @@ package ellpeck.actuallyadditions.nei;
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.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.item.ItemStack;
@ -13,6 +15,9 @@ public class NEIActuallyAdditionsConfig implements IConfigureNEI{
public void loadConfig(){
Util.logInfo("Initializing Not Enough Items Plugin...");
API.registerGuiOverlay(GuiCrafter.class, "crafting");
API.registerGuiOverlayHandler(GuiCrafter.class, new DefaultOverlayHandler(), "crafting");
CrusherRecipeHandler crusherRecipeHandler = new CrusherRecipeHandler();
API.registerRecipeHandler(crusherRecipeHandler);
API.registerUsageHandler(crusherRecipeHandler);

View file

@ -0,0 +1,81 @@
package ellpeck.actuallyadditions.network;
import cpw.mods.fml.client.FMLClientHandler;
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 cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityFluidCollector;
import io.netty.buffer.ByteBuf;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
public class PacketFluidCollectorToClient implements IMessage{
private boolean hasFluid;
private int fluidID;
private int fluidAmount;
private int x;
private int y;
private int z;
@SuppressWarnings("unused")
public PacketFluidCollectorToClient(){
}
public PacketFluidCollectorToClient(FluidStack fluid, TileEntity tile){
if(fluid != null){
this.hasFluid = true;
this.fluidID = fluid.getFluidID();
this.fluidAmount = fluid.amount;
}
else this.hasFluid = false;
this.x = tile.xCoord;
this.y = tile.yCoord;
this.z = tile.zCoord;
}
@Override
public void fromBytes(ByteBuf buf){
this.hasFluid = buf.readBoolean();
this.fluidID = buf.readInt();
this.fluidAmount = buf.readInt();
this.x = buf.readInt();
this.y = buf.readInt();
this.z = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf){
buf.writeBoolean(this.hasFluid);
buf.writeInt(this.fluidID);
buf.writeInt(this.fluidAmount);
buf.writeInt(this.x);
buf.writeInt(this.y);
buf.writeInt(this.z);
}
public static class Handler implements IMessageHandler<PacketFluidCollectorToClient, IMessage>{
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(PacketFluidCollectorToClient message, MessageContext ctx){
World world = FMLClientHandler.instance().getClient().theWorld;
TileEntity tile = world.getTileEntity(message.x, message.y, message.z);
if(tile instanceof TileEntityFluidCollector){
TileEntityFluidCollector collector = (TileEntityFluidCollector)tile;
if(message.hasFluid){
collector.tank.setFluid(new FluidStack(FluidRegistry.getFluid(message.fluidID), message.fluidAmount));
}
else collector.tank.setFluid(null);
}
return null;
}
}
}

View file

@ -14,5 +14,6 @@ public class PacketHandler{
theNetwork.registerMessage(PacketTileEntityFeeder.Handler.class, PacketTileEntityFeeder.class, 0, Side.CLIENT);
theNetwork.registerMessage(PacketInputterButton.Handler.class, PacketInputterButton.class, 1, Side.SERVER);
theNetwork.registerMessage(PacketFluidCollectorToClient.Handler.class, PacketFluidCollectorToClient.class, 2, Side.CLIENT);
}
}

View file

@ -36,6 +36,8 @@ public class TileEntityBase extends TileEntity{
GameRegistry.registerTileEntity(TileEntityPhantomface.TileEntityPhantomEnergyface.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomEnergyface");
GameRegistry.registerTileEntity(TileEntityPhantomPlacer.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomPlacer");
GameRegistry.registerTileEntity(TileEntityPhantomPlacer.TileEntityPhantomBreaker.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomBreaker");
GameRegistry.registerTileEntity(TileEntityFluidCollector.class, ModUtil.MOD_ID_LOWER + ":tileEntityFluidCollector");
GameRegistry.registerTileEntity(TileEntityFluidCollector.TileEntityFluidPlacer.class, ModUtil.MOD_ID_LOWER + ":tileEntityFluidPlacer");
}
@Override

View file

@ -70,10 +70,9 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
}
}
else if(this.isPlacer && worldObj.getBlock(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ).isReplaceable(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ)){
ItemStack removeFalse = removeFromInventory(this.slots, false);
if(removeFalse != null && WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, removeFalse)){
removeFromInventory(this.slots, true);
}
int theSlot = testInventory(this.slots);
this.setInventorySlotContents(theSlot, WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, this.slots[theSlot]));
if(this.slots[0] != null && this.slots[0].stackSize <= 0) this.slots[0] = null;
}
}
}
@ -112,18 +111,13 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
return working >= stacks.size();
}
public static ItemStack removeFromInventory(ItemStack[] slots, boolean actuallyDo){
public static int testInventory(ItemStack[] slots){
for(int i = 0; i < slots.length; i++){
if(slots[i] != null){
ItemStack slot = slots[i].copy();
if(actuallyDo){
slots[i].stackSize--;
if(slots[i].stackSize <= 0) slots[i] = slots[i].getItem().getContainerItem(slots[i]);
}
return slot;
return i;
}
}
return null;
return 0;
}
@Override

View file

@ -11,7 +11,10 @@ public class TileEntityDropper extends TileEntityInventoryBase{
private final int timeNeeded = ConfigIntValues.DROPPER_TIME_NEEDED.getValue();
private int currentTime;
@SuppressWarnings("unused")
public TileEntityDropper(int slots, String name){
super(slots, name);
}
public TileEntityDropper(){
super(9, "dropper");
}

View file

@ -0,0 +1,213 @@
package ellpeck.actuallyadditions.tile;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.network.PacketFluidCollectorToClient;
import ellpeck.actuallyadditions.network.PacketHandler;
import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChunkCoordinates;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*;
public class TileEntityFluidCollector extends TileEntityInventoryBase implements IFluidHandler{
public FluidTank tank = new FluidTank(8*FluidContainerRegistry.BUCKET_VOLUME);
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){
if(this.isPlacer){
this.sendPacket();
return this.tank.fill(resource, doFill);
}
return 0;
}
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){
if(!this.isPlacer){
this.sendPacket();
return this.tank.drain(resource.amount, doDrain);
}
return null;
}
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain){
if(!this.isPlacer){
this.sendPacket();
return this.tank.drain(maxDrain, doDrain);
}
return null;
}
@Override
public boolean canFill(ForgeDirection from, Fluid fluid){
return this.isPlacer && from != ForgeDirection.DOWN;
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid){
return !this.isPlacer && from != ForgeDirection.UP;
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from){
return new FluidTankInfo[]{this.tank.getInfo()};
}
public static class TileEntityFluidPlacer extends TileEntityFluidCollector{
public TileEntityFluidPlacer(){
super(2, "fluidPlacer");
this.isPlacer = true;
}
}
public boolean isPlacer;
private final int timeNeeded = ConfigIntValues.BREAKER_TIME_NEEDED.getValue();
private int currentTime;
public TileEntityFluidCollector(int slots, String name){
super(slots, name);
}
public TileEntityFluidCollector(){
super(2, "fluidCollector");
this.isPlacer = false;
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
int amountBefore = this.tank.getFluidAmount();
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){
if(this.currentTime > 0){
this.currentTime--;
if(this.currentTime <= 0){
ForgeDirection sideToManipulate = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
ChunkCoordinates coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, xCoord, yCoord, zCoord);
if(coordsBlock != null){
Block blockToBreak = worldObj.getBlock(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ);
if(!this.isPlacer && blockToBreak != null && worldObj.getBlockMetadata(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ) == 0){
if(blockToBreak instanceof IFluidBlock && ((IFluidBlock)blockToBreak).getFluid() != null){
if(this.tank.fill(new FluidStack(((IFluidBlock)blockToBreak).getFluid(), FluidContainerRegistry.BUCKET_VOLUME), false) >= FluidContainerRegistry.BUCKET_VOLUME){
this.tank.fill(new FluidStack(((IFluidBlock)blockToBreak).getFluid(), FluidContainerRegistry.BUCKET_VOLUME), true);
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord);
}
}
else if(blockToBreak == Blocks.lava || blockToBreak == Blocks.flowing_lava){
if(this.tank.fill(new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME), false) >= FluidContainerRegistry.BUCKET_VOLUME){
this.tank.fill(new FluidStack(FluidRegistry.LAVA, FluidContainerRegistry.BUCKET_VOLUME), true);
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord);
}
}
else if(blockToBreak == Blocks.water || blockToBreak == Blocks.flowing_water){
if(this.tank.fill(new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME), false) >= FluidContainerRegistry.BUCKET_VOLUME){
this.tank.fill(new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME), true);
WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord);
}
}
}
else if(this.isPlacer && worldObj.getBlock(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ).isReplaceable(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ)){
if(this.tank.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME){
if(this.tank.getFluid().getFluid().getBlock() != null){
Block block = worldObj.getBlock(xCoord+sideToManipulate.offsetX, yCoord+sideToManipulate.offsetY, zCoord+sideToManipulate.offsetZ);
if(!(block instanceof IFluidBlock) && block != Blocks.lava && block != Blocks.water && block != Blocks.flowing_lava && block != Blocks.flowing_water){
WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, new ItemStack(this.tank.getFluid().getFluid().getBlock()));
this.tank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
}
}
}
}
}
}
}
else this.currentTime = this.timeNeeded;
}
if(!this.isPlacer){
if(this.slots[0] != null && this.slots[0].getItem() == Items.bucket && this.slots[1] == null){
if(this.tank.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME){
this.slots[1] = FluidContainerRegistry.fillFluidContainer(this.tank.getFluid(), this.slots[0].copy());
this.slots[0].stackSize--;
if(this.slots[0].stackSize == 0) this.slots[0] = null;
this.tank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
}
}
}
else{
if(this.slots[0] != null && FluidContainerRegistry.isBucket(this.slots[0]) && !this.slots[0].isItemEqual(FluidContainerRegistry.EMPTY_BUCKET) && (this.slots[1] == null || this.slots[1].stackSize < this.slots[1].getMaxStackSize())){
if(FluidContainerRegistry.BUCKET_VOLUME <= this.tank.getCapacity()-this.tank.getFluidAmount()){
if(this.slots[1] == null) this.slots[1] = new ItemStack(Items.bucket);
else this.slots[1].stackSize++;
this.tank.fill(FluidContainerRegistry.getFluidForFilledItem(this.slots[0]), true);
this.slots[0] = null;
}
}
}
if(this.tank.getFluidAmount() > 0 && !this.isPlacer){
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, this.tank);
}
if(amountBefore != this.tank.getFluidAmount()){
this.sendPacket();
}
}
}
public void sendPacket(){
PacketHandler.theNetwork.sendToAllAround(new PacketFluidCollectorToClient(this.tank.getFluid(), this), new NetworkRegistry.TargetPoint(this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 120));
}
@SideOnly(Side.CLIENT)
public int getTankScaled(int i){
return this.tank.getFluidAmount() * i / this.tank.getCapacity();
}
@Override
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
compound.setInteger("CurrentTime", this.currentTime);
this.tank.writeToNBT(compound);
}
@Override
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
this.currentTime = compound.getInteger("CurrentTime");
this.tank.readFromNBT(compound);
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
if(i == 0){
if(this.isPlacer) return FluidContainerRegistry.isFilledContainer(stack);
else return stack.isItemEqual(FluidContainerRegistry.EMPTY_BUCKET);
}
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 slot == 1;
}
}

View file

@ -73,10 +73,9 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
}
else{
if(boundWorld.getBlock(boundPosition.posX, boundPosition.posY, boundPosition.posZ).isReplaceable(boundWorld, boundPosition.posX, boundPosition.posY, boundPosition.posZ)){
ItemStack removeFalse = TileEntityBreaker.removeFromInventory(this.slots, false);
if(removeFalse != null && WorldUtil.placeBlockAtSide(ForgeDirection.UNKNOWN, boundWorld, boundPosition.posX, boundPosition.posY, boundPosition.posZ, removeFalse)){
TileEntityBreaker.removeFromInventory(this.slots, true);
}
int theSlot = TileEntityBreaker.testInventory(this.slots);
this.setInventorySlotContents(theSlot, WorldUtil.placeBlockAtSide(ForgeDirection.UNKNOWN, boundWorld, boundPosition.posX, boundPosition.posY, boundPosition.posZ, this.slots[theSlot]));
if(this.slots[0] != null && this.slots[0].stackSize <= 0) this.slots[0] = null;
}
}
}
@ -140,7 +139,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
return !this.isBreaker;
}
@Override
@ -150,6 +149,6 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return false;
return this.isBreaker;
}
}

View file

@ -149,12 +149,14 @@ public class TileEntityPhantomface extends TileEntityInventoryBase{
if(tile != null && tile instanceof IFluidHandler){
for(FluidTankInfo myInfo : this.getTankInfo(side)){
for(FluidTankInfo hisInfo : ((IFluidHandler)tile).getTankInfo(side.getOpposite())){
if(myInfo != null && hisInfo != null && myInfo.fluid != null){
if(myInfo != null && hisInfo != null && myInfo.fluid != null && myInfo.fluid.getFluid() != null){
if(((IFluidHandler)tile).canFill(side.getOpposite(), myInfo.fluid.getFluid()) && this.canDrain(side, myInfo.fluid.getFluid())){
FluidStack receive = this.drain(side, Math.min(hisInfo.capacity-(hisInfo.fluid == null ? 0 : hisInfo.fluid.amount), myInfo.fluid.amount), false);
int actualReceive = ((IFluidHandler)tile).fill(side.getOpposite(), receive, true);
this.drain(side, new FluidStack(receive.getFluid(), actualReceive), true);
worldObj.markBlockForUpdate(xCoord+side.offsetX, yCoord+side.offsetY, zCoord+side.offsetZ);
if(receive != null){
int actualReceive = ((IFluidHandler)tile).fill(side.getOpposite(), receive, true);
this.drain(side, new FluidStack(receive.getFluid(), actualReceive), true);
worldObj.markBlockForUpdate(xCoord+side.offsetX, yCoord+side.offsetY, zCoord+side.offsetZ);
}
}
}
}

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.2";
public static final String VERSION = "1.7.10-0.0.5.3";
public static final String MOD_ID = "ActuallyAdditions";
public static final String NAME = "Actually Additions";

View file

@ -2,7 +2,9 @@ package ellpeck.actuallyadditions.util;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
@ -10,10 +12,8 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.*;
import org.apache.logging.log4j.Level;
public class WorldUtil{
@ -55,26 +55,40 @@ public class WorldUtil{
}
}
public static boolean placeBlockAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){
if(world instanceof WorldServer){
public static ItemStack placeBlockAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){
if(world instanceof WorldServer && stack != null && stack.getItem() != null){
//Fluids
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(stack);
if(fluid != null && fluid.getFluid().getBlock() != null && fluid.getFluid().getBlock().canPlaceBlockAt(world, x+side.offsetX, y+side.offsetY, z+side.offsetZ)){
return world.setBlock(x+side.offsetX, y+side.offsetY, z+side.offsetZ, fluid.getFluid().getBlock());
Block block = world.getBlock(x+side.offsetX, y+side.offsetY, z+side.offsetZ);
if(!(block instanceof IFluidBlock) && block != Blocks.lava && block != Blocks.water && block != Blocks.flowing_lava && block != Blocks.flowing_water){
if(world.setBlock(x+side.offsetX, y+side.offsetY, z+side.offsetZ, fluid.getFluid().getBlock())){
return stack.getItem().getContainerItem(stack);
}
}
}
//Plants
if(stack.getItem() instanceof IPlantable){
if(((IPlantable)stack.getItem()).getPlant(world, x, y, z).canPlaceBlockAt(world, x+side.offsetX, y+side.offsetY, z+side.offsetZ)){
return world.setBlock(x+side.offsetX, y+side.offsetY, z+side.offsetZ, ((IPlantable)stack.getItem()).getPlant(world, x, y, z));
if(world.setBlock(x+side.offsetX, y+side.offsetY, z+side.offsetZ, ((IPlantable)stack.getItem()).getPlant(world, x, y, z))){
stack.stackSize--;
return stack;
}
}
}
//Blocks
return stack.tryPlaceItemIntoWorld(FakePlayerUtil.newFakePlayer(world), world,x, y, z, side == ForgeDirection.UNKNOWN ? 0 : side.ordinal(), 0, 0, 0);
try{
//Blocks
stack.tryPlaceItemIntoWorld(FakePlayerUtil.newFakePlayer(world), world, x, y, z, side == ForgeDirection.UNKNOWN ? 0 : side.ordinal(), 0, 0, 0);
return stack;
}
catch(Exception e){
ModUtil.AA_LOGGER.log(Level.ERROR, "Something that places Blocks at "+x+", "+y+", "+z+" in World "+world.provider.dimensionId+" threw an Exception! Don't let that happen again!");
}
}
return false;
return stack;
}
public static boolean dropItemAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){

View file

@ -74,6 +74,12 @@ tile.actuallyadditions.blockPhantomBreaker.name=Phantom Breaker
tooltip.actuallyadditions.blockPhantomBreaker.desc.1=Breaks Blocks from a distance! Connect me with a Phantom Connector!
tooltip.actuallyadditions.blockPhantomBreaker.desc.2=Sneak-Right-Click with an empty hand to see its Connections!
tile.actuallyadditions.blockFluidPlacer.name=Fluid Placer
tooltip.actuallyadditions.blockFluidPlacer.desc=Places Fluids stored inside it
tile.actuallyadditions.blockFluidCollector.name=Fluid Collector
tooltip.actuallyadditions.blockFluidCollector.desc=Stores Fluids in front of it inside it
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
@ -396,7 +402,8 @@ container.actuallyadditions.phantomBreaker.name=Phantom Breaker
container.actuallyadditions.phantomface.name=Phantomface
container.actuallyadditions.liquiface.name=Liquiface
container.actuallyadditions.energyface.name=Energyface
container.actuallyadditions.fluidPlacer.name=Fluid Placer
container.actuallyadditions.fluidCollector.name=Fluid Collector
container.actuallyadditions.nei.crushing.name=Crusher
container.actuallyadditions.nei.ballOfHair.name=Ball Of Hair Usage

Binary file not shown.

After

Width:  |  Height:  |  Size: 767 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1,015 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -3,7 +3,7 @@
"modid": "ActuallyAdditions",
"name": "Actually Additions",
"description": "Actually Additions is a Mod that offers a bunch of things from Machines for Automation and tons of food to advanced Hopper Mechanisms and Effect Rings!",
"version": "0.0.5.2",
"version": "0.0.5.3",
"mcversion": "1.7.10",
"url": "https://github.com/Ellpeck/ActuallyAdditions",
"updateUrl": "",

View file

@ -1 +1 @@
An Update Checker! ...wait, you're not gonna read this anyways.
Fluid Breakers & Placers and Phantom Energyface, Liquiface, Breaker & Placer

View file

@ -1 +1 @@
1.7.10-0.0.5.2
1.7.10-0.0.5.3