marvin's marvelous mechanical mixer

This commit is contained in:
Bob 2023-01-04 18:36:17 +01:00
parent 15677ccd6e
commit 45c01c0213
43 changed files with 2458 additions and 61 deletions

View File

@ -1,8 +1,19 @@
# Hbm-s-Nuclear-Tech-GIT
# HBM's Nuclear Tech Mod for Minecraft 1.7.10
https://minecraft.curseforge.com/projects/hbms-nuclear-tech-mod?gameCategorySlug=mc-mods&projectID=235439
[NTM on Modrinth](https://modrinth.com/mod/ntm)
For a 1.12 fork, check this link: https://github.com/Drillgon200/Hbm-s-Nuclear-Tech-GIT/releases
[NTM on CurseForge](https://minecraft.curseforge.com/projects/hbms-nuclear-tech-mod?gameCategorySlug=mc-mods&projectID=235439)
**This is for 1.7.10!** For 1.12, check out these projects:
* NTM Reloaded: https://github.com/TheOriginalGolem/Hbm-s-Nuclear-Tech-GIT/releases
* NTM Alcater Edition: https://github.com/Alcatergit/Hbm-s-Nuclear-Tech-GIT/releases
For 1.18, try Martin's remake: https://github.com/MartinTheDragon/Nuclear-Tech-Mod-Remake/releases
## Downloading pre-compiled versions from GitHub
Simply navigate to "Releases" on the right side of the page, download links for the compiled JAR as well as the corresponding source code are under the "Assets" category below the changelog. Make sure to review all changelogs when updating!
## Building from source
@ -81,4 +92,4 @@ If you want to make some changes to the mod, follow this guide:
10. Code!
# License
This software is licensed under the GNU Public License version 3. In short: This software is free, you may run the software freely, create modified versions, distribute this software and distribute modified versions, as long as the modified software too has a free software license. You win this round, Stallman. The full license can be found in the `LICENSE` file.
This software is licensed under the GNU Lesser General Public License version 3. In short: This software is free, you may run the software freely, create modified versions, distribute this software and distribute modified versions, as long as the modified software too has a free software license (with an exception for linking to this software, as stated by the "Lesser" part of the LGPL, where this may not be required). You win this round, Stallman. The full license can be found in the `LICENSE` and `LICENSE.LESSER` files.

View File

@ -244,6 +244,7 @@ public class ModBlocks {
public static Block block_red_phosphorus;
public static Block block_fallout;
public static Block block_foam;
public static Block block_coke;
public static Block block_graphite;
public static Block block_graphite_drilled;
public static Block block_graphite_fuel;
@ -1028,6 +1029,7 @@ public class ModBlocks {
public static Block machine_chemplant;
public static final int guiID_machine_chemplant = 49;
public static Block machine_chemfac;
public static Block machine_mixer;
public static Block machine_fluidtank;
public static Block machine_bat9000;
@ -1516,6 +1518,7 @@ public class ModBlocks {
block_red_phosphorus = new BlockHazardFalling().makeBeaconable().setStepSound(Block.soundTypeSand).setBlockName("block_red_phosphorus").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_red_phosphorus");
block_fallout = new BlockHazardFalling().setStepSound(Block.soundTypeGravel).setBlockName("block_fallout").setCreativeTab(MainRegistry.blockTab).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":ash");
block_foam = new BlockGeneric(Material.craftedSnow).setBlockName("block_foam").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeSnow).setHardness(0.5F).setResistance(0.0F).setBlockTextureName(RefStrings.MODID + ":foam");
block_coke = new BlockCoke().setBlockName("block_coke").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F);
block_graphite = new BlockGraphite(Material.iron, 30, 5).setBlockName("block_graphite").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeMetal).setHardness(5.0F).setResistance(10.0F);
block_graphite_drilled = new BlockGraphiteDrilled().setBlockName("block_graphite_drilled");
block_graphite_fuel = new BlockGraphiteFuel().setBlockName("block_graphite_fuel");
@ -2231,6 +2234,7 @@ public class ModBlocks {
machine_assemfac = new MachineAssemfac(Material.iron).setBlockName("machine_assemfac").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_chemplant = new MachineChemplant(Material.iron).setBlockName("machine_chemplant").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_chemplant");
machine_chemfac = new MachineChemfac(Material.iron).setBlockName("machine_chemfac").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_mixer = new MachineMixer(Material.iron).setBlockName("machine_mixer").setHardness(5.0F).setResistance(30.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_fluidtank = new MachineFluidTank(Material.iron).setBlockName("machine_fluidtank").setHardness(5.0F).setResistance(20.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_fluidtank");
machine_bat9000 = new MachineBigAssTank9000(Material.iron).setBlockName("machine_bat9000").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_orbus = new MachineOrbus(Material.iron).setBlockName("machine_orbus").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
@ -2603,6 +2607,7 @@ public class ModBlocks {
GameRegistry.registerBlock(block_fallout, block_fallout.getUnlocalizedName());
GameRegistry.registerBlock(block_foam, block_foam.getUnlocalizedName());
GameRegistry.registerBlock(block_graphite, block_graphite.getUnlocalizedName());
register(block_coke);
GameRegistry.registerBlock(block_graphite_drilled, block_graphite_drilled.getUnlocalizedName());
GameRegistry.registerBlock(block_graphite_fuel, block_graphite_fuel.getUnlocalizedName());
GameRegistry.registerBlock(block_graphite_rod, block_graphite_rod.getUnlocalizedName());
@ -3227,6 +3232,7 @@ public class ModBlocks {
GameRegistry.registerBlock(machine_assemfac, machine_assemfac.getUnlocalizedName());
GameRegistry.registerBlock(machine_chemplant, machine_chemplant.getUnlocalizedName());
GameRegistry.registerBlock(machine_chemfac, machine_chemfac.getUnlocalizedName());
register(machine_mixer);
register(machine_fluidtank);
register(machine_bat9000);
register(machine_orbus);

View File

@ -118,10 +118,10 @@ public class BlockVolcano extends BlockContainer implements ITooltipProvider, IB
if(this.shouldGrow()) {
worldObj.setBlock(xCoord, yCoord + 1, zCoord, this.getBlockType(), this.getBlockMetadata(), 3);
worldObj.setBlock(xCoord, yCoord + 1, zCoord, ModBlocks.volcanic_lava_block);
worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.volcanic_lava_block);
return;
} else if(this.isExtinguishing()) {
worldObj.setBlock(xCoord, yCoord + 1, zCoord, ModBlocks.volcanic_lava_block);
worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.volcanic_lava_block);
return;
}
}

View File

@ -0,0 +1,25 @@
package com.hbm.blocks.generic;
import com.hbm.blocks.BlockEnumMulti;
import com.hbm.items.ItemEnums;
import net.minecraft.block.material.Material;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockCoke extends BlockEnumMulti {
public BlockCoke() {
super(Material.iron, ItemEnums.EnumCokeType.class, true, true);
}
@Override
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
return 5;
}
@Override
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
return 10;
}
}

View File

@ -2,7 +2,6 @@ package com.hbm.blocks.generic;
import com.hbm.blocks.BlockBase;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;

View File

@ -0,0 +1,40 @@
package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.tileentity.machine.TileEntityMachineMixer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class MachineMixer extends BlockDummyable {
public MachineMixer(Material mat) {
super(mat);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12)
return new TileEntityMachineMixer();
return null;
}
@Override
public int[] getDimensions() {
return new int[] {2, 0, 0, 0, 0, 0};
}
@Override
public int getOffset() {
return 0;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
return this.standardOpenBehavior(world, x, y, z, player, 0);
}
}

View File

@ -10,9 +10,7 @@ import api.hbm.block.IToolable;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;

View File

@ -1,6 +1,7 @@
package com.hbm.crafting;
import com.hbm.blocks.ModBlocks;
import com.hbm.items.ItemEnums.EnumCokeType;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemRTGPelletDepleted.DepletedRTGMaterial;
import com.hbm.items.special.ItemWasteLong;
@ -49,6 +50,10 @@ public class MineralRecipes {
add1To9Pair(ModBlocks.block_polymer, ModItems.ingot_polymer);
add1To9Pair(ModBlocks.block_bakelite, ModItems.ingot_bakelite);
add1To9Pair(ModBlocks.block_rubber, ModItems.ingot_rubber);
for(int i = 0; i < EnumCokeType.values().length; i++) {
add1To9PairSameMeta(Item.getItemFromBlock(ModBlocks.block_coke), ModItems.coke, i);
}
addMineralSet(ModItems.nugget_bismuth, ModItems.ingot_bismuth, ModBlocks.block_bismuth);
addMineralSet(ModItems.nugget_tantalium, ModItems.ingot_tantalium, ModBlocks.block_tantalium);

View File

@ -35,7 +35,8 @@ public class FuelHandler implements IFuelHandler {
if(fuel.getItem() == ModItems.powder_fire) return 6400;
if(fuel.getItem() == ModItems.lignite) return 1200;
if(fuel.getItem() == ModItems.powder_lignite) return 1200;
if(fuel.getItem() == ModItems.coke) return 3200;
if(fuel.getItem() == ModItems.coke) return single * 16;
if(fuel.getItem() == Item.getItemFromBlock(ModBlocks.block_coke)) return single * 160;
if(fuel.getItem() == ModItems.book_guide) return single;
if(fuel.getItem() == ModItems.coal_infernal) return 4800;
if(fuel.getItem() == ModItems.crystal_coal) return 6400;

View File

@ -0,0 +1,16 @@
package com.hbm.handler.nei;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.recipes.MixerRecipes;
public class MixerHandler extends NEIUniversalHandler {
public MixerHandler() {
super("Mixer", ModBlocks.machine_mixer, MixerRecipes.getRecipes());
}
@Override
public String getKey() {
return "ntmMixer";
}
}

View File

@ -359,9 +359,9 @@ public class OreDictManager {
KNO .dust(niter) .block(block_niter) .ore(ore_niter);
F .dust(fluorite) .block(block_fluorite) .ore(ore_fluorite, basalt_fluorite);
LIGNITE .gem(lignite) .dust(powder_lignite) .ore(ore_lignite);
COALCOKE .gem(fromOne(coke, EnumCokeType.COAL));
PETCOKE .gem(fromOne(coke, EnumCokeType.PETROLEUM));
LIGCOKE .gem(fromOne(coke, EnumCokeType.LIGNITE));
COALCOKE .gem(fromOne(coke, EnumCokeType.COAL)) .block(fromOne(block_coke, EnumCokeType.COAL));
PETCOKE .gem(fromOne(coke, EnumCokeType.PETROLEUM)) .block(fromOne(block_coke, EnumCokeType.PETROLEUM));
LIGCOKE .gem(fromOne(coke, EnumCokeType.LIGNITE)) .block(fromOne(block_coke, EnumCokeType.LIGNITE));
CINNABAR .crystal(cinnebar) .gem(cinnebar) .ore(ore_cinnebar, ore_depth_cinnebar);
BORAX .dust(powder_borax) .ore(ore_depth_borax);
VOLCANIC .gem(gem_volcanic) .ore(basalt_gem);
@ -426,7 +426,7 @@ public class OreDictManager {
ANY_HIGHEXPLOSIVE .ingot(ball_tnt);
ANY_CONCRETE .any(concrete, concrete_smooth, concrete_asbestos, ducrete, ducrete_smooth);
for(int i = 0; i < 16; i++) { ANY_CONCRETE.any(new ItemStack(ModBlocks.concrete_colored, 1, i)); }
ANY_COKE .gem(fromAll(coke, EnumCokeType.class));
ANY_COKE .gem(fromAll(coke, EnumCokeType.class)).block(fromAll(block_coke, EnumCokeType.class));
ANY_BISMOID .ingot(ingot_bismuth, ingot_arsenic).nugget(nugget_bismuth, nugget_arsenic).block(block_bismuth);
OreDictionary.registerOre(KEY_OIL_TAR, fromOne(oil_tar, EnumTarType.CRUDE));
@ -624,6 +624,15 @@ public class OreDictManager {
}
return stacks;
}
public static Object[] fromAll(Block block, Class<? extends Enum> en) {
Enum[] vals = en.getEnumConstants();
Object[] stacks = new Object[vals.length];
for(int i = 0; i < vals.length; i++) {
stacks[i] = new ItemStack(block, 1, vals[i].ordinal());
}
return stacks;
}
public DictFrame any(Object... thing) {
return makeObject(ANY, thing);

View File

@ -18,15 +18,16 @@ public class ContainerMachineExcavator extends Container {
public ContainerMachineExcavator(InventoryPlayer invPlayer, TileEntityMachineExcavator tile) {
this.excavator = tile;
//Battery
//Battery: 0
this.addSlotToContainer(new Slot(tile, 0, 220, 72));
//Fluid ID
//Fluid ID: 1
this.addSlotToContainer(new Slot(tile, 1, 202, 72));
//Upgrades
//Upgrades: 2-4
for(int i = 0; i < 3; i++) {
this.addSlotToContainer(new Slot(tile, 2 + i, 136 + i * 18, 75));
}
//Buffer: 5-13
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
this.addSlotToContainer(new SlotMachineOutput(tile, 5 + j + i * 3, 136 + j * 18, 5 + i * 18));

View File

@ -0,0 +1,80 @@
package com.hbm.inventory.container;
import com.hbm.items.machine.IItemFluidIdentifier;
import com.hbm.items.machine.ItemMachineUpgrade;
import com.hbm.tileentity.machine.TileEntityMachineMixer;
import api.hbm.energy.IBatteryItem;
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;
public class ContainerMixer extends Container {
private TileEntityMachineMixer mixer;
public ContainerMixer(InventoryPlayer player, TileEntityMachineMixer mixer) {
this.mixer = mixer;
//Battery
this.addSlotToContainer(new Slot(mixer, 0, 23, 77));
//Item Input
this.addSlotToContainer(new Slot(mixer, 1, 43, 77));
//Fluid ID
this.addSlotToContainer(new Slot(mixer, 2, 117, 77));
//Upgrades
this.addSlotToContainer(new Slot(mixer, 3, 137, 24));
this.addSlotToContainer(new Slot(mixer, 4, 137, 42));
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) {
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
if(var4 != null && var4.getHasStack()) {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if(par2 <= 4) {
if(!this.mergeItemStack(var5, 5, this.inventorySlots.size(), true)) {
return null;
}
} else {
if(var3.getItem() instanceof IBatteryItem) {
if(!this.mergeItemStack(var5, 0, 1, false)) {
return null;
}
} else if(var3.getItem() instanceof IItemFluidIdentifier) {
if(!this.mergeItemStack(var5, 2, 3, false)) {
return null;
}
} else if(var3.getItem() instanceof ItemMachineUpgrade) {
if(!this.mergeItemStack(var5, 3, 4, false)) {
return null;
}
} else {
if(!this.mergeItemStack(var5, 1, 2, false)) {
return null;
}
}
}
if(var5.stackSize == 0) {
var4.putStack((ItemStack) null);
} else {
var4.onSlotChanged();
}
}
return var3;
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return mixer.isUseableByPlayer(player);
}
}

View File

@ -69,9 +69,20 @@ public class GUIMachineExcavator extends GuiInfoContainer {
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 242, 96);
drawTexturedModalRect(guiLeft + 33, guiTop + 104, 33, 104, 176, 100);
int i = (int) (drill.getPower() * 52 / drill.getMaxPower());
drawTexturedModalRect(guiLeft + 220, guiTop + 70 - i, 229, 156 - i, 16, i);
if(drill.getPower() > drill.getPowerConsumption()) {
drawTexturedModalRect(guiLeft + 224, guiTop + 4, 239, 156, 9, 12);
}
if(drill.getInstalledDrill() == null && System.currentTimeMillis() % 1000 < 500) {
drawTexturedModalRect(guiLeft + 171, guiTop + 74, 209, 154, 18, 18);
}
if(drill.enableDrill) {
drawTexturedModalRect(guiLeft + 6, guiTop + 42, 209, 114, 20, 40);
if(drill.getInstalledDrill() != null) drawTexturedModalRect(guiLeft + 11, guiTop + 5, 209, 104, 10, 10);
if(drill.getInstalledDrill() != null && drill.getPower() >= drill.getPowerConsumption()) drawTexturedModalRect(guiLeft + 11, guiTop + 5, 209, 104, 10, 10);
else if(System.currentTimeMillis() % 1000 < 500) drawTexturedModalRect(guiLeft + 11, guiTop + 5, 219, 104, 10, 10);
}

View File

@ -0,0 +1,59 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerMixer;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineMixer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIMixer extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_mixer.png");
private TileEntityMachineMixer mixer;
public GUIMixer(InventoryPlayer player, TileEntityMachineMixer mixer) {
super(new ContainerMixer(player, mixer));
this.mixer = mixer;
this.xSize = 176;
this.ySize = 204;
}
@Override
public void drawScreen(int x, int y, float interp) {
super.drawScreen(x, y, interp);
this.drawElectricityInfo(this, x, y, guiLeft + 23, guiTop + 23, 16, 52, mixer.getPower(), mixer.getMaxPower());
mixer.tanks[0].renderTankInfo(this, x, y, guiLeft + 43, guiTop + 23, 7, 52);
mixer.tanks[1].renderTankInfo(this, x, y, guiLeft + 52, guiTop + 23, 7, 52);
mixer.tanks[2].renderTankInfo(this, x, y, guiLeft + 117, guiTop + 23, 16, 52);
}
@Override
protected void drawGuiContainerForegroundLayer( int i, int j) {
String name = this.mixer.hasCustomInventoryName() ? this.mixer.getInventoryName() : I18n.format(this.mixer.getInventoryName());
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float interp, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
int i = (int) (mixer.getPower() * 53 / mixer.getMaxPower());
drawTexturedModalRect(guiLeft + 23, guiTop + 75 - i, 176, 52 - i, 16, i);
mixer.tanks[0].renderTank(guiLeft + 43, guiTop + 75, this.zLevel, 7, 52);
mixer.tanks[1].renderTank(guiLeft + 52, guiTop + 75, this.zLevel, 7, 52);
mixer.tanks[2].renderTank(guiLeft + 117, guiTop + 75, this.zLevel, 16, 52);
}
}

View File

@ -0,0 +1,80 @@
package com.hbm.inventory.recipes;
import static com.hbm.inventory.OreDictManager.KNO;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.OreDictManager;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemFluidIcon;
public class MixerRecipes {
public static HashMap<FluidType, MixerRecipe> recipes = new HashMap();
public static void register() {
recipes.put(Fluids.COOLANT, new MixerRecipe(2_000, 50).setStack1(new FluidStack(Fluids.WATER, 1_800)).setSolid(new OreDictStack(KNO.dust())));
recipes.put(Fluids.CRYOGEL, new MixerRecipe(2_000, 50).setStack1(new FluidStack(Fluids.COOLANT, 1_800)).setSolid(new ComparableStack(ModItems.powder_ice)));
recipes.put(Fluids.NITAN, new MixerRecipe(1_000, 50).setStack1(new FluidStack(Fluids.KEROSENE, 600)).setStack2(new FluidStack(Fluids.MERCURY, 200)).setSolid(new ComparableStack(ModItems.powder_nitan_mix)));
recipes.put(Fluids.FRACKSOL, new MixerRecipe(1_000, 20).setStack1(new FluidStack(Fluids.WATER, 1_000)).setStack2(new FluidStack(Fluids.PETROLEUM, 100)).setSolid(new OreDictStack(OreDictManager.S.dust())));
recipes.put(Fluids.ENDERJUICE, new MixerRecipe(100, 100).setStack1(new FluidStack(Fluids.XPJUICE, 500)).setSolid(new OreDictStack(OreDictManager.DIAMOND.dust())));
recipes.put(Fluids.LUBRICANT, new MixerRecipe(1_000, 20).setStack1(new FluidStack(Fluids.HEATINGOIL, 500)).setStack2(new FluidStack(Fluids.UNSATURATEDS, 500)));
recipes.put(Fluids.PETROIL, new MixerRecipe(1_000, 30).setStack1(new FluidStack(Fluids.RECLAIMED, 800)).setStack2(new FluidStack(Fluids.LUBRICANT, 200)));
recipes.put(Fluids.PETROIL_LEADED, new MixerRecipe(1_000, 40).setStack1(new FluidStack(Fluids.PETROIL, 800)).setSolid(new ComparableStack(ModItems.antiknock)));
recipes.put(Fluids.GASOLINE_LEADED, new MixerRecipe(1_000, 40).setStack1(new FluidStack(Fluids.GASOLINE, 800)).setSolid(new ComparableStack(ModItems.antiknock)));
recipes.put(Fluids.COALGAS_LEADED, new MixerRecipe(1_000, 40).setStack1(new FluidStack(Fluids.COALGAS, 800)).setSolid(new ComparableStack(ModItems.antiknock)));
}
public static MixerRecipe getOutput(FluidType type) {
return recipes.get(type);
}
public static HashMap getRecipes() {
HashMap<Object[], Object> recipes = new HashMap<Object[], Object>();
for(Entry<FluidType, MixerRecipe> entry : MixerRecipes.recipes.entrySet()) {
FluidType type = entry.getKey();
MixerRecipe recipe = entry.getValue();
FluidStack output = new FluidStack(type, recipe.output);
List<Object> objects = new ArrayList();
if(recipe.input1 != null) objects.add(ItemFluidIcon.make(recipe.input1));
if(recipe.input2 != null) objects.add(ItemFluidIcon.make(recipe.input2));
if(recipe.solidInput != null) objects.add(recipe.solidInput);
recipes.put(objects.toArray(), ItemFluidIcon.make(output));
}
return recipes;
}
public static class MixerRecipe {
public FluidStack input1;
public FluidStack input2;
public AStack solidInput;
public int processTime;
public int output;
protected MixerRecipe(int output, int processTime) {
this.output = output;
this.processTime = processTime;
}
protected MixerRecipe setStack1(FluidStack stack) { input1 = stack; return this; }
protected MixerRecipe setStack2(FluidStack stack) { input2 = stack; return this; }
protected MixerRecipe setSolid(AStack stack) { solidInput = stack; return this; }
}
}

View File

@ -43,26 +43,29 @@ public class ItemDrillbit extends ItemEnumMulti {
list.add(EnumChatFormatting.YELLOW + "Speed: " + ((int) (type.speed * 100)) + "%");
list.add(EnumChatFormatting.YELLOW + "Tier: " + type.tier);
if(type.fortune > 0) list.add(EnumChatFormatting.LIGHT_PURPLE + "Fortune " + type.fortune);
if(type.vein) list.add(EnumChatFormatting.GREEN + "Vein miner");
if(type.silk) list.add(EnumChatFormatting.GREEN + "Silk touch");
}
public static enum EnumDrillType {
STEEL (1.0D, 1, false, false),
STEEL_DIAMOND (1.0D, 1, false, true),
HSS (1.5D, 2, true, false),
HSS_DIAMOND (1.5D, 2, true, true),
DESH (2.5D, 3, true, true),
DESH_DIAMOND (2.5D, 3, true, true);
STEEL (1.0D, 1, 0, false, false),
STEEL_DIAMOND (1.0D, 1, 2, false, true),
HSS (1.5D, 2, 0, true, false),
HSS_DIAMOND (1.5D, 2, 3, true, true),
DESH (2.5D, 3, 1, true, true),
DESH_DIAMOND (2.5D, 3, 4, true, true);
public double speed;
public int tier;
public int fortune;
public boolean vein;
public boolean silk;
private EnumDrillType(double speed, int tier, boolean vein, boolean silk) {
private EnumDrillType(double speed, int tier, int fortune, boolean vein, boolean silk) {
this.speed = speed;
this.tier = tier;
this.fortune = fortune;
this.vein = vein;
this.silk = silk;
}

View File

@ -264,6 +264,7 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySteamEngine.class, new RenderSteamEngine());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineCombustionEngine.class, new RenderCombustionEngine());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineExcavator.class, new RenderExcavator());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineMixer.class, new RenderMixer());
//Foundry
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFoundryBasin.class, new RenderFoundry());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFoundryMold.class, new RenderFoundry());

View File

@ -785,6 +785,7 @@ public class MainRegistry {
RadiolysisRecipes.registerRadiolysis();
GasCentrifugeRecipes.register();
CombinationRecipes.register();
MixerRecipes.register();
//the good stuff
SerializableRecipe.registerAllHandlers();

View File

@ -64,6 +64,7 @@ public class NEIConfig implements IConfigureNEI {
registerHandler(new BoilingHandler());
registerHandler(new CombinationHandler());
registerHandler(new SawmillHandler());
registerHandler(new MixerHandler());
registerHandler(new ChunkyHandler());

View File

@ -150,6 +150,9 @@ public class ResourceManager {
public static final IModelCustom chemplant_fluidcap = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/chemplant_new_fluidcap.hmf"));
public static final IModelCustom chemfac = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/chemfac.obj"));
//Mixer
public static final IModelCustom mixer = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/machines/mixer.obj"));
//F6 TANKS
public static final IModelCustom tank = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/tank.obj"));
@ -486,10 +489,13 @@ public class ResourceManager {
public static final ResourceLocation chemplant_piston_tex = new ResourceLocation(RefStrings.MODID, "textures/models/chemplant_piston_new.png");
public static final ResourceLocation chemplant_fluid_tex = new ResourceLocation(RefStrings.MODID, "textures/models/lavabase_small.png");
public static final ResourceLocation chemfac_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/chemfac.png");
//F6 TANKS
public static final ResourceLocation uf6_tex = new ResourceLocation(RefStrings.MODID, "textures/models/UF6Tank.png");
public static final ResourceLocation puf6_tex = new ResourceLocation(RefStrings.MODID, "textures/models/PUF6Tank.png");
//Mixer
public static final ResourceLocation mixer_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/mixer.png");
//F6 TANKS
public static final ResourceLocation uf6_tex = new ResourceLocation(RefStrings.MODID, "textures/models/UF6Tank.png");
public static final ResourceLocation puf6_tex = new ResourceLocation(RefStrings.MODID, "textures/models/PUF6Tank.png");
//Centrifuge
public static final ResourceLocation centrifuge_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/centrifuge.png");

View File

@ -4,16 +4,22 @@ import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.lib.RefStrings;
import com.hbm.main.ResourceManager;
import com.hbm.render.item.ItemRenderBase;
import com.hbm.tileentity.machine.TileEntityMachineExcavator;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
public class RenderExcavator extends TileEntitySpecialRenderer implements IItemRendererProvider {
public static final ResourceLocation cobble = new ResourceLocation(RefStrings.MODID, "textures/models/machines/cobblestone.png");
public static final ResourceLocation gravel = new ResourceLocation(RefStrings.MODID, "textures/models/machines/gravel.png");
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) {
@ -36,9 +42,23 @@ public class RenderExcavator extends TileEntitySpecialRenderer implements IItemR
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.mining_drill_tex);
ResourceManager.mining_drill.renderPart("Main");
ResourceManager.mining_drill.renderPart("Crusher1");
ResourceManager.mining_drill.renderPart("Crusher2");
float crusher = drill.prevCrusherRotation + (drill.crusherRotation - drill.prevCrusherRotation) * interp;
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, 2.0F, 2.8125F);
GL11.glRotatef(-crusher, 1, 0, 0);
GL11.glTranslatef(0.0F, -2.0F, -2.8125F);
ResourceManager.mining_drill.renderPart("Crusher1");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, 2.0F, 2.1875F);
GL11.glRotatef(crusher, 1, 0, 0);
GL11.glTranslatef(0.0F, -2.0F, -2.1875F);
ResourceManager.mining_drill.renderPart("Crusher2");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glRotatef(drill.prevDrillRotation + (drill.drillRotation - drill.prevDrillRotation) * interp, 0F, -1F, 0F);
float ext = drill.prevDrillExtension + (drill.drillExtension - drill.prevDrillExtension) * interp;
GL11.glTranslatef(0.0F, -ext, 0.0F);
@ -49,9 +69,77 @@ public class RenderExcavator extends TileEntitySpecialRenderer implements IItemR
GL11.glTranslated(0.0D, 2.0D, 0.0D);
ext -= 2;
}
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
if(drill.chuteTimer > 0) {
bindTexture(cobble);
double widthX = 0.125;
double widthZ = 0.125;
double speed = 250D;
double dropU = -System.currentTimeMillis() % speed / speed;
double dropL = dropU + 4;
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
tess.setNormal(0F, 0F, 1F);
tess.addVertexWithUV(widthX, 3, 2.5 + widthZ, 0, dropU);
tess.addVertexWithUV(-widthX, 3, 2.5 + widthZ, 1, dropU);
tess.addVertexWithUV(-widthX, 2, 2.5 + widthZ, 1, dropL);
tess.addVertexWithUV(widthX, 2, 2.5 + widthZ, 0, dropL);
tess.setNormal(0F, 0F, -1F);
tess.addVertexWithUV(-widthX, 3, 2.5 - widthZ, 1, dropU);
tess.addVertexWithUV(widthX, 3, 2.5 - widthZ, 0, dropU);
tess.addVertexWithUV(widthX, 2, 2.5 - widthZ, 0, dropL);
tess.addVertexWithUV(-widthX, 2, 2.5 - widthZ, 1, dropL);
tess.setNormal(-1F, 0F, 0F);
tess.addVertexWithUV(-widthX, 3, 2.5 + widthZ, 0, dropU);
tess.addVertexWithUV(-widthX, 3, 2.5 - widthZ, 1, dropU);
tess.addVertexWithUV(-widthX, 2, 2.5 - widthZ, 1, dropL);
tess.addVertexWithUV(-widthX, 2, 2.5 + widthZ, 0, dropL);
tess.setNormal(1F, 0F, 0F);
tess.addVertexWithUV(widthX, 3, 2.5 - widthZ, 1, dropU);
tess.addVertexWithUV(widthX, 3, 2.5 + widthZ, 0, dropU);
tess.addVertexWithUV(widthX, 2, 2.5 + widthZ, 0, dropL);
tess.addVertexWithUV(widthX, 2, 2.5 - widthZ, 1, dropL);
tess.draw();
boolean smoosh = drill.enableCrusher;
widthX = smoosh ? 0.5 : 0.25;
widthZ = 0.0625;
double uU = smoosh ? 4 : 2;
double uL = 0.5;
bindTexture(smoosh ? gravel : cobble);
tess.startDrawingQuads();
tess.setNormal(0F, 0F, 1F);
tess.addVertexWithUV(widthX, 2, 2.5 + widthZ, 0, dropU);
tess.addVertexWithUV(-widthX, 2, 2.5 + widthZ, uU, dropU);
tess.addVertexWithUV(-widthX, 1, 2.5 + widthZ, uU, dropL);
tess.addVertexWithUV(widthX, 1, 2.5 + widthZ, 0, dropL);
tess.setNormal(0F, 0F, -1F);
tess.addVertexWithUV(-widthX, 2, 2.5 - widthZ, uU, dropU);
tess.addVertexWithUV(widthX, 2, 2.5 - widthZ, 0, dropU);
tess.addVertexWithUV(widthX, 1, 2.5 - widthZ, 0, dropL);
tess.addVertexWithUV(-widthX, 1, 2.5 - widthZ, uU, dropL);
tess.setNormal(-1F, 0F, 0F);
tess.addVertexWithUV(-widthX, 2, 2.5 + widthZ, 0, dropU);
tess.addVertexWithUV(-widthX, 2, 2.5 - widthZ, uL, dropU);
tess.addVertexWithUV(-widthX, 1, 2.5 - widthZ, uL, dropL);
tess.addVertexWithUV(-widthX, 1, 2.5 + widthZ, 0, dropL);
tess.setNormal(1F, 0F, 0F);
tess.addVertexWithUV(widthX, 2, 2.5 - widthZ, uL, dropU);
tess.addVertexWithUV(widthX, 2, 2.5 + widthZ, 0, dropU);
tess.addVertexWithUV(widthX, 1, 2.5 + widthZ, 0, dropL);
tess.addVertexWithUV(widthX, 1, 2.5 - widthZ, uL, dropL);
tess.draw();
}
GL11.glPopMatrix();
}

View File

@ -0,0 +1,41 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import com.hbm.tileentity.machine.TileEntityMachineMixer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
public class RenderMixer extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.mixer_tex);
ResourceManager.mixer.renderPart("Main");
TileEntityMachineMixer mixer = (TileEntityMachineMixer) tile;
GL11.glPushMatrix();
GL11.glRotatef(mixer.prevRotation + (mixer.rotation - mixer.prevRotation) * interp, 0, 1, 0);
ResourceManager.mixer.renderPart("Mixer");
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor3f(1F, 1F, 1F);
ResourceManager.mixer.renderPart("Fluid");
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
}
}

View File

@ -273,6 +273,7 @@ public class TileMappings {
put(TileEntityMachineLiquefactor.class, "tileentity_liquefactor");
put(TileEntityMachineSolidifier.class, "tileentity_solidifier");
put(TileEntityElectrolyser.class, "tileentity_electrolyser");
put(TileEntityMachineMixer.class, "tileentity_mixer");
put(TileEntitySteamEngine.class, "tileentity_steam_engine");
put(TileEntityMachineTurbine.class, "tileentity_turbine");

View File

@ -1,5 +1,7 @@
package com.hbm.tileentity.machine;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
@ -8,12 +10,16 @@ import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.network.CraneInserter;
import com.hbm.entity.item.EntityMovingItem;
import com.hbm.interfaces.IControlReceiver;
import com.hbm.inventory.UpgradeManager;
import com.hbm.inventory.container.ContainerMachineExcavator;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMachineExcavator;
import com.hbm.inventory.recipes.ShredderRecipes;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemDrillbit;
import com.hbm.items.machine.ItemDrillbit.EnumDrillType;
import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType;
import com.hbm.lib.Library;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
@ -24,6 +30,7 @@ import com.hbm.util.fauxpointtwelve.BlockPos;
import api.hbm.conveyor.IConveyorBelt;
import api.hbm.energy.IEnergyUser;
import api.hbm.fluid.IFluidStandardReceiver;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
@ -62,6 +69,13 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
public float prevDrillRotation = 0F;
public float drillExtension = 0F;
public float prevDrillExtension = 0F;
public float crusherRotation = 0F;
public float prevCrusherRotation = 0F;
public int chuteTimer = 0;
public double speed = 1.0D;
public final long baseConsumption = 10_000L;
public long consumption = baseConsumption;
public FluidTank tank;
@ -78,17 +92,41 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
@Override
public void updateEntity() {
//needs to happen on client too for GUI rendering
UpgradeManager.eval(slots, 2, 3);
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
consumption = baseConsumption * (1 + speedLevel);
consumption /= (1 + powerLevel);
if(!worldObj.isRemote) {
if(worldObj.getTotalWorldTime() % 20 == 0) {
tryEjectBuffer();
}
if(chuteTimer > 0) chuteTimer--;
this.power = Library.chargeTEFromItems(slots, 0, this.getPower(), this.getMaxPower());
this.operational = false;
int radiusLevel = Math.min(UpgradeManager.getLevel(UpgradeType.EFFECT), 3);
if(this.enableDrill && this.getInstalledDrill() != null && this.power >= this.getPowerConsumption()) {
EnumDrillType type = this.getInstalledDrill();
if(this.enableDrill && type != null && this.power >= this.getPowerConsumption()) {
operational = true;
this.power -= this.getPowerConsumption();
if(targetDepth < this.yCoord - 4 && tryDrill(5)) {
this.speed = type.speed;
this.speed *= (1 + speedLevel / 2D);
if(targetDepth < this.yCoord - 4 && tryDrill(1 + radiusLevel * 2)) {
targetDepth++;
if(targetDepth >= this.yCoord - 4) {
this.enableDrill = false;
}
}
} else {
this.targetDepth = 0;
@ -102,6 +140,7 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
data.setBoolean("s", enableSilkTouch);
data.setBoolean("o", operational);
data.setInteger("t", targetDepth);
data.setInteger("g", chuteTimer);
data.setLong("p", power);
this.networkPack(data, 150);
@ -120,16 +159,27 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
this.drillExtension -= sig * speed;
}
}
this.prevDrillRotation = this.drillRotation;
this.prevCrusherRotation = this.crusherRotation;
if(this.operational)
if(this.operational) {
this.drillRotation += 15F;
if(this.enableCrusher) {
this.crusherRotation += 15F;
}
}
if(this.drillRotation >= 360F) {
this.drillRotation -= 360F;
this.prevDrillRotation -= 360F;
}
if(this.crusherRotation >= 360F) {
this.crusherRotation -= 360F;
this.prevCrusherRotation -= 360F;
}
}
}
@ -141,6 +191,7 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
this.enableSilkTouch = nbt.getBoolean("s");
this.operational = nbt.getBoolean("o");
this.targetDepth = nbt.getInteger("t");
this.chuteTimer = nbt.getInteger("g");
this.power = nbt.getLong("p");
}
@ -181,7 +232,7 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
if(!ignoreAll) {
ticksWorked++;
int ticksToWork = (int) Math.ceil(combinedHardness);
int ticksToWork = (int) Math.ceil(combinedHardness / this.speed);
if(ticksWorked >= ticksToWork) {
breakBlocks(ring);
@ -236,7 +287,7 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
maxX = x;
maxY = y;
maxZ = z;
breakRecursively(x, y, z, 10);
breakRecursively(x, y, z, 15);
recursionBrake.clear();
/* move all excavated items to the last drillable position which is also within collection range */
@ -289,7 +340,47 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
}
protected void breakSingleBlock(Block b, int x ,int y, int z) {
b.dropBlockAsItem(worldObj, x, y, z, worldObj.getBlockMetadata(x, y, z), 0 /* fortune */);
List<ItemStack> items = b.getDrops(worldObj, x, y, z, worldObj.getBlockMetadata(x, y, z), this.getFortuneLevel());
if(this.canSilkTouch()) {
try {
Method createStackedBlock = ReflectionHelper.findMethod(Block.class, b, new String[] {"createStackedBlock", "func_149644_j"}, int.class);
ItemStack result = (ItemStack) createStackedBlock.invoke(b, worldObj.getBlockMetadata(x, y, z));
if(result != null) {
items.clear();
items.add(result.copy());
}
} catch(Exception ex) { }
}
if(this.enableCrusher) {
List<ItemStack> list = new ArrayList();
for(ItemStack stack : items) {
ItemStack crushed = ShredderRecipes.getShredderResult(stack).copy();
if(crushed.getItem() == ModItems.scrap || crushed.getItem() == ModItems.dust) {
list.add(stack);
} else {
crushed.stackSize *= stack.stackSize;
list.add(crushed);
}
}
items = list;
}
if(b == ModBlocks.barricade)
items.clear();
for(ItemStack item : items) {
worldObj.spawnEntityInWorld(new EntityItem(worldObj, x + 0.5, y + 0.5, z + 0.5, item));
}
worldObj.func_147480_a(x, y, z, false);
}
@ -318,6 +409,47 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
}
}
protected void tryEjectBuffer() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10);
int x = xCoord + dir.offsetX * 4;
int y = yCoord - 3;
int z = zCoord + dir.offsetZ * 4;
List<ItemStack> items = new ArrayList();
for(int i = 5; i < 14; i++) {
ItemStack stack = slots[i];
if(stack != null) {
items.add(stack.copy());
}
}
TileEntity tile = worldObj.getTileEntity(x, y, z);
if(tile instanceof IInventory) {
supplyContainer((IInventory) tile, items, dir.getOpposite());
}
Block b = worldObj.getBlock(x, y, z);
if(b instanceof IConveyorBelt) {
supplyConveyor((IConveyorBelt) b, items, x, y, z);
}
items.removeIf(i -> i == null || i.stackSize <= 0);
for(int i = 5; i < 14; i++) {
int index = i - 5;
if(items.size() > index) {
slots[i] = items.get(index).copy();
} else {
slots[i] = null;
}
}
}
/** pulls up an AABB around the drillbit and tries to either conveyor output or buffer collected items */
protected void tryCollect(int radius) {
int yLevel = getY();
@ -330,19 +462,63 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
int y = yCoord - 3;
int z = zCoord + dir.offsetZ * 4;
List<ItemStack> stacks = new ArrayList();
items.forEach(i -> stacks.add(i.getEntityItem()));
/* try to insert into a valid coontainer */
TileEntity tile = worldObj.getTileEntity(x, y, z);
if(tile instanceof IInventory) {
supplyContainer((IInventory) tile, items, dir.getOpposite());
supplyContainer((IInventory) tile, stacks, dir.getOpposite());
}
/* try to place on conveyor belt */
Block b = worldObj.getBlock(x, y, z);
if(b instanceof IConveyorBelt) {
supplyConveyor((IConveyorBelt) b, items, x, y, z);
supplyConveyor((IConveyorBelt) b, stacks, x, y, z);
}
items.removeIf(i -> i.isDead || i.getEntityItem().stackSize <= 0);
/* collect remaining items in internal buffer */
outer:
for(EntityItem item : items) {
ItemStack stack = item.getEntityItem();
/* adding items to existing stacks */
for(int i = 5; i < 14; i++) {
if(slots[i] != null && slots[i].stackSize < slots[i].getMaxStackSize() && stack.isItemEqual(slots[i]) && ItemStack.areItemStackTagsEqual(stack, slots[i])) {
int toAdd = Math.min(slots[i].getMaxStackSize() - slots[i].stackSize, stack.stackSize);
slots[i].stackSize += toAdd;
stack.stackSize -= toAdd;
chuteTimer = 40;
if(stack.stackSize <= 0) {
item.setDead();
continue outer;
}
}
}
/* add leftovers to empty slots */
for(int i = 5; i < 14; i++) {
if(slots[i] == null) {
chuteTimer = 40;
slots[i] = stack.copy();
item.setDead();
break;
}
}
}
}
/** places all items into a connected container, if possible */
protected void supplyContainer(IInventory inv, List<EntityItem> items, ForgeDirection dir) {
protected void supplyContainer(IInventory inv, List<ItemStack> items, ForgeDirection dir) {
int side = dir.ordinal();
int[] access = null;
@ -352,40 +528,46 @@ public class TileEntityMachineExcavator extends TileEntityMachineBase implements
access = CraneInserter.masquerade(sided, dir.ordinal());
}
for(EntityItem item : items) {
for(ItemStack item : items) {
if(item.isDead) continue;
if(item.stackSize <= 0) continue;
ItemStack stack = CraneInserter.addToInventory(inv, access, item.getEntityItem(), side);
if(stack == null || stack.stackSize == 0) {
item.setDead();
}
CraneInserter.addToInventory(inv, access, item, side);
chuteTimer = 40;
}
}
/** moves all items onto a connected conveyor belt */
protected void supplyConveyor(IConveyorBelt belt, List<EntityItem> items, int x, int y, int z) {
protected void supplyConveyor(IConveyorBelt belt, List<ItemStack> items, int x, int y, int z) {
Random rand = worldObj.rand;
for(EntityItem item : items) {
for(ItemStack item : items) {
if(item.isDead) continue;
if(item.stackSize <= 0) continue;
Vec3 base = Vec3.createVectorHelper(x + rand.nextDouble(), y + 0.5, z + rand.nextDouble());
Vec3 vec = belt.getClosestSnappingPosition(worldObj, x, y, z, base);
EntityMovingItem moving = new EntityMovingItem(worldObj);
moving.setPosition(base.xCoord, vec.yCoord, base.zCoord);
moving.setItemStack(item.getEntityItem().copy());
moving.setItemStack(item.copy());
worldObj.spawnEntityInWorld(moving);
item.setDead();
item.stackSize = 0;
chuteTimer = 40;
}
}
public int getPowerConsumption() {
return 10_000;
public long getPowerConsumption() {
return consumption;
}
public int getFortuneLevel() {
EnumDrillType type = getInstalledDrill();
if(type != null) return type.fortune;
return 0;
}
public boolean shouldIgnoreBlock(Block block, int x, int y, int z) {

View File

@ -0,0 +1,236 @@
package com.hbm.tileentity.machine;
import com.hbm.inventory.container.ContainerMixer;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.gui.GUIMixer;
import com.hbm.inventory.recipes.MixerRecipes;
import com.hbm.inventory.recipes.MixerRecipes.MixerRecipe;
import com.hbm.lib.Library;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.INBTPacketReceiver;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.fauxpointtwelve.DirPos;
import api.hbm.energy.IEnergyUser;
import api.hbm.fluid.IFluidStandardTransceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
public class TileEntityMachineMixer extends TileEntityMachineBase implements INBTPacketReceiver, IGUIProvider, IEnergyUser, IFluidStandardTransceiver {
public long power;
public static final long maxPower = 100_000;
public int progress;
public int processTime;
public float rotation;
public float prevRotation;
public boolean wasOn = false;
public FluidTank[] tanks;
public TileEntityMachineMixer() {
super(5);
this.tanks = new FluidTank[3];
this.tanks[0] = new FluidTank(Fluids.NONE, 16_000);
this.tanks[1] = new FluidTank(Fluids.NONE, 16_000);
this.tanks[2] = new FluidTank(Fluids.NONE, 16_000);
}
@Override
public String getName() {
return "container.machineMixer";
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
tanks[2].setType(2, slots);
for(DirPos pos : getConPos()) {
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
if(tanks[0].getTankType() != Fluids.NONE) this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
if(tanks[1].getTankType() != Fluids.NONE) this.trySubscribe(tanks[1].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
this.wasOn = this.canProcess();
if(this.wasOn) {
this.progress++;
if(this.progress >= this.processTime) {
this.process();
this.progress = 0;
}
} else {
this.progress = 0;
}
for(DirPos pos : getConPos()) {
if(tanks[2].getFill() > 0) this.sendFluid(tanks[2].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
}
NBTTagCompound data = new NBTTagCompound();
data.setLong("power", power);
data.setInteger("processTime", processTime);
data.setInteger("progress", progress);
data.setBoolean("wasOn", wasOn);
for(int i = 0; i < 3; i++) {
tanks[i].writeToNBT(data, i + "");
}
this.networkPack(data, 50);
} else {
this.prevRotation = this.rotation;
if(this.wasOn) {
this.rotation += 20F;
}
}
}
@Override
public void networkUnpack(NBTTagCompound nbt) {
this.power = nbt.getLong("powe");
this.processTime = nbt.getInteger("processTime");
this.progress = nbt.getInteger("progress");
this.wasOn = nbt.getBoolean("wasOn");
for(int i = 0; i < 3; i++) {
tanks[i].readFromNBT(nbt, i + "");
}
}
public boolean canProcess() {
MixerRecipe recipe = MixerRecipes.getOutput(tanks[2].getTankType());
if(recipe == null) return false;
if(recipe.input1 != null) {
if(recipe.input1.type != tanks[0].getTankType()) {
tanks[0].setTankType(recipe.input1.type);
}
if(tanks[0].getFill() < recipe.input1.fill) return false;
}
if(recipe.input2 != null) {
if(recipe.input2.type != tanks[1].getTankType()) {
tanks[1].setTankType(recipe.input2.type);
}
if(tanks[1].getFill() < recipe.input2.fill) return false;
}
/* simplest check would usually go first, but fluid checks also do the setup and we want that to happen even without power */
if(this.power < getConsumption()) return false;
if(recipe.output + tanks[2].getFill() > tanks[2].getMaxFill()) return false;
if(recipe.solidInput != null) {
if(slots[1] == null) return false;
if(!recipe.solidInput.matchesRecipe(slots[1], true) || recipe.solidInput.stacksize > slots[1].stackSize) return false;
}
this.processTime = recipe.processTime;
return true;
}
protected void process() {
MixerRecipe recipe = MixerRecipes.getOutput(tanks[2].getTankType());
if(recipe.input1 != null) tanks[0].setFill(tanks[0].getFill() - recipe.input1.fill);
if(recipe.input2 != null) tanks[1].setFill(tanks[1].getFill() - recipe.input2.fill);
if(recipe.solidInput != null) this.decrStackSize(1, recipe.solidInput.stacksize);
tanks[2].setFill(tanks[2].getFill() + recipe.output);
}
public int getConsumption() {
return 50;
}
protected DirPos[] getConPos() {
return new DirPos[] {
new DirPos(xCoord, yCoord - 1, zCoord, Library.NEG_Y),
new DirPos(xCoord + 1, yCoord, zCoord, Library.POS_X),
new DirPos(xCoord - 1, yCoord, zCoord, Library.POS_X),
new DirPos(xCoord, yCoord, zCoord + 1, Library.POS_Z),
new DirPos(xCoord, yCoord, zCoord - 1, Library.POS_Z),
};
}
@Override
public long getPower() {
return power;
}
@Override
public void setPower(long power) {
this.power = power;
}
@Override
public long getMaxPower() {
return maxPower;
}
@Override
public FluidTank[] getAllTanks() {
return tanks;
}
@Override
public FluidTank[] getSendingTanks() {
return new FluidTank[] {tanks[2]};
}
@Override
public FluidTank[] getReceivingTanks() {
return new FluidTank[] {tanks[0], tanks[1]};
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerMixer(player.inventory, this);
}
@Override
@SideOnly(Side.CLIENT)
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUIMixer(player.inventory, this);
}
AxisAlignedBB aabb;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(aabb != null)
return aabb;
aabb = AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 3, zCoord + 1);
return aabb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
}

View File

@ -22,6 +22,7 @@ import com.hbm.tileentity.INBTPacketReceiver;
import com.hbm.tileentity.IOverpressurable;
import com.hbm.tileentity.TileEntityLoadedBase;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
import com.hbm.util.Compat;
import com.hbm.util.I18nUtil;
import api.hbm.fluid.IFluidConductor;
@ -167,7 +168,7 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements
heatCache[index] = null;
if(heatCache[index] == null) {
TileEntity te = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
TileEntity te = Compat.getTileStandard(worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
if(te instanceof TileEntityRBMKBase) {
TileEntityRBMKBase base = (TileEntityRBMKBase) te;
@ -535,7 +536,7 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements
private void getFF(int x, int y, int z) {
TileEntity te = worldObj.getTileEntity(x, y, z);
TileEntity te = Compat.getTileStandard(worldObj, x, y, z);
if(te instanceof TileEntityRBMKBase) {

View File

@ -26,12 +26,12 @@ public class TileEntityRBMKInlet extends TileEntityLoadedBase implements IFluidA
if(!worldObj.isRemote) {
this.subscribeToAllAround(water.getTankType(), this);
for(int i = 2; i < 6; i++) {
ForgeDirection dir = ForgeDirection.getOrientation(i);
Block b = worldObj.getBlock(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
this.trySubscribe(water.getTankType(), worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ, dir);
if(b instanceof RBMKBase) {
int[] pos = ((RBMKBase)b).findCore(worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);

View File

@ -8,6 +8,7 @@ import com.hbm.handler.radiation.ChunkRadiationManager;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemRBMKRod;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
import com.hbm.util.Compat;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
@ -152,7 +153,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM
protected double runInteraction(int x, int y, int z, double flux) {
TileEntity te = worldObj.getTileEntity(x, y, z);
TileEntity te = Compat.getTileStandard(worldObj, x, y, z);
if(te instanceof TileEntityRBMKBase) {
TileEntityRBMKBase base = (TileEntityRBMKBase) te;

View File

@ -183,6 +183,11 @@ public class TileEntityCraneExtractor extends TileEntityMachineBase implements I
this.matcher.nextMode(worldObj, slots[i], i);
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return new int[] { 9, 10, 11, 12, 13, 14, 15, 16, 17 };
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
return i > 8 && i < 18;

View File

@ -9,7 +9,6 @@ import com.hbm.handler.ArmorModHandler;
import api.hbm.item.IGasMask;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

View File

@ -21,6 +21,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class Compat {
@ -194,4 +196,12 @@ public class Compat {
}
MainRegistry.logger.info("#######################################################");
}
/** A standard implementation of safely grabbing a tile entity without loading chunks, might have more fluff added to it later on. */
public static TileEntity getTileStandard(World world, int x, int y, int z) {
if(!world.getChunkProvider().chunkExists(x >> 4, z >> 4)) return null;
return world.getTileEntity(x, y, z);
}
}

View File

@ -394,6 +394,26 @@ public class InventoryUtil {
return stacks;
}
/* in emergency situations with mixed types where AStacks coexist with NBT dependent ItemStacks, such as for fluid icons */
if(o instanceof Object[]) {
Object[] ingredients = (Object[]) o;
ItemStack[][] stacks = new ItemStack[ingredients.length][0];
for(int i = 0; i < ingredients.length; i++) {
Object ingredient = ingredients[i];
if(ingredient instanceof AStack) {
stacks[i] = ((AStack) ingredient).extractForNEI().toArray(new ItemStack[0]);
}
if(ingredient instanceof ItemStack) {
stacks[i] = new ItemStack[1];
stacks[i][0] = ((ItemStack) ingredient).copy();
}
}
return stacks;
}
return new ItemStack[0][0];
}

View File

@ -3223,6 +3223,9 @@ tile.block_cap_sparkle.name=S~Cola Kronkorkenblock
tile.block_cap_star.name=Sunset Sarsaparilla Kronkorkenblock
tile.block_cap_sunset.name=Sunset Sarsaparilla Sternkronkorkenblock
tile.block_cobalt.name=Kobaltblock
tile.block_coke.coal.name=Kohlekoksblock
tile.block_coke.lignite.name=Braunkohlekoksblock
tile.block_coke.petroleum.name=Petroleumkoksblock
tile.block_coltan.name=Coltanblock
tile.block_combine_steel.name=CMB-Stahlblock
tile.block_copper.name=Kupferblock

View File

@ -3794,6 +3794,9 @@ tile.block_cap_sparkle.name=Block of S~Cola Bottle Caps
tile.block_cap_star.name=Block of Sunset Sarsaparilla Star Caps
tile.block_cap_sunset.name=Block of Sunset Sarsaparilla Bottle Caps
tile.block_cobalt.name=Block of Cobalt
tile.block_coke.coal.name=Block of Coal Coke
tile.block_coke.lignite.name=Block of Lignite Coke
tile.block_coke.petroleum.name=Block of Petroleum Coke
tile.block_coltan.name=Block of Coltan
tile.block_combine_steel.name=Block of CMB Steel
tile.block_copper.name=Block of Copper

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B