diff --git a/changelog b/changelog index d16399994..5f62bb644 100644 --- a/changelog +++ b/changelog @@ -1,13 +1,11 @@ ## Added -* New command `/ntmsatellites` - * `/ntmsatellites orbit` will send the held saatellite into orbit - * `/ntmsatellites descend ` will delete the given satellite ## Changed -* Updated russian localization -* It's no longer possible to insert items into the satellite cargo pad, it's only for unloading -* The satellite linker will no longer assign new frequencies in the randomizer slot if that frequency is already taken -* Custom machines will now show a hologram showing how they are built +* Bedrock ores now spawn in the nether + * Nether bedrock ores include red phosphorus and glowstone, both yielding powders instead of ores + * All current nether bedrock ores are tier 1 and do not require any bore fluid +* Custom machines now show their recipes in NEI + * All it took was battling NEI's source code for 3 hours and my sanity ## Fixed * Fixed crash caused by mobs spawning in highly polluted area diff --git a/gradle.properties b/gradle.properties index d305d95b5..fb976de9d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,4 @@ credits=HbMinecraft, rodolphito (explosion algorithms), grangerave (explosion al \ Voxelstice (OpenComputers integration, turbine spinup), BallOfEnergy1 (OpenComputers integration), martemen\ \ (project settings), Pvndols (thorium fuel recipe, gas turbine), JamesH2 (blood mechanics, nitric acid,\ \ particle emitter), sdddddf80 (recipe configs, chinese localization, custom machine holograms),\ - \ SuperCraftAlex (tooltips) LePeep (coilgun model), Maksymisio (polish localization) + \ SuperCraftAlex (tooltips) LePeep (coilgun model, BDCL QC), Maksymisio (polish localization) diff --git a/src/main/java/com/hbm/blocks/machine/BlockCustomMachine.java b/src/main/java/com/hbm/blocks/machine/BlockCustomMachine.java index 0dac71ca5..72efa3313 100644 --- a/src/main/java/com/hbm/blocks/machine/BlockCustomMachine.java +++ b/src/main/java/com/hbm/blocks/machine/BlockCustomMachine.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Random; import com.hbm.config.CustomMachineConfigJSON; +import com.hbm.config.CustomMachineConfigJSON.MachineConfiguration; import com.hbm.items.ModItems; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; @@ -92,10 +93,19 @@ public class BlockCustomMachine extends BlockContainer { TileEntityCustomMachine tile = (TileEntityCustomMachine) world.getTileEntity(x, y, z); - if(tile != null && stack.hasTagCompound()) { - tile.machineType = stack.stackTagCompound.getString("machineType"); - tile.init(); - tile.markChanged(); + if(tile != null) { + int id = stack.getItemDamage() - 100; + + if(id >= 0 && id < CustomMachineConfigJSON.customMachines.size()) { + + MachineConfiguration config = CustomMachineConfigJSON.niceList.get(id); + + if(config != null) { + tile.machineType = config.unlocalizedName; + tile.init(); + tile.markChanged(); + } + } } } @@ -126,8 +136,6 @@ public class BlockCustomMachine extends BlockContainer { if(tile != null) { ItemStack stack = new ItemStack(item, 1, CustomMachineConfigJSON.niceList.indexOf(tile.config) + 100); - stack.stackTagCompound = new NBTTagCompound(); - stack.stackTagCompound.setString("machineType", tile.machineType); ret.add(stack); } } @@ -142,8 +150,6 @@ public class BlockCustomMachine extends BlockContainer { if(tile != null && tile.machineType != null && !tile.machineType.isEmpty()) { ItemStack stack = new ItemStack(this, 1, CustomMachineConfigJSON.niceList.indexOf(tile.config) + 100); - stack.stackTagCompound = new NBTTagCompound(); - stack.stackTagCompound.setString("machineType", tile.machineType); return stack; } diff --git a/src/main/java/com/hbm/blocks/machine/MachineElectrolyser.java b/src/main/java/com/hbm/blocks/machine/MachineElectrolyser.java index fb3ee992f..3c6b7beac 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineElectrolyser.java +++ b/src/main/java/com/hbm/blocks/machine/MachineElectrolyser.java @@ -20,18 +20,18 @@ public class MachineElectrolyser extends BlockDummyable { @Override public TileEntity createNewTileEntity(World world, int meta) { if(meta >= 12) return new TileEntityElectrolyser(); - if(meta >= 6) return new TileEntityProxyCombo(false, true, true); + if(meta >= 6) return new TileEntityProxyCombo().inventory().power().fluid(); return null; } @Override public int[] getDimensions() { - return new int[] {0, 0, 4, 4, 2, 2}; + return new int[] {0, 0, 5, 5, 1, 3}; } @Override public int getOffset() { - return 4; + return 5; } @Override @@ -42,33 +42,54 @@ public class MachineElectrolyser extends BlockDummyable { @Override public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); - MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {1, 0, 4, 4, 1, 1}, this, dir); - MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, -1, 4, 4, 0, 0}, this, dir); - MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, 1, -1, -2, 2}, this, dir); - MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, 1, -1, -1, 1}, this, dir); - MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, 3, -3, -2, 2}, this, dir); - MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, 3, -3, -1, 1}, this, dir); - MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, -1, 1, -2, 2}, this, dir); - MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, -1, 1, -1, 1}, this, dir); - MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, -3, 3, -2, 2}, this, dir); - MultiblockHandlerXR.fillSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, -3, 3, -1, 1}, this, dir); + x += dir.offsetX * o; + z += dir.offsetZ * o; + + MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {2, -1, 5, 5, 1, 1}, this, dir); + MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, -3, 5, 5, 0, 0}, this, dir); + MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, -1, 4, -4, -3, 3}, this, dir); + MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, -1, 2, -2, -3, 3}, this, dir); + MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, -1, 0, 0, -3, 3}, this, dir); + MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, -1, -2, 2, -3, 3}, this, dir); + MultiblockHandlerXR.fillSpace(world, x, y, z, new int[] {3, -1, -4, 4, -3, 3}, this, dir); + MultiblockHandlerXR.fillSpace(world,x + dir.offsetX * 4, y + 3, z + dir.offsetZ * 4, new int[] {0, 0, 0, 0, -1, 2}, this, dir); + MultiblockHandlerXR.fillSpace(world,x + dir.offsetX * 2, y + 3, z + dir.offsetZ * 2, new int[] {0, 0, 0, 0, -1, 2}, this, dir); + MultiblockHandlerXR.fillSpace(world, x, y + 3, z, new int[] {0, 0, 0, 0, -1, 2}, this, dir); + MultiblockHandlerXR.fillSpace(world, x - dir.offsetX * 2, y + 3, z - dir.offsetZ * 2, new int[] {0, 0, 0, 0, -1, 2}, this, dir); + MultiblockHandlerXR.fillSpace(world, x - dir.offsetX * 4, y + 3, z - dir.offsetZ * 4, new int[] {0, 0, 0, 0, -1, 2}, this, dir); + + ForgeDirection rot = dir.getRotation(ForgeDirection.UP); + + this.makeExtra(world, x - dir.offsetX * 5, y, z - dir.offsetZ * 5); + this.makeExtra(world, x - dir.offsetX * 5 + rot.offsetX, y, z - dir.offsetZ * 5 + rot.offsetZ); + this.makeExtra(world, x - dir.offsetX * 5 - rot.offsetX, y, z - dir.offsetZ * 5 - rot.offsetZ); + this.makeExtra(world, x + dir.offsetX * 5, y, z + dir.offsetZ * 5); + this.makeExtra(world, x + dir.offsetX * 5 + rot.offsetX, y, z + dir.offsetZ * 5 + rot.offsetZ); + this.makeExtra(world, x + dir.offsetX * 5 - rot.offsetX, y, z + dir.offsetZ * 5 - rot.offsetZ); } @Override protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { - if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, getDimensions(), x, y, z, dir)) return false; - if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {1, 0, 4, 4, 1, 1}, x, y, z, dir)) return false; - if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, -1, 4, 4, 0, 0}, x, y, z, dir)) return false; - if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, 1, -1, -2, 2}, x, y, z, dir)) return false; - if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, 1, -1, -1, 1}, x, y, z, dir)) return false; - if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, 3, -3, -2, 2}, x, y, z, dir)) return false; - if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, 3, -3, -1, 1}, x, y, z, dir)) return false; - if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, -1, 1, -2, 2}, x, y, z, dir)) return false; - if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, -1, 1, -1, 1}, x, y, z, dir)) return false; - if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {3, 0, -3, 3, -2, 2}, x, y, z, dir)) return false; - if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o , 3 + y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {0, 0, -3, 3, -1, 1}, x, y, z, dir)) return false; + x += dir.offsetX * o; + z += dir.offsetZ * o; + + if(!MultiblockHandlerXR.checkSpace(world, x, y , z, getDimensions(), x, y, z, dir)) return false; + + if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {2, -1, 5, 5, 1, 1}, x, y, z, dir)) return false; + if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {3, -3, 5, 5, 0, 0}, x, y, z, dir)) return false; + if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {3, -1, 4, -4, -3, 3}, x, y, z, dir)) return false; + if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {3, -1, 2, -2, -3, 3}, x, y, z, dir)) return false; + if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {3, -1, 0, 0, -3, 3}, x, y, z, dir)) return false; + if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {3, -1, -2, 2, -3, 3}, x, y, z, dir)) return false; + if(!MultiblockHandlerXR.checkSpace(world, x, y, z, new int[] {3, -1, -4, 4, -3, 3}, x, y, z, dir)) return false; + + if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * 4, y + 3, z + dir.offsetZ * 4, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false; + if(!MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * 2, y + 3, z + dir.offsetZ * 2, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false; + if(!MultiblockHandlerXR.checkSpace(world, x, y + 3, z, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false; + if(!MultiblockHandlerXR.checkSpace(world, x - dir.offsetX * 2, y + 3, z - dir.offsetZ * 2, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false; + if(!MultiblockHandlerXR.checkSpace(world, x - dir.offsetX * 4, y + 3, z - dir.offsetZ * 4, new int[] {0, 0, 0, 0, -1, 2}, x, y, z, dir)) return false; return true; } diff --git a/src/main/java/com/hbm/config/WorldConfig.java b/src/main/java/com/hbm/config/WorldConfig.java index cf0f08a67..c2ac4bbb3 100644 --- a/src/main/java/com/hbm/config/WorldConfig.java +++ b/src/main/java/com/hbm/config/WorldConfig.java @@ -48,6 +48,8 @@ public class WorldConfig { public static int bedrockNiterSpawn = 50; public static int bedrockFluoriteSpawn = 50; public static int bedrockRedstoneSpawn = 50; + public static int bedrockGlowstoneSpawn = 100; + public static int bedrockPhosphorusSpawn = 50; public static int ironClusterSpawn = 4; public static int titaniumClusterSpawn = 2; @@ -153,7 +155,10 @@ public class WorldConfig { bedrockNiterSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B11_bedrockNiterWeight", "Spawn weight for niter bedrock ore", 50); bedrockFluoriteSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B12_bedrockFluoriteWeight", "Spawn weight for fluorite bedrock ore", 50); bedrockRedstoneSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B13_bedrockRedstoneWeight", "Spawn weight for redstone bedrock ore", 50); - bedrockChlorocalciteSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B14_bedrockbChlorocalciteWeight", "Spawn weight for chlorocalcite bedrock ore", 35); + bedrockChlorocalciteSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.B14_bedrockChlorocalciteWeight", "Spawn weight for chlorocalcite bedrock ore", 35); + + bedrockGlowstoneSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.BN00_bedrockGlowstoneWeight", "Spawn weight for glowstone bedrock ore", 100); + bedrockPhosphorusSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.BN01_bedrockPhosphorusWeight", "Spawn weight for phosphorus bedrock ore", 50); ironClusterSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.C00_ironClusterSpawn", "Amount of iron cluster veins per chunk", 4); titaniumClusterSpawn = CommonConfig.createConfigInt(config, CATEGORY_OREGEN, "2.C01_titaniumClusterSpawn", "Amount of titanium cluster veins per chunk", 2); diff --git a/src/main/java/com/hbm/handler/nei/CustomMachineHandler.java b/src/main/java/com/hbm/handler/nei/CustomMachineHandler.java new file mode 100644 index 000000000..cf3570f79 --- /dev/null +++ b/src/main/java/com/hbm/handler/nei/CustomMachineHandler.java @@ -0,0 +1,208 @@ +package com.hbm.handler.nei; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +import com.hbm.blocks.ModBlocks; +import com.hbm.config.CustomMachineConfigJSON; +import com.hbm.config.CustomMachineConfigJSON.MachineConfiguration; +import com.hbm.inventory.FluidStack; +import com.hbm.inventory.RecipesCommon.AStack; +import com.hbm.inventory.recipes.CustomMachineRecipes; +import com.hbm.inventory.recipes.CustomMachineRecipes.CustomMachineRecipe; +import com.hbm.items.machine.ItemFluidIcon; +import com.hbm.lib.RefStrings; +import com.hbm.util.ItemStackUtil; +import com.hbm.util.Tuple.Pair; + +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +public class CustomMachineHandler extends TemplateRecipeHandler { + + public LinkedList transferRectsRec = new LinkedList(); + public LinkedList> guiRec = new LinkedList>(); + + public MachineConfiguration conf; + + @Override + public TemplateRecipeHandler newInstance() { // brick by brick, suck my dick + try { + return new CustomMachineHandler(conf); + } catch(Exception e) { + throw new RuntimeException(e); + } + } + + public CustomMachineHandler(MachineConfiguration conf) { + super(); + this.conf = conf; + loadTransferRects(); + RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects); + } + + public class RecipeSet extends TemplateRecipeHandler.CachedRecipe { + + List inputs = new ArrayList(); + PositionedStack machine; + List outputs = new ArrayList(); + + public RecipeSet(CustomMachineRecipe recipe) { + + for(int i = 0; i < 3; i++) if(recipe.inputFluids.length > i) inputs.add(new PositionedStack(ItemFluidIcon.make(recipe.inputFluids[i]), 12 + i * 18, 6)); + for(int i = 0; i < 3; i++) if(recipe.inputItems.length > i) inputs.add(new PositionedStack(recipe.inputItems[i].extractForNEI(), 12 + i * 18, 24)); + for(int i = 3; i < 6; i++) if(recipe.inputItems.length > i) inputs.add(new PositionedStack(recipe.inputItems[i].extractForNEI(), 12 + i * 18, 42)); + + for(int i = 0; i < 3; i++) if(recipe.outputFluids.length > i) outputs.add(new PositionedStack(ItemFluidIcon.make(recipe.outputFluids[i]), 102 + i * 18, 6)); + + for(int i = 0; i < 3; i++) if(recipe.outputItems.length > i) { + Pair pair = recipe.outputItems[i]; + ItemStack out = pair.getKey(); + if(pair.getValue() != 1) { + ItemStackUtil.addTooltipToStack(out, EnumChatFormatting.RED + "" + (((int)(pair.getValue() * 1000)) / 10D) + "%"); + } + outputs.add(new PositionedStack(out, 102 + i * 18, 24)); + } + + for(int i = 3; i < 6; i++) if(recipe.outputItems.length > i) { + Pair pair = recipe.outputItems[i]; + ItemStack out = pair.getKey(); + if(pair.getValue() != 1) { + ItemStackUtil.addTooltipToStack(out, EnumChatFormatting.RED + "" + (((int)(pair.getValue() * 1000)) / 10D) + "%"); + } + outputs.add(new PositionedStack(out, 102 + i * 18, 42)); + } + + this.machine = new PositionedStack(new ItemStack(ModBlocks.custom_machine, 1, 100 + CustomMachineConfigJSON.niceList.indexOf(conf)), 75, 42); + } + + @Override + public List getIngredients() { + return getCycledIngredients(cycleticks / 20, inputs); + } + + @Override + public PositionedStack getResult() { + return outputs.get(0); + } + + @Override + public List getOtherStacks() { + List other = new ArrayList(); + other.addAll(inputs); + other.add(machine); + other.addAll(outputs); + return getCycledIngredients(cycleticks / 20, other); + } + } + + @Override + public String getRecipeName() { + return conf.localizedName; + } + + @Override + public String getGuiTexture() { + return RefStrings.MODID + ":textures/gui/nei/gui_nei_custom.png"; + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) { + + if(outputId.equals("ntm_" + conf.unlocalizedName)) { + + List recipes = CustomMachineRecipes.recipes.get(conf.recipeKey); + + if(recipes != null) for(CustomMachineRecipe recipe : recipes) { + this.arecipes.add(new RecipeSet(recipe)); + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(ItemStack result) { + + List recipes = CustomMachineRecipes.recipes.get(conf.recipeKey); + + System.out.println(conf.recipeKey); + + if(recipes != null) outer:for(CustomMachineRecipe recipe : recipes) { + + for(Pair stack : recipe.outputItems) { + + if(NEIServerUtils.areStacksSameTypeCrafting(stack.getKey(), result)) { + this.arecipes.add(new RecipeSet(recipe)); + continue outer; + } + } + + for(FluidStack fluid : recipe.outputFluids) { + ItemStack drop = ItemFluidIcon.make(fluid); + + if(compareFluidStacks(result, drop)) { + this.arecipes.add(new RecipeSet(recipe)); + continue outer; + } + } + } + } + + @Override + public void loadUsageRecipes(String inputId, Object... ingredients) { + + if(inputId.equals("ntm_" + conf.unlocalizedName)) { + loadCraftingRecipes("ntm_" + conf.unlocalizedName, new Object[0]); + } else { + super.loadUsageRecipes(inputId, ingredients); + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + + List recipes = CustomMachineRecipes.recipes.get(conf.recipeKey); + + if(recipes != null) outer:for(CustomMachineRecipe recipe : recipes) { + + for(AStack stack : recipe.inputItems) { + + List stacks = stack.extractForNEI(); + + for(ItemStack sta : stacks) { + if(NEIServerUtils.areStacksSameTypeCrafting(ingredient, sta)) { + this.arecipes.add(new RecipeSet(recipe)); + continue outer; + } + } + } + + for(FluidStack fluid : recipe.inputFluids) { + ItemStack drop = ItemFluidIcon.make(fluid); + + if(compareFluidStacks(ingredient, drop)) { + this.arecipes.add(new RecipeSet(recipe)); + continue outer; + } + } + } + } + + public static boolean compareFluidStacks(ItemStack sta1, ItemStack sta2) { + return sta1.getItem() == sta2.getItem() && sta1.getItemDamage() == sta2.getItemDamage(); + } + + @Override + public void loadTransferRects() { + if(this.conf == null) return; + transferRects.add(new RecipeTransferRect(new Rectangle(65, 23, 36, 18), "ntm_" + conf.unlocalizedName)); + RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects); + } +} diff --git a/src/main/java/com/hbm/interfaces/IControlReceiver.java b/src/main/java/com/hbm/interfaces/IControlReceiver.java index 74ff5d0c6..fe49fdf2e 100644 --- a/src/main/java/com/hbm/interfaces/IControlReceiver.java +++ b/src/main/java/com/hbm/interfaces/IControlReceiver.java @@ -10,6 +10,8 @@ import net.minecraft.nbt.NBTTagCompound; public interface IControlReceiver { public boolean hasPermission(EntityPlayer player); - + public void receiveControl(NBTTagCompound data); + /* this was the easiest way of doing this without needing to change all 7 quadrillion implementors */ + public default void receiveControl(EntityPlayer player, NBTTagCompound data) { } } diff --git a/src/main/java/com/hbm/inventory/container/ContainerElectrolyserFluid.java b/src/main/java/com/hbm/inventory/container/ContainerElectrolyserFluid.java new file mode 100644 index 000000000..d52d54c24 --- /dev/null +++ b/src/main/java/com/hbm/inventory/container/ContainerElectrolyserFluid.java @@ -0,0 +1,54 @@ +package com.hbm.inventory.container; + +import com.hbm.inventory.SlotTakeOnly; +import com.hbm.tileentity.machine.TileEntityElectrolyser; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; + +public class ContainerElectrolyserFluid extends Container { + + private TileEntityElectrolyser electrolyser; + + public ContainerElectrolyserFluid(InventoryPlayer invPlayer, TileEntityElectrolyser tedf) { + electrolyser = tedf; + + //Battery + this.addSlotToContainer(new Slot(tedf, 0, 186, 109)); + //Upgrades + this.addSlotToContainer(new Slot(tedf, 1, 186, 140)); + this.addSlotToContainer(new Slot(tedf, 2, 186, 158)); + //Fluid ID + this.addSlotToContainer(new Slot(tedf, 3, 6, 18)); + this.addSlotToContainer(new SlotTakeOnly(tedf, 4, 6, 54)); + //Input + this.addSlotToContainer(new Slot(tedf, 5, 24, 18)); + this.addSlotToContainer(new SlotTakeOnly(tedf, 6, 24, 54)); + //Output + this.addSlotToContainer(new Slot(tedf, 7, 78, 18)); + this.addSlotToContainer(new SlotTakeOnly(tedf, 8, 78, 54)); + this.addSlotToContainer(new Slot(tedf, 9, 134, 18)); + this.addSlotToContainer(new SlotTakeOnly(tedf, 10, 134, 54)); + //Byproducts + this.addSlotToContainer(new SlotTakeOnly(tedf, 11, 154, 18)); + this.addSlotToContainer(new SlotTakeOnly(tedf, 12, 154, 36)); + this.addSlotToContainer(new SlotTakeOnly(tedf, 13, 154, 54)); + + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 9; j++) { + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 122 + i * 18)); + } + } + + for(int i = 0; i < 9; i++) { + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 180)); + } + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return electrolyser.isUseableByPlayer(player); + } +} diff --git a/src/main/java/com/hbm/inventory/container/ContainerElectrolyserMetal.java b/src/main/java/com/hbm/inventory/container/ContainerElectrolyserMetal.java new file mode 100644 index 000000000..881f1382c --- /dev/null +++ b/src/main/java/com/hbm/inventory/container/ContainerElectrolyserMetal.java @@ -0,0 +1,48 @@ +package com.hbm.inventory.container; + +import com.hbm.inventory.SlotCraftingOutput; +import com.hbm.tileentity.machine.TileEntityElectrolyser; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; + +public class ContainerElectrolyserMetal extends Container { + + private TileEntityElectrolyser electrolyser; + + public ContainerElectrolyserMetal(InventoryPlayer invPlayer, TileEntityElectrolyser tedf) { + electrolyser = tedf; + + //Battery + this.addSlotToContainer(new Slot(tedf, 0, 186, 109)); + //Upgrades + this.addSlotToContainer(new Slot(tedf, 1, 186, 140)); + this.addSlotToContainer(new Slot(tedf, 2, 186, 158)); + //Input + this.addSlotToContainer(new Slot(tedf, 14, 10, 22)); + //Outputs + this.addSlotToContainer(new SlotCraftingOutput(invPlayer.player, tedf, 15, 136, 18)); + this.addSlotToContainer(new SlotCraftingOutput(invPlayer.player, tedf, 16, 154, 18)); + this.addSlotToContainer(new SlotCraftingOutput(invPlayer.player, tedf, 17, 136, 36)); + this.addSlotToContainer(new SlotCraftingOutput(invPlayer.player, tedf, 18, 154, 36)); + this.addSlotToContainer(new SlotCraftingOutput(invPlayer.player, tedf, 19, 136, 54)); + this.addSlotToContainer(new SlotCraftingOutput(invPlayer.player, tedf, 20, 154, 54)); + + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 9; j++) { + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 122 + i * 18)); + } + } + + for(int i = 0; i < 9; i++) { + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 180)); + } + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return electrolyser.isUseableByPlayer(player); + } +} diff --git a/src/main/java/com/hbm/inventory/gui/GUIElectrolyserFluid.java b/src/main/java/com/hbm/inventory/gui/GUIElectrolyserFluid.java new file mode 100644 index 000000000..fa4964eed --- /dev/null +++ b/src/main/java/com/hbm/inventory/gui/GUIElectrolyserFluid.java @@ -0,0 +1,80 @@ +package com.hbm.inventory.gui; + +import org.lwjgl.opengl.GL11; + +import com.hbm.inventory.container.ContainerElectrolyserFluid; +import com.hbm.lib.RefStrings; +import com.hbm.packet.NBTControlPacket; +import com.hbm.packet.PacketDispatcher; +import com.hbm.tileentity.machine.TileEntityElectrolyser; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; + +public class GUIElectrolyserFluid extends GuiInfoContainer { + + public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_electrolyser_fluid.png"); + private TileEntityElectrolyser electrolyser; + + public GUIElectrolyserFluid(InventoryPlayer invPlayer, TileEntityElectrolyser electrolyser) { + super(new ContainerElectrolyserFluid(invPlayer, electrolyser)); + this.electrolyser = electrolyser; + + this.xSize = 210; + this.ySize = 204; + } + + @Override + public void drawScreen(int mouseX, int mouseY, float f) { + super.drawScreen(mouseX, mouseY, f); + + electrolyser.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 42, guiTop + 18, 16, 52); + electrolyser.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 96, guiTop + 18, 16, 52); + electrolyser.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 116, guiTop + 18, 16, 52); + + this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 186, guiTop + 18, 16, 89, electrolyser.power, electrolyser.maxPower); + } + + protected void mouseClicked(int x, int y, int i) { + super.mouseClicked(x, y, i); + + if(guiLeft + 8 <= x && guiLeft + 8 + 54 > x && guiTop + 82 < y && guiTop + 82 + 12 >= y) { + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + NBTTagCompound data = new NBTTagCompound(); + data.setBoolean("sgm", true); + PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, electrolyser.xCoord, electrolyser.yCoord, electrolyser.zCoord)); + } + } + + @Override + protected void drawGuiContainerForegroundLayer(int i, int j) { + String name = this.electrolyser.hasCustomInventoryName() ? this.electrolyser.getInventoryName() : I18n.format(this.electrolyser.getInventoryName()); + + this.fontRendererObj.drawString(name, (this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2) - 16, 7, 0xffffff); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 94, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + + int p = (int) (electrolyser.power * 89 / electrolyser.maxPower); + drawTexturedModalRect(guiLeft + 186, guiTop + 107 - p, 210, 89 - p, 16, p); + + if(electrolyser.power >= electrolyser.usage) + drawTexturedModalRect(guiLeft + 190, guiTop + 4, 226, 40, 9, 12); + + int e = electrolyser.progressFluid * 41 / electrolyser.processFluidTime; + drawTexturedModalRect(guiLeft + 62, guiTop + 26, 226, 0, 12, e); + + electrolyser.tanks[0].renderTank(guiLeft + 42, guiTop + 70, this.zLevel, 16, 52); + electrolyser.tanks[1].renderTank(guiLeft + 96, guiTop + 70, this.zLevel, 16, 52); + electrolyser.tanks[2].renderTank(guiLeft + 116, guiTop + 70, this.zLevel, 16, 52); + } +} diff --git a/src/main/java/com/hbm/inventory/gui/GUIElectrolyserMetal.java b/src/main/java/com/hbm/inventory/gui/GUIElectrolyserMetal.java new file mode 100644 index 000000000..e63e67df2 --- /dev/null +++ b/src/main/java/com/hbm/inventory/gui/GUIElectrolyserMetal.java @@ -0,0 +1,67 @@ +package com.hbm.inventory.gui; + +import org.lwjgl.opengl.GL11; + +import com.hbm.inventory.container.ContainerElectrolyserMetal; +import com.hbm.lib.RefStrings; +import com.hbm.packet.NBTControlPacket; +import com.hbm.packet.PacketDispatcher; +import com.hbm.tileentity.machine.TileEntityElectrolyser; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; + +public class GUIElectrolyserMetal extends GuiInfoContainer { + + public static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_electrolyser_metal.png"); + private TileEntityElectrolyser electrolyser; + + public GUIElectrolyserMetal(InventoryPlayer invPlayer, TileEntityElectrolyser electrolyser) { + super(new ContainerElectrolyserMetal(invPlayer, electrolyser)); + this.electrolyser = electrolyser; + + this.xSize = 210; + this.ySize = 204; + } + + @Override + public void drawScreen(int mouseX, int mouseY, float f) { + super.drawScreen(mouseX, mouseY, f); + + electrolyser.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 36, guiTop + 18, 16, 52); + + this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 186, guiTop + 18, 16, 89, electrolyser.power, electrolyser.maxPower); + } + + protected void mouseClicked(int x, int y, int i) { + super.mouseClicked(x, y, i); + + if(guiLeft + 8 <= x && guiLeft + 8 + 54 > x && guiTop + 82 < y && guiTop + 82 + 12 >= y) { + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + NBTTagCompound data = new NBTTagCompound(); + data.setBoolean("sgf", true); + PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, electrolyser.xCoord, electrolyser.yCoord, electrolyser.zCoord)); + } + } + + @Override + protected void drawGuiContainerForegroundLayer(int i, int j) { + String name = this.electrolyser.hasCustomInventoryName() ? this.electrolyser.getInventoryName() : I18n.format(this.electrolyser.getInventoryName()); + + this.fontRendererObj.drawString(name, (this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2) - 16, 7, 0xffffff); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 94, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + + electrolyser.tanks[3].renderTank(guiLeft + 36, guiTop + 70, this.zLevel, 16, 52); + } +} diff --git a/src/main/java/com/hbm/inventory/recipes/ElectrolyserFluidRecipes.java b/src/main/java/com/hbm/inventory/recipes/ElectrolyserFluidRecipes.java new file mode 100644 index 000000000..5a61fb756 --- /dev/null +++ b/src/main/java/com/hbm/inventory/recipes/ElectrolyserFluidRecipes.java @@ -0,0 +1,67 @@ +package com.hbm.inventory.recipes; + +import java.io.IOException; +import java.util.HashMap; + +import com.google.gson.JsonElement; +import com.google.gson.stream.JsonWriter; +import com.hbm.inventory.FluidStack; +import com.hbm.inventory.fluid.FluidType; +import com.hbm.inventory.fluid.Fluids; +import com.hbm.inventory.recipes.loader.SerializableRecipe; +import com.hbm.items.ModItems; + +import net.minecraft.item.ItemStack; + +public class ElectrolyserFluidRecipes extends SerializableRecipe { + + public static HashMap recipes = new HashMap(); + + @Override + public void registerDefaults() { + recipes.put(Fluids.WATER, new ElectrolysisRecipe(1_000, new FluidStack(Fluids.HYDROGEN, 100), new FluidStack(Fluids.OXYGEN, 100))); + recipes.put(Fluids.HEAVYWATER, new ElectrolysisRecipe(1_000, new FluidStack(Fluids.DEUTERIUM, 50), new FluidStack(Fluids.OXYGEN, 50))); + + recipes.put(Fluids.POTASSIUM_CHLORIDE, new ElectrolysisRecipe(250, new FluidStack(Fluids.CHLORINE, 125), new FluidStack(Fluids.NONE, 0), new ItemStack(ModItems.dust))); + recipes.put(Fluids.CALCIUM_CHLORIDE, new ElectrolysisRecipe(250, new FluidStack(Fluids.CHLORINE, 125), new FluidStack(Fluids.CALCIUM_SOLUTION, 125))); + } + + @Override + public String getFileName() { + return "hbmElectrolyzerFluid.json"; + } + + @Override + public Object getRecipeObject() { + return recipes; + } + + @Override + public void deleteRecipes() { + recipes.clear(); + } + + @Override + public void readRecipe(JsonElement recipe) { + + } + + @Override + public void writeRecipe(Object recipe, JsonWriter writer) throws IOException { + + } + + public static class ElectrolysisRecipe { + public FluidStack output1; + public FluidStack output2; + public int amount; + public ItemStack[] byproduct; + + public ElectrolysisRecipe(int amount, FluidStack output1, FluidStack output2, ItemStack... byproduct) { + this.output1 = output1; + this.output2 = output2; + this.amount = amount; + this.byproduct = byproduct; + } + } +} diff --git a/src/main/java/com/hbm/inventory/recipes/ElectrolyserMetalRecipes.java b/src/main/java/com/hbm/inventory/recipes/ElectrolyserMetalRecipes.java new file mode 100644 index 000000000..40b3555c7 --- /dev/null +++ b/src/main/java/com/hbm/inventory/recipes/ElectrolyserMetalRecipes.java @@ -0,0 +1,58 @@ +package com.hbm.inventory.recipes; + +import java.io.IOException; +import java.util.HashMap; + +import com.google.gson.JsonElement; +import com.google.gson.stream.JsonWriter; +import com.hbm.inventory.RecipesCommon.AStack; +import com.hbm.inventory.material.Mats.MaterialStack; +import com.hbm.inventory.recipes.loader.SerializableRecipe; + +import net.minecraft.item.ItemStack; + +public class ElectrolyserMetalRecipes extends SerializableRecipe { + + public static HashMap recipes = new HashMap(); + + @Override + public void registerDefaults() { + + } + + public static ElectrolysisMetalRecipe getRecipe(ItemStack stack) { + return null; + } + + @Override + public String getFileName() { + return "hbmElectrolyzerMetal.json"; + } + + @Override + public Object getRecipeObject() { + return recipes; + } + + @Override + public void deleteRecipes() { + recipes.clear(); + } + + @Override + public void readRecipe(JsonElement recipe) { + + } + + @Override + public void writeRecipe(Object recipe, JsonWriter writer) throws IOException { + + } + + public static class ElectrolysisMetalRecipe { + + public MaterialStack output1; + public MaterialStack output2; + public ItemStack[] byproducts; + } +} diff --git a/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java b/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java index c719bd86c..c2252db37 100644 --- a/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java +++ b/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java @@ -62,6 +62,8 @@ public abstract class SerializableRecipe { recipeHandlers.add(new MixerRecipes()); recipeHandlers.add(new OutgasserRecipes()); recipeHandlers.add(new CompressorRecipes()); + recipeHandlers.add(new ElectrolyserFluidRecipes()); + recipeHandlers.add(new MatDistribution()); recipeHandlers.add(new CustomMachineRecipes()); } diff --git a/src/main/java/com/hbm/items/block/ItemCustomMachine.java b/src/main/java/com/hbm/items/block/ItemCustomMachine.java index 434b61c06..61b1cf00c 100644 --- a/src/main/java/com/hbm/items/block/ItemCustomMachine.java +++ b/src/main/java/com/hbm/items/block/ItemCustomMachine.java @@ -12,7 +12,6 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; public class ItemCustomMachine extends ItemBlock { @@ -24,10 +23,7 @@ public class ItemCustomMachine extends ItemBlock { public void getSubItems(Item item, CreativeTabs tab, List list) { for(int i = 0; i < CustomMachineConfigJSON.niceList.size(); i++) { - MachineConfiguration conf = CustomMachineConfigJSON.niceList.get(i); ItemStack stack = new ItemStack(item, 1, i + 100); - stack.stackTagCompound = new NBTTagCompound(); - stack.stackTagCompound.setString("machineType", conf.unlocalizedName); list.add(stack); } } @@ -35,15 +31,14 @@ public class ItemCustomMachine extends ItemBlock { @Override public String getItemStackDisplayName(ItemStack stack) { - if(stack.hasTagCompound()) { - String name = stack.getTagCompound().getString("machineType"); - MachineConfiguration conf = CustomMachineConfigJSON.customMachines.get(name); + int id = stack.getItemDamage() - 100; + + if(id >= 0 && id < CustomMachineConfigJSON.customMachines.size()) { + MachineConfiguration conf = CustomMachineConfigJSON.niceList.get(id); if(conf != null) { return conf.localizedName; } - - return "INVALID MACHINE CONTROLLER (" + name + ")"; } return "INVALID MACHINE CONTROLLER"; diff --git a/src/main/java/com/hbm/lib/HbmWorldGen.java b/src/main/java/com/hbm/lib/HbmWorldGen.java index 6d2af30ab..323e01b0c 100644 --- a/src/main/java/com/hbm/lib/HbmWorldGen.java +++ b/src/main/java/com/hbm/lib/HbmWorldGen.java @@ -116,14 +116,15 @@ public class HbmWorldGen implements IWorldGenerator { if(WorldConfig.alexandriteSpawn > 0 && rand.nextInt(WorldConfig.alexandriteSpawn) == 0) DungeonToolbox.generateOre(world, rand, i, j, 1, 3, 10, 5, ModBlocks.ore_alexandrite); - DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.6D, ModBlocks.cluster_depth_iron, rand, 24); - DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.6D, ModBlocks.cluster_depth_titanium, rand, 32); - DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.6D, ModBlocks.cluster_depth_tungsten, rand, 32); - DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.8D, ModBlocks.ore_depth_cinnebar, rand, 16); - DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.8D, ModBlocks.ore_depth_zirconium, rand, 16); - DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.8D, ModBlocks.ore_depth_borax, rand, 16); - if(WorldConfig.overworldOre) { + + DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.6D, ModBlocks.cluster_depth_iron, rand, 24); + DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.6D, ModBlocks.cluster_depth_titanium, rand, 32); + DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.6D, ModBlocks.cluster_depth_tungsten, rand, 32); + DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.8D, ModBlocks.ore_depth_cinnebar, rand, 16); + DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.8D, ModBlocks.ore_depth_zirconium, rand, 16); + DepthDeposit.generateConditionOverworld(world, i, 0, 3, j, 5, 0.8D, ModBlocks.ore_depth_borax, rand, 16); + DungeonToolbox.generateOre(world, rand, i, j, 25, 6, 30, 10, ModBlocks.ore_gneiss_iron, ModBlocks.stone_gneiss); DungeonToolbox.generateOre(world, rand, i, j, 10, 6, 30, 10, ModBlocks.ore_gneiss_gold, ModBlocks.stone_gneiss); DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.uraniumSpawn * 3, 6, 30, 10, ModBlocks.ore_gneiss_uranium, ModBlocks.stone_gneiss); @@ -721,10 +722,18 @@ public class HbmWorldGen implements IWorldGenerator { if(GeneralConfig.enablePlutoniumOre) DungeonToolbox.generateOre(world, rand, i, j, WorldConfig.netherPlutoniumSpawn, 4, 0, 127, ModBlocks.ore_nether_plutonium, Blocks.netherrack); - } + + if(rand.nextInt(10) == 0) { + WeightedRandomGeneric item = (WeightedRandomGeneric) WeightedRandom.getRandomItem(rand, BedrockOre.weightedOresNether); + BedrockOreDefinition def = item.get(); + int randPosX = i + rand.nextInt(2) + 8; + int randPosZ = j + rand.nextInt(2) + 8; + BedrockOre.generate(world, randPosX, randPosZ, def.stack, def.acid, def.color, def.tier, ModBlocks.stone_depth_nether); + } - DepthDeposit.generateConditionNether(world, i, 0, 3, j, 7, 0.6D, ModBlocks.ore_depth_nether_neodymium, rand, 16); - DepthDeposit.generateConditionNether(world, i, 125, 3, j, 7, 0.6D, ModBlocks.ore_depth_nether_neodymium, rand, 16); + DepthDeposit.generateConditionNether(world, i, 0, 3, j, 7, 0.6D, ModBlocks.ore_depth_nether_neodymium, rand, 16); + DepthDeposit.generateConditionNether(world, i, 125, 3, j, 7, 0.6D, ModBlocks.ore_depth_nether_neodymium, rand, 16); + } for(int k = 0; k < 30; k++){ int x = i + rand.nextInt(16); diff --git a/src/main/java/com/hbm/main/NEIConfig.java b/src/main/java/com/hbm/main/NEIConfig.java index d0d0fa102..c5bc758a2 100644 --- a/src/main/java/com/hbm/main/NEIConfig.java +++ b/src/main/java/com/hbm/main/NEIConfig.java @@ -4,6 +4,8 @@ import java.util.List; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockMotherOfAllOres.TileEntityRandomOre; +import com.hbm.config.CustomMachineConfigJSON; +import com.hbm.config.CustomMachineConfigJSON.MachineConfiguration; import com.hbm.config.VersatileConfig; import com.hbm.handler.nei.*; import com.hbm.items.ModItems; @@ -14,6 +16,8 @@ import codechicken.nei.api.API; import codechicken.nei.api.IConfigureNEI; import codechicken.nei.api.IHighlightHandler; import codechicken.nei.api.ItemInfo.Layout; +import codechicken.nei.recipe.GuiCraftingRecipe; +import codechicken.nei.recipe.GuiUsageRecipe; import codechicken.nei.recipe.ICraftingHandler; import codechicken.nei.recipe.IUsageHandler; import net.minecraft.entity.player.EntityPlayer; @@ -69,6 +73,8 @@ public class NEIConfig implements IConfigureNEI { registerHandler(new SawmillHandler()); registerHandler(new MixerHandler()); registerHandler(new OutgasserHandler()); + + for(MachineConfiguration conf : CustomMachineConfigJSON.niceList) registerHandlerBypass(new CustomMachineHandler(conf)); //fluids registerHandler(new FluidRecipeHandler()); @@ -153,6 +159,12 @@ public class NEIConfig implements IConfigureNEI { API.registerRecipeHandler((ICraftingHandler) o); API.registerUsageHandler((IUsageHandler) o); } + + /** Bypasses the utterly useless restriction of one registered handler per class */ + public static void registerHandlerBypass(Object o) { + GuiCraftingRecipe.craftinghandlers.add((ICraftingHandler) o); + GuiUsageRecipe.usagehandlers.add((IUsageHandler) o); + } @Override public String getName() { diff --git a/src/main/java/com/hbm/packet/NBTControlPacket.java b/src/main/java/com/hbm/packet/NBTControlPacket.java index 8ce47aa3c..226b3eae1 100644 --- a/src/main/java/com/hbm/packet/NBTControlPacket.java +++ b/src/main/java/com/hbm/packet/NBTControlPacket.java @@ -32,7 +32,6 @@ public class NBTControlPacket implements IMessage { try { buffer.writeNBTTagCompoundToBuffer(nbt); - } catch (IOException e) { e.printStackTrace(); } @@ -45,9 +44,8 @@ public class NBTControlPacket implements IMessage { y = buf.readInt(); z = buf.readInt(); - if (buffer == null) { - buffer = new PacketBuffer(Unpooled.buffer()); - } + if(buffer == null) buffer = new PacketBuffer(Unpooled.buffer()); + buffer.writeBytes(buf); } @@ -58,9 +56,8 @@ public class NBTControlPacket implements IMessage { buf.writeInt(y); buf.writeInt(z); - if (buffer == null) { - buffer = new PacketBuffer(Unpooled.buffer()); - } + if (buffer == null) buffer = new PacketBuffer(Unpooled.buffer()); + buf.writeBytes(buffer); } @@ -85,8 +82,10 @@ public class NBTControlPacket implements IMessage { IControlReceiver tile = (IControlReceiver)te; - if(tile.hasPermission(p)) + if(tile.hasPermission(p)) { + tile.receiveControl(p, nbt); tile.receiveControl(nbt); + } } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityElectrolyser.java b/src/main/java/com/hbm/tileentity/machine/TileEntityElectrolyser.java index c2eb12a1a..0550dddc0 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityElectrolyser.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityElectrolyser.java @@ -1,32 +1,40 @@ package com.hbm.tileentity.machine; -import java.util.ArrayList; -import java.util.List; - -import com.hbm.blocks.BlockDummyable; -import com.hbm.interfaces.IFluidAcceptor; -import com.hbm.interfaces.IFluidSource; -import com.hbm.inventory.container.ContainerElectrolyser; -import com.hbm.inventory.fluid.FluidType; +import com.hbm.interfaces.IControlReceiver; +import com.hbm.inventory.UpgradeManager; +import com.hbm.inventory.container.ContainerElectrolyserFluid; +import com.hbm.inventory.container.ContainerElectrolyserMetal; import com.hbm.inventory.fluid.Fluids; import com.hbm.inventory.fluid.tank.FluidTank; -import com.hbm.inventory.gui.GUIElectrolyser; -import com.hbm.lib.Library; +import com.hbm.inventory.gui.GUIElectrolyserFluid; +import com.hbm.inventory.gui.GUIElectrolyserMetal; +import com.hbm.inventory.material.MaterialShapes; +import com.hbm.inventory.material.Mats.MaterialStack; +import com.hbm.inventory.recipes.ElectrolyserFluidRecipes; +import com.hbm.inventory.recipes.ElectrolyserFluidRecipes.ElectrolysisRecipe; +import com.hbm.inventory.recipes.ElectrolyserMetalRecipes; +import com.hbm.items.machine.ItemMachineUpgrade.UpgradeType; +import com.hbm.main.MainRegistry; import com.hbm.tileentity.IGUIProvider; 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.common.network.internal.FMLNetworkHandler; 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.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityElectrolyser extends TileEntityMachineBase implements IEnergyUser, IFluidSource, IFluidAcceptor, IGUIProvider /* TODO: new fluid API */ { +public class TileEntityElectrolyser extends TileEntityMachineBase implements IEnergyUser, IFluidStandardTransceiver, IControlReceiver, IGUIProvider { public long power; public static final long maxPower = 20000000; @@ -39,15 +47,45 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn public int progressOre; public static final int processOreTimeBase = 1000; public int processOreTime; + + public MaterialStack leftStack; + public MaterialStack rightStack; + public int maxMaterial = MaterialShapes.BLOCK.q(16); public FluidTank[] tanks; public TileEntityElectrolyser() { - super(24); - tanks = new FluidTank[3]; - tanks[0] = new FluidTank(Fluids.WATER, 16000, 0); - tanks[1] = new FluidTank(Fluids.HYDROGEN, 16000, 1); - tanks[2] = new FluidTank(Fluids.OXYGEN, 16000, 2); + //0: Battery + //1-2: Upgrades + //// FLUID + //3-4: Fluid ID + //5-10: Fluid IO + //11-13: Byproducts + //// METAL + //14: Crystal + //15-20: Outputs + super(21); + tanks = new FluidTank[4]; + tanks[0] = new FluidTank(Fluids.WATER, 16000); + tanks[1] = new FluidTank(Fluids.HYDROGEN, 16000); + tanks[2] = new FluidTank(Fluids.OXYGEN, 16000); + tanks[3] = new FluidTank(Fluids.NITRIC_ACID, 16000); + } + + @Override + public int[] getAccessibleSlotsFromSide(int meta) { + return new int[] { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; + } + + @Override + public boolean isItemValidForSlot(int i, ItemStack itemStack) { + if(i == 14) return ElectrolyserMetalRecipes.getRecipe(itemStack) != null; + return false; + } + + @Override + public boolean canExtractItem(int i, ItemStack itemStack, int j) { + return i != 14; } @Override @@ -60,8 +98,40 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn if(!worldObj.isRemote) { - this.tanks[0].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId); + this.tanks[0].setType(3, 4, slots); + this.tanks[0].loadTank(5, 6, slots); + this.tanks[1].unloadTank(7, 8, slots); + this.tanks[2].unloadTank(9, 10, slots); + if(worldObj.getTotalWorldTime() % 20 == 0) { + for(DirPos pos : this.getConPos()) { + this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + this.trySubscribe(tanks[0].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + this.trySubscribe(tanks[3].getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + + if(tanks[1].getFill() > 0) this.sendFluid(tanks[1], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + if(tanks[2].getFill() > 0) this.sendFluid(tanks[2], worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + } + } + + UpgradeManager.eval(slots, 1, 2); + int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3); + int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3); + + processFluidTime = processFluidTimeBase - processFluidTimeBase * speedLevel / 4; + processOreTime = processOreTimeBase - processOreTimeBase * speedLevel / 4; + usage = usageBase - usageBase * powerLevel / 4; + + if(this.canProcessFluid()) { + this.progressFluid++; + this.power -= this.usage; + + if(this.progressFluid >= this.processFluidTime) { + this.processFluids(); + this.progressFluid = 0; + this.markChanged(); + } + } NBTTagCompound data = new NBTTagCompound(); data.setLong("power", this.power); @@ -70,25 +140,84 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn data.setInteger("usage", this.usage); data.setInteger("processFluidTime", this.processFluidTime); data.setInteger("processOreTime", this.processOreTime); + for(int i = 0; i < 4; i++) tanks[i].writeToNBT(data, "t" + i); this.networkPack(data, 50); - - fillFluidInit(tanks[1].getTankType()); - fillFluidInit(tanks[2].getTankType()); } - } - @Override - public void fillFluidInit(FluidType type) { - - ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset); + public DirPos[] getConPos() { + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); + + return new DirPos[] { + new DirPos(xCoord - dir.offsetX * 6, yCoord, zCoord - dir.offsetZ * 6, dir.getOpposite()), + new DirPos(xCoord - dir.offsetX * 6 + rot.offsetX, yCoord, zCoord - dir.offsetZ * 6 + rot.offsetZ, dir.getOpposite()), + new DirPos(xCoord - dir.offsetX * 6 - rot.offsetX, yCoord, zCoord - dir.offsetZ * 6 - rot.offsetZ, dir.getOpposite()), + new DirPos(xCoord + dir.offsetX * 6, yCoord, zCoord + dir.offsetZ * 6, dir), + new DirPos(xCoord + dir.offsetX * 6 + rot.offsetX, yCoord, zCoord + dir.offsetZ * 6 + rot.offsetZ, dir), + new DirPos(xCoord + dir.offsetX * 6 - rot.offsetX, yCoord, zCoord + dir.offsetZ * 6 - rot.offsetZ, dir) + }; + } - fillFluid(xCoord + dir.offsetX * 5 + rot.offsetX * -1, yCoord-1, zCoord + dir.offsetZ * 5 + rot.offsetZ * -1, getTact(), type); - fillFluid(xCoord + dir.offsetX * 5 + rot.offsetX * -1, yCoord-1, zCoord + dir.offsetZ * 5 + rot.offsetZ * 1, getTact(), type); - fillFluid(xCoord + dir.offsetX * -5 + rot.offsetX * -1, yCoord-1, zCoord + dir.offsetZ * 5 + rot.offsetZ * -1, getTact(), type); - fillFluid(xCoord + dir.offsetX * -5 + rot.offsetX * -1, yCoord-1, zCoord + dir.offsetZ * 5 + rot.offsetZ * 1, getTact(), type); - + @Override + public void networkUnpack(NBTTagCompound nbt) { + this.power = nbt.getLong("power"); + this.progressFluid = nbt.getInteger("progressFluid"); + this.progressOre = nbt.getInteger("progressOre"); + this.usage = nbt.getInteger("usage"); + this.processFluidTime = nbt.getInteger("processFluidTime"); + this.processOreTime = nbt.getInteger("processOreTime"); + for(int i = 0; i < 4; i++) tanks[i].readFromNBT(nbt, "t" + i); + } + + public boolean canProcessFluid() { + + if(this.power < usage) return false; + + ElectrolysisRecipe recipe = ElectrolyserFluidRecipes.recipes.get(tanks[0].getTankType()); + + if(recipe == null) return false; + if(recipe.amount > tanks[0].getFill()) return false; + if(recipe.output1.type == tanks[1].getTankType() && recipe.output1.fill + tanks[1].getFill() > tanks[1].getMaxFill()) return false; + if(recipe.output2.type == tanks[2].getTankType() && recipe.output2.fill + tanks[2].getFill() > tanks[2].getMaxFill()) return false; + + if(recipe.byproduct != null) { + + for(int i = 0; i < recipe.byproduct.length; i++) { + ItemStack slot = slots[11 + i]; + ItemStack byproduct = recipe.byproduct[i]; + + if(slot == null) continue; + if(!slot.isItemEqual(byproduct)) return false; + if(slot.stackSize + byproduct.stackSize > slot.getMaxStackSize()) return false; + } + } + + return true; + } + + public void processFluids() { + + ElectrolysisRecipe recipe = ElectrolyserFluidRecipes.recipes.get(tanks[0].getTankType()); + tanks[0].setFill(tanks[0].getFill() - recipe.amount); + tanks[1].setTankType(recipe.output1.type); + tanks[2].setTankType(recipe.output2.type); + tanks[1].setFill(tanks[1].getFill() + recipe.output1.fill); + tanks[2].setFill(tanks[2].getFill() + recipe.output2.fill); + + if(recipe.byproduct != null) { + + for(int i = 0; i < recipe.byproduct.length; i++) { + ItemStack slot = slots[11 + i]; + ItemStack byproduct = recipe.byproduct[i]; + + if(slot == null) { + slots[11 + i] = byproduct.copy(); + } else { + slots[11 + i].stackSize += byproduct.stackSize; + } + } + } } AxisAlignedBB bb = null; @@ -98,12 +227,12 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn if(bb == null) { bb = AxisAlignedBB.getBoundingBox( - xCoord - 3, + xCoord - 5, yCoord - 0, - zCoord - 4, - xCoord + 3, + zCoord - 5, + xCoord + 6, yCoord + 4, - zCoord + 4 + zCoord + 6 ); } @@ -126,79 +255,53 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn return maxPower; } - @Override - public void setFillForSync(int fill, int index) { - tanks[index].setFill(fill); - - } - - @Override - public void setFluidFill(int fill, FluidType type) { - for(int i = 0; i < 3; i++) { - if(type == tanks[i].getTankType()) - tanks[i].setFill(fill); - } - - } - - @Override - public void setTypeForSync(FluidType type, int index) { - tanks[index].setTankType(type); - - } - - @Override - public int getFluidFill(FluidType type) { - for(int i = 0; i < 3; i++) { - if(type == tanks[i].getTankType() && tanks[i].getFill() != 0) - return tanks[i].getFill(); - } - return 0; - } - - @Override - public int getMaxFluidFill(FluidType type) { - for(int i = 0; i < 3; i++) { - if(type == tanks[i].getTankType() && tanks[i].getMaxFill() != 0) - return tanks[i].getMaxFill(); - } - return 0; - } - - @Override - public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) { - Library.transmitFluid(x, y, z, newTact, this, worldObj, type); - } - - @Override - public boolean getTact() { - return worldObj.getTotalWorldTime() % 20 < 10; - } - - @Override - public List getFluidList(FluidType type) { - return new ArrayList(); - } - - @Override - public void clearFluidList(FluidType type) { - return; - } - @Override public void setPower(long power) { this.power = power; } + @Override + public FluidTank[] getAllTanks() { + return tanks; + } + + @Override + public FluidTank[] getSendingTanks() { + return new FluidTank[] {tanks[1], tanks[2]}; + } + + @Override + public FluidTank[] getReceivingTanks() { + return new FluidTank[] {tanks[0], tanks[3]}; + } + @Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { - return new ContainerElectrolyser(player.inventory, this); + if(ID == 0) return new ContainerElectrolyserFluid(player.inventory, this); + return new ContainerElectrolyserMetal(player.inventory, this); } @Override @SideOnly(Side.CLIENT) public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { - return new GUIElectrolyser(player.inventory, this); + if(ID == 0) return new GUIElectrolyserFluid(player.inventory, this); + return new GUIElectrolyserMetal(player.inventory, this); } + @Override + public void receiveControl(NBTTagCompound data) { + + } + + @Override + public void receiveControl(EntityPlayer player, NBTTagCompound data) { + + if(data.hasKey("sgm")) FMLNetworkHandler.openGui(player, MainRegistry.instance, 1, worldObj, xCoord, yCoord, zCoord); + if(data.hasKey("sgf")) FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, worldObj, xCoord, yCoord, zCoord); + } + + @Override + public boolean hasPermission(EntityPlayer player) { + return this.isUseableByPlayer(player); + } } diff --git a/src/main/java/com/hbm/world/feature/BedrockOre.java b/src/main/java/com/hbm/world/feature/BedrockOre.java index cce83e8ec..15077d50f 100644 --- a/src/main/java/com/hbm/world/feature/BedrockOre.java +++ b/src/main/java/com/hbm/world/feature/BedrockOre.java @@ -20,33 +20,41 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class BedrockOre { - + public static List> weightedOres = new ArrayList(); + public static List> weightedOresNether = new ArrayList(); public static void init() { - registerBedrockOre(new BedrockOreDefinition(EnumBedrockOre.IRON, 1), WorldConfig.bedrockIronSpawn); - registerBedrockOre(new BedrockOreDefinition(EnumBedrockOre.COPPER, 1), WorldConfig.bedrockCopperSpawn); - registerBedrockOre(new BedrockOreDefinition(EnumBedrockOre.BORAX, 3, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockBoraxSpawn); - registerBedrockOre(new BedrockOreDefinition(EnumBedrockOre.CHLOROCALCITE, 3, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockChlorocalciteSpawn); - registerBedrockOre(new BedrockOreDefinition(EnumBedrockOre.ASBESTOS, 2), WorldConfig.bedrockAsbestosSpawn); - registerBedrockOre(new BedrockOreDefinition(EnumBedrockOre.NIOBIUM, 2, new FluidStack(Fluids.ACID, 500)), WorldConfig.bedrockNiobiumSpawn); - registerBedrockOre(new BedrockOreDefinition(EnumBedrockOre.TITANIUM, 2, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockTitaniumSpawn); - registerBedrockOre(new BedrockOreDefinition(EnumBedrockOre.TUNGSTEN, 2, new FluidStack(Fluids.ACID, 500)), WorldConfig.bedrockTungstenSpawn); - registerBedrockOre(new BedrockOreDefinition(EnumBedrockOre.GOLD, 1), WorldConfig.bedrockGoldSpawn); - registerBedrockOre(new BedrockOreDefinition(EnumBedrockOre.URANIUM, 4, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockUraniumSpawn); - registerBedrockOre(new BedrockOreDefinition(EnumBedrockOre.THORIUM, 4, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockThoriumSpawn); - registerBedrockOre(new BedrockOreDefinition(new ItemStack(Items.coal, 4), 1, 0x202020), WorldConfig.bedrockCoalSpawn); - registerBedrockOre(new BedrockOreDefinition(new ItemStack(ModItems.niter, 4), 2, 0x808080, new FluidStack(Fluids.ACID, 500)), WorldConfig.bedrockNiterSpawn); - registerBedrockOre(new BedrockOreDefinition(new ItemStack(ModItems.fluorite, 4), 1, 0xd0d0d0), WorldConfig.bedrockFluoriteSpawn); - registerBedrockOre(new BedrockOreDefinition(new ItemStack(Items.redstone, 4), 1, 0xd01010), WorldConfig.bedrockRedstoneSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.IRON, 1), WorldConfig.bedrockIronSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.COPPER, 1), WorldConfig.bedrockCopperSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.BORAX, 3, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockBoraxSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.CHLOROCALCITE, 3, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockChlorocalciteSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.ASBESTOS, 2), WorldConfig.bedrockAsbestosSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.NIOBIUM, 2, new FluidStack(Fluids.ACID, 500)), WorldConfig.bedrockNiobiumSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.TITANIUM, 2, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockTitaniumSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.TUNGSTEN, 2, new FluidStack(Fluids.ACID, 500)), WorldConfig.bedrockTungstenSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.GOLD, 1), WorldConfig.bedrockGoldSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.URANIUM, 4, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockUraniumSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(EnumBedrockOre.THORIUM, 4, new FluidStack(Fluids.SULFURIC_ACID, 500)), WorldConfig.bedrockThoriumSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(new ItemStack(Items.coal, 4), 1, 0x202020), WorldConfig.bedrockCoalSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(new ItemStack(ModItems.niter, 4), 2, 0x808080, new FluidStack(Fluids.ACID, 500)), WorldConfig.bedrockNiterSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(new ItemStack(ModItems.fluorite, 4), 1, 0xd0d0d0), WorldConfig.bedrockFluoriteSpawn); + registerBedrockOre(weightedOres, new BedrockOreDefinition(new ItemStack(Items.redstone, 4), 1, 0xd01010), WorldConfig.bedrockRedstoneSpawn); + + registerBedrockOre(weightedOresNether, new BedrockOreDefinition(new ItemStack(Items.glowstone_dust, 4), 1, 0xF9FF4D), WorldConfig.bedrockGlowstoneSpawn); + registerBedrockOre(weightedOresNether, new BedrockOreDefinition(new ItemStack(ModItems.powder_fire, 4), 1, 0xD7341F), WorldConfig.bedrockPhosphorusSpawn); } - public static void registerBedrockOre(BedrockOreDefinition def, int weight) { + public static void registerBedrockOre(List list, BedrockOreDefinition def, int weight) { WeightedRandomGeneric weighted = new WeightedRandomGeneric(def, weight); - weightedOres.add(weighted); + list.add(weighted); } public static void generate(World world, int x, int z, ItemStack stack, FluidStack acid, int color, int tier) { + generate(world, x, z, stack, acid, color, tier, ModBlocks.stone_depth); + } + + public static void generate(World world, int x, int z, ItemStack stack, FluidStack acid, int color, int tier, Block depthRock) { for(int ix = x - 1; ix <= x + 1; ix++) { for(int iz = z - 1; iz <= z + 1; iz++) { @@ -77,7 +85,7 @@ public class BedrockOre { Block b = world.getBlock(ix, iy, iz); if(b.isReplaceableOreGen(world, ix, iy, iz, Blocks.stone) || b.isReplaceableOreGen(world, ix, iy, iz, Blocks.bedrock)) { - world.setBlock(ix, iy, iz, ModBlocks.stone_depth); + world.setBlock(ix, iy, iz, depthRock); } } } diff --git a/src/main/resources/assets/hbm/textures/gui/nei/gui_nei_custom.png b/src/main/resources/assets/hbm/textures/gui/nei/gui_nei_custom.png new file mode 100644 index 000000000..c28a69cf4 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/gui/nei/gui_nei_custom.png differ diff --git a/src/main/resources/assets/hbm/textures/gui/processing/gui_electrolyser_fluid.png b/src/main/resources/assets/hbm/textures/gui/processing/gui_electrolyser_fluid.png index 32b6d976e..30b63b55e 100644 Binary files a/src/main/resources/assets/hbm/textures/gui/processing/gui_electrolyser_fluid.png and b/src/main/resources/assets/hbm/textures/gui/processing/gui_electrolyser_fluid.png differ diff --git a/src/main/resources/assets/hbm/textures/gui/processing/gui_electrolyser_metal.png b/src/main/resources/assets/hbm/textures/gui/processing/gui_electrolyser_metal.png index 9c1657536..0de879b3d 100644 Binary files a/src/main/resources/assets/hbm/textures/gui/processing/gui_electrolyser_metal.png and b/src/main/resources/assets/hbm/textures/gui/processing/gui_electrolyser_metal.png differ