diff --git a/src/main/java/com/hbm/blocks/BlockDummyable.java b/src/main/java/com/hbm/blocks/BlockDummyable.java index 908c9316a..2cacd54f1 100644 --- a/src/main/java/com/hbm/blocks/BlockDummyable.java +++ b/src/main/java/com/hbm/blocks/BlockDummyable.java @@ -8,8 +8,11 @@ import com.hbm.handler.MultiblockHandlerXR; import com.hbm.handler.ThreeInts; import com.hbm.main.MainRegistry; import com.hbm.tileentity.IPersistentNBT; +import com.hbm.tileentity.machine.TileEntityCrucible; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -27,9 +30,10 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.common.util.ForgeDirection; -public abstract class BlockDummyable extends BlockContainer { +public abstract class BlockDummyable extends BlockContainer implements ICustomBlockHighlight { public BlockDummyable(Material mat) { super(mat); @@ -473,4 +477,35 @@ public abstract class BlockDummyable extends BlockContainer { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.999F, 1.0F); //for some fucking reason setting maxY to something that isn't 1 magically fixes item collisions } } + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldDrawHighlight(World world, int x, int y, int z) { + return !this.bounding.isEmpty(); + } + + @Override + @SideOnly(Side.CLIENT) + public void drawHighlight(DrawBlockHighlightEvent event, World world, int x, int y, int z) { + + int[] pos = this.findCore(world, x, y, z); + if(pos == null) return; + TileEntity tile = world.getTileEntity(pos[0], pos[1], pos[2]); + if(tile == null) return; + + x = tile.xCoord; + y = tile.yCoord; + z = tile.zCoord; + + EntityPlayer player = event.player; + float interp = event.partialTicks; + double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) interp; + double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) interp; + double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp; + float exp = 0.002F; + + ICustomBlockHighlight.setup(); + for(AxisAlignedBB aabb : this.bounding) event.context.drawOutlinedBoundingBox(aabb.expand(exp, exp, exp).getOffsetBoundingBox(x - dX + 0.5, y - dY, z - dZ + 0.5), -1); + ICustomBlockHighlight.cleanup(); + } } diff --git a/src/main/java/com/hbm/blocks/ICustomBlockHighlight.java b/src/main/java/com/hbm/blocks/ICustomBlockHighlight.java new file mode 100644 index 000000000..509ddab95 --- /dev/null +++ b/src/main/java/com/hbm/blocks/ICustomBlockHighlight.java @@ -0,0 +1,32 @@ +package com.hbm.blocks; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.world.World; +import net.minecraftforge.client.event.DrawBlockHighlightEvent; + +public interface ICustomBlockHighlight { + + @SideOnly(Side.CLIENT) public boolean shouldDrawHighlight(World world, int x, int y, int z); + @SideOnly(Side.CLIENT) public void drawHighlight(DrawBlockHighlightEvent event, World world, int x, int y, int z); + + @SideOnly(Side.CLIENT) + public static void setup() { + GL11.glEnable(GL11.GL_BLEND); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F); + GL11.glLineWidth(2.0F); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDepthMask(false); + } + + @SideOnly(Side.CLIENT) + public static void cleanup() { + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_BLEND); + } +} diff --git a/src/main/java/com/hbm/blocks/machine/MachineCentrifuge.java b/src/main/java/com/hbm/blocks/machine/MachineCentrifuge.java index 026c67bfc..38584888d 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCentrifuge.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCentrifuge.java @@ -2,7 +2,6 @@ package com.hbm.blocks.machine; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; -import com.hbm.interfaces.IMultiblock; import com.hbm.main.MainRegistry; import com.hbm.tileentity.TileEntityProxyCombo; import com.hbm.tileentity.machine.TileEntityMachineCentrifuge; @@ -11,13 +10,16 @@ import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class MachineCentrifuge extends BlockDummyable implements IMultiblock { +public class MachineCentrifuge extends BlockDummyable { public MachineCentrifuge(Material mat) { super(mat); + this.bounding.add(AxisAlignedBB.getBoundingBox(-0.5D, 0D, -0.5D, 0.5D, 1D, 0.5D)); + this.bounding.add(AxisAlignedBB.getBoundingBox(-0.375D, 1D, -0.375D, 0.375D, 4D, 0.375D)); } @Override diff --git a/src/main/java/com/hbm/blocks/machine/MachineCrucible.java b/src/main/java/com/hbm/blocks/machine/MachineCrucible.java index 702ca3195..e69d9ef41 100644 --- a/src/main/java/com/hbm/blocks/machine/MachineCrucible.java +++ b/src/main/java/com/hbm/blocks/machine/MachineCrucible.java @@ -4,12 +4,15 @@ import java.util.ArrayList; import java.util.List; import com.hbm.blocks.BlockDummyable; +import com.hbm.blocks.ICustomBlockHighlight; import com.hbm.inventory.material.Mats.MaterialStack; import com.hbm.items.machine.ItemScraps; import com.hbm.main.MainRegistry; import com.hbm.tileentity.machine.TileEntityCrucible; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; @@ -19,6 +22,7 @@ import net.minecraft.item.ItemTool; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; +import net.minecraftforge.client.event.DrawBlockHighlightEvent; public class MachineCrucible extends BlockDummyable { @@ -113,4 +117,39 @@ public class MachineCrucible extends BlockDummyable { super.breakBlock(world, x, y, z, b, i); } + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldDrawHighlight(World world, int x, int y, int z) { + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public void drawHighlight(DrawBlockHighlightEvent event, World world, int x, int y, int z) { + + int[] pos = this.findCore(world, x, y, z); + if(pos == null) return; + TileEntity tile = world.getTileEntity(pos[0], pos[1], pos[2]); + if(!(tile instanceof TileEntityCrucible)) return; + TileEntityCrucible crucible = (TileEntityCrucible) tile; + + x = crucible.xCoord; + y = crucible.yCoord; + z = crucible.zCoord; + + EntityPlayer player = event.player; + float interp = event.partialTicks; + double dX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) interp; + double dY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) interp; + double dZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)interp; + float exp = 0.002F; + + ICustomBlockHighlight.setup(); + /*event.context.drawOutlinedBoundingBox(AxisAlignedBB.getBoundingBox(x - 1, y, z - 1, x + 2, y + 0.5, z + 2).expand(exp, exp, exp).getOffsetBoundingBox(-dX, -dY, -dZ), -1); + event.context.drawOutlinedBoundingBox(AxisAlignedBB.getBoundingBox(x - 0.75, y + 0.5, z - 0.75, x + 1.75, y + 1.5, z + 1.75).expand(exp, exp, exp).getOffsetBoundingBox(-dX, -dY, -dZ), -1); + event.context.drawOutlinedBoundingBox(AxisAlignedBB.getBoundingBox(x - 0.5, y + 0.75, z - 0.5, x + 1.5, y + 1.5, z + 1.5).expand(exp, exp, exp).getOffsetBoundingBox(-dX, -dY, -dZ), -1);*/ + for(AxisAlignedBB aabb : this.bounding) event.context.drawOutlinedBoundingBox(aabb.expand(exp, exp, exp).getOffsetBoundingBox(x - dX + 0.5, y - dY, z - dZ + 0.5), -1); + ICustomBlockHighlight.cleanup(); + } } diff --git a/src/main/java/com/hbm/entity/projectile/EntityArtilleryRocket.java b/src/main/java/com/hbm/entity/projectile/EntityArtilleryRocket.java index e88879b95..16ae47552 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityArtilleryRocket.java +++ b/src/main/java/com/hbm/entity/projectile/EntityArtilleryRocket.java @@ -152,7 +152,7 @@ public class EntityArtilleryRocket extends EntityThrowableInterp implements IChu int minX = Math.min(newChunkX, newChunkX + (int) Math.ceil((this.posX + this.motionX) / 16D)); int maxX = Math.max(newChunkX, newChunkX + (int) Math.ceil((this.posX + this.motionX) / 16D)); - int minZ = Math.min(newChunkX, newChunkX + (int) Math.ceil((this.posX + this.motionX) / 16D)); + int minZ = Math.min(newChunkZ, newChunkZ + (int) Math.ceil((this.posZ + this.motionZ) / 16D)); int maxZ = Math.max(newChunkZ, newChunkZ + (int) Math.ceil((this.posZ + this.motionZ) / 16D)); for(int x = minX; x <= maxX; x++) { diff --git a/src/main/java/com/hbm/handler/nei/CentrifugeRecipeHandler.java b/src/main/java/com/hbm/handler/nei/CentrifugeRecipeHandler.java index 599049cca..1acd56e2a 100644 --- a/src/main/java/com/hbm/handler/nei/CentrifugeRecipeHandler.java +++ b/src/main/java/com/hbm/handler/nei/CentrifugeRecipeHandler.java @@ -1,166 +1,27 @@ package com.hbm.handler.nei; import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import com.hbm.inventory.RecipesCommon; +import com.hbm.blocks.ModBlocks; import com.hbm.inventory.gui.GUIMachineCentrifuge; import com.hbm.inventory.recipes.CentrifugeRecipes; -import com.hbm.inventory.recipes.MachineRecipes; -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; +public class CentrifugeRecipeHandler extends NEIUniversalHandler { -public class CentrifugeRecipeHandler extends TemplateRecipeHandler { - - public static ArrayList fuels; - - public class RecipeSet extends TemplateRecipeHandler.CachedRecipe { - PositionedStack input; - PositionedStack result1; - PositionedStack result2; - PositionedStack result3; - PositionedStack result4; - - public RecipeSet(Object input, ItemStack[] results) { - this.input = new PositionedStack(input, 21, 6); - this.result1 = new PositionedStack(results[0], 129, 6); - this.result2 = new PositionedStack(results[1], 147, 6); - this.result3 = new PositionedStack(results[2], 129, 42); - this.result4 = new PositionedStack(results[3], 147, 42); - } - - @Override - public List getIngredients() { - return getCycledIngredients(cycleticks / 48, Arrays.asList(input)); - } - - @Override - public List getOtherStacks() { - List stacks = new ArrayList(); - stacks.add(fuels.get((cycleticks / 48) % fuels.size()).stack); - stacks.add(result2); - stacks.add(result3); - stacks.add(result4); - return stacks; - } - - @Override - public PositionedStack getResult() { - return result1; - } - } - - public static class Fuel { - public Fuel(ItemStack ingred) { - - this.stack = new PositionedStack(ingred, 21, 42, false); - } - - public PositionedStack stack; + public CentrifugeRecipeHandler() { + super("Centrifuge", ModBlocks.machine_centrifuge, CentrifugeRecipes.getRecipes()); } @Override - public String getRecipeName() { - return "Centrifuge"; + public String getKey() { + return "ntmCentrifuge"; } - - @Override - public String getGuiTexture() { - return GUIMachineCentrifuge.texture.toString(); - } - - @Override - public Class getGuiClass() { - return GUIMachineCentrifuge.class; - } - - @Override - public TemplateRecipeHandler newInstance() { - if(fuels == null || fuels.isEmpty()) - fuels = new ArrayList(); - for(ItemStack i : MachineRecipes.instance().getBatteries()) { - fuels.add(new Fuel(i)); - } - return super.newInstance(); - } - - @Override - public void loadCraftingRecipes(String outputId, Object... results) { - - if((outputId.equals("centrifugeprocessing")) && getClass() == CentrifugeRecipeHandler.class) { - - Map recipes = CentrifugeRecipes.getRecipes(); - - for(Map.Entry recipe : recipes.entrySet()) { - this.arecipes.add(new RecipeSet(recipe.getKey(), RecipesCommon.objectToStackArray(recipe.getValue()))); - } - - } else { - super.loadCraftingRecipes(outputId, results); - } - } - - @Override - public void loadCraftingRecipes(ItemStack result) { - - Map recipes = CentrifugeRecipes.getRecipes(); - - for(Map.Entry recipe : recipes.entrySet()) { - - if(NEIServerUtils.areStacksSameType((ItemStack) recipe.getValue()[0], result) || NEIServerUtils.areStacksSameType((ItemStack) recipe.getValue()[1], result) - || NEIServerUtils.areStacksSameType((ItemStack) recipe.getValue()[2], result) || NEIServerUtils.areStacksSameType((ItemStack) recipe.getValue()[3], result)) - this.arecipes.add(new RecipeSet(recipe.getKey(), RecipesCommon.objectToStackArray(recipe.getValue()))); - } - } - - @Override - public void loadUsageRecipes(String inputId, Object... ingredients) { - - if((inputId.equals("centrifugeprocessing")) && getClass() == CentrifugeRecipeHandler.class) { - - loadCraftingRecipes("centrifugeprocessing", new Object[0]); - - } else { - super.loadUsageRecipes(inputId, ingredients); - } - } - - @Override - public void loadUsageRecipes(ItemStack ingredient) { - - Map recipes = CentrifugeRecipes.getRecipes(); - - for(Map.Entry recipe : recipes.entrySet()) { - if(recipe.getKey() instanceof List) { - - for(Object o : (List) recipe.getKey()) { - ItemStack stack = (ItemStack) o; - - if(NEIServerUtils.areStacksSameType(ingredient, stack)) { - this.arecipes.add(new RecipeSet(stack, RecipesCommon.objectToStackArray(recipe.getValue()))); - } - } - } - } - } - - @Override - public void drawExtras(int recipe) { - drawProgressBar(21, 24, 195, 55, 16, 16, 48, 7); - drawProgressBar(56, 5, 176, 0, 54, 54, 48 * 3, 0); - drawProgressBar(3, 6, 177, 55, 16, 52, 480, 7); - } - + @Override public void loadTransferRects() { - transferRects.add(new RecipeTransferRect(new Rectangle(56, 5, 54, 54), "centrifugeprocessing")); + super.loadTransferRects(); + transferRectsGui.add(new RecipeTransferRect(new Rectangle(56, 0, 80, 38), "ntmCentrifuge")); + guiGui.add(GUIMachineCentrifuge.class); + RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui); } - } diff --git a/src/main/java/com/hbm/handler/nei/NEIUniversalHandler.java b/src/main/java/com/hbm/handler/nei/NEIUniversalHandler.java index dda5d9b04..aa1fb5132 100644 --- a/src/main/java/com/hbm/handler/nei/NEIUniversalHandler.java +++ b/src/main/java/com/hbm/handler/nei/NEIUniversalHandler.java @@ -60,7 +60,9 @@ public abstract class NEIUniversalHandler extends TemplateRecipeHandler { output = new PositionedStack[out.length]; for(int i = 0; i < out.length; i++) { ItemStack[] sub = out[i]; - this.output[i] = new PositionedStack(sub, 102 + i * 18, 24); + + boolean twos = out.length > 3; + this.output[i] = new PositionedStack(sub, 102 + i * 18 - ((twos && i < 2) ? 0 : 36), 24 + (twos ? (i < 2 ? -9 : 9) : 0)); } this.machinePositioned = new PositionedStack(machine, 75, 31); @@ -105,8 +107,10 @@ public abstract class NEIUniversalHandler extends TemplateRecipeHandler { for(int i = 0; i < rec.input.length; i++) drawTexturedModalRect(47 + i * -18, 23, 5, 87, 18, 18); - for(int i = 0; i < rec.output.length; i++) - drawTexturedModalRect(101 + i * 18, 23, 5, 87, 18, 18); + for(int i = 0; i < rec.output.length; i++) { + boolean twos = rec.output.length > 3; + drawTexturedModalRect(101 + i * 18 - ((twos && i < 2) ? 0 : 36), 23 + (twos ? (i < 2 ? -9 : 9) : 0), 5, 87, 18, 18); + } drawTexturedModalRect(74, 14, 59, 87, 18, 38); } @@ -177,6 +181,7 @@ public abstract class NEIUniversalHandler extends TemplateRecipeHandler { @Override public void loadTransferRects() { transferRectsGui = new LinkedList(); + guiGui = new LinkedList>(); transferRects.add(new RecipeTransferRect(new Rectangle(147, 1, 18, 18), getKey())); RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects); } diff --git a/src/main/java/com/hbm/inventory/material/Mats.java b/src/main/java/com/hbm/inventory/material/Mats.java index f83928ef6..42b58d0ab 100644 --- a/src/main/java/com/hbm/inventory/material/Mats.java +++ b/src/main/java/com/hbm/inventory/material/Mats.java @@ -48,7 +48,7 @@ public class Mats { //Vanilla and vanilla-like public static final NTMMaterial MAT_STONE = makeSmeltable(_VS + 00, df("Stone"), 0x4D2F23).omitAutoGen(); - public static final NTMMaterial MAT_CARBON = makeAdditive( 1499, df("Carbon"), 0x808080).omitAutoGen(); + public static final NTMMaterial MAT_CARBON = makeAdditive( 1499, df("Carbon"), 0x404040).omitAutoGen(); public static final NTMMaterial MAT_COAL = make( 1400, COAL) .setConversion(MAT_CARBON, 3, 1).omitAutoGen(); public static final NTMMaterial MAT_LIGNITE = make( 1401, LIGNITE) .setConversion(MAT_CARBON, 4, 1); public static final NTMMaterial MAT_COALCOKE = make( 1410, COALCOKE) .setConversion(MAT_CARBON, 2, 1); diff --git a/src/main/java/com/hbm/inventory/recipes/CentrifugeRecipes.java b/src/main/java/com/hbm/inventory/recipes/CentrifugeRecipes.java index 8d34db3dc..22522cce5 100644 --- a/src/main/java/com/hbm/inventory/recipes/CentrifugeRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/CentrifugeRecipes.java @@ -3,7 +3,6 @@ package com.hbm.inventory.recipes; import java.io.IOException; import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Map.Entry; import com.google.gson.JsonArray; @@ -367,12 +366,12 @@ public class CentrifugeRecipes extends SerializableRecipe { return null; } - public static Map getRecipes() { + public static HashMap getRecipes() { - Map recipes = new HashMap(); + HashMap recipes = new HashMap(); for(Entry entry : CentrifugeRecipes.recipes.entrySet()) { - recipes.put(entry.getKey().extractForNEI(), entry.getValue()); + recipes.put(entry.getKey(), entry.getValue()); } return recipes; diff --git a/src/main/java/com/hbm/items/machine/ItemMold.java b/src/main/java/com/hbm/items/machine/ItemMold.java index 1743aca29..26c7f301d 100644 --- a/src/main/java/com/hbm/items/machine/ItemMold.java +++ b/src/main/java/com/hbm/items/machine/ItemMold.java @@ -247,7 +247,7 @@ public class ItemMold extends Item { @Override public String getTitle() { - return I18nUtil.resolveKey("shape." + MaterialShapes.WIRE.name().toLowerCase()) + " x8"; + return I18nUtil.resolveKey("shape.wire") + " x8"; } } diff --git a/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java b/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java index 29ef557c4..17784a3fa 100644 --- a/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java +++ b/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java @@ -1,6 +1,7 @@ package com.hbm.items.weapon; import java.util.List; +import java.util.Random; import com.hbm.config.BombConfig; import com.hbm.entity.effect.EntityNukeCloudSmall; @@ -41,7 +42,8 @@ import net.minecraft.util.Vec3; import net.minecraft.util.MovingObjectPosition.MovingObjectType; public class ItemAmmoArty extends Item { - + + public static Random rand = new Random(); public static ArtilleryShell[] itemTypes = new ArtilleryShell[ /* >>> */ 9 /* <<< */ ]; //public static ArtilleryShell[] shellTypes = new ArtilleryShell[ /* >>> */ 8 /* <<< */ ]; /* item types */ @@ -184,7 +186,7 @@ public class ItemAmmoArty extends Item { } public static void standardExplosion(EntityArtilleryShell shell, MovingObjectPosition mop, float size, float rangeMod, boolean breaksBlocks) { - shell.worldObj.playSoundEffect(shell.posX, shell.posY, shell.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + shell.worldObj.rand.nextFloat() * 0.2F); + shell.worldObj.playSoundEffect(shell.posX, shell.posY, shell.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + rand.nextFloat() * 0.2F); Vec3 vec = Vec3.createVectorHelper(shell.motionX, shell.motionY, shell.motionZ).normalize(); ExplosionVNT xnt = new ExplosionVNT(shell.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, size); if(breaksBlocks) { @@ -217,9 +219,9 @@ public class ItemAmmoArty extends Item { EntityArtilleryShell cluster = new EntityArtilleryShell(shell.worldObj); cluster.setType(clusterType); cluster.setPositionAndRotation(shell.posX, shell.posY, shell.posZ, shell.rotationYaw, shell.rotationPitch); - cluster.motionX = i == 0 ? shell.motionX : (shell.motionX + shell.worldObj.rand.nextGaussian() * deviation); + cluster.motionX = i == 0 ? shell.motionX : (shell.motionX + rand.nextGaussian() * deviation); cluster.motionY = shell.motionY; - cluster.motionZ = i == 0 ? shell.motionZ : (shell.motionZ + shell.worldObj.rand.nextGaussian() * deviation); + cluster.motionZ = i == 0 ? shell.motionZ : (shell.motionZ + rand.nextGaussian() * deviation); double[] target = shell.getTarget(); cluster.setTarget(target[0], target[1], target[2]); cluster.setWhistle(shell.getWhistle() && !shell.didWhistle()); diff --git a/src/main/java/com/hbm/lib/RefStrings.java b/src/main/java/com/hbm/lib/RefStrings.java index 00d7f12a7..0dbe95285 100644 --- a/src/main/java/com/hbm/lib/RefStrings.java +++ b/src/main/java/com/hbm/lib/RefStrings.java @@ -3,7 +3,7 @@ package com.hbm.lib; public class RefStrings { public static final String MODID = "hbm"; public static final String NAME = "Hbm's Nuclear Tech Mod"; - public static final String VERSION = "1.0.27 BETA (4403)"; + public static final String VERSION = "1.0.27 BETA (4410)"; //HBM's Beta Naming Convention: //V T (X) //V -> next release version diff --git a/src/main/java/com/hbm/main/ModEventHandlerClient.java b/src/main/java/com/hbm/main/ModEventHandlerClient.java index f4948f0a9..7c584713d 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerClient.java +++ b/src/main/java/com/hbm/main/ModEventHandlerClient.java @@ -783,7 +783,7 @@ public class ModEventHandlerClient { CanneryBase cannery = Jars.canneries.get(comp); if(cannery != null) { - FMLCommonHandler.instance().showGuiScreen(new GuiWorldInAJar(cannery.createScript(), cannery.getName(), cannery.getIcon())); + FMLCommonHandler.instance().showGuiScreen(new GuiWorldInAJar(cannery.createScript(), cannery.getName(), cannery.getIcon(), cannery.seeAlso())); } break; diff --git a/src/main/java/com/hbm/main/ModEventHandlerRenderer.java b/src/main/java/com/hbm/main/ModEventHandlerRenderer.java index 79db4e794..860829605 100644 --- a/src/main/java/com/hbm/main/ModEventHandlerRenderer.java +++ b/src/main/java/com/hbm/main/ModEventHandlerRenderer.java @@ -2,6 +2,7 @@ package com.hbm.main; import org.lwjgl.opengl.GL11; +import com.hbm.blocks.ICustomBlockHighlight; import com.hbm.blocks.generic.BlockAshes; import com.hbm.items.armor.IArmorDisableModel; import com.hbm.items.armor.IArmorDisableModel.EnumPlayerPart; @@ -12,12 +13,8 @@ import com.hbm.render.model.ModelMan; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderPlayer; import net.minecraft.entity.player.EntityPlayer; @@ -26,10 +23,10 @@ import net.minecraft.item.EnumAction; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.client.event.DrawBlockHighlightEvent; import net.minecraftforge.client.event.RenderPlayerEvent; -import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; public class ModEventHandlerRenderer { @@ -121,7 +118,7 @@ public class ModEventHandlerRenderer { public void onRenderHeldItem(RenderPlayerEvent.Specials.Pre event) { EntityPlayer player = event.entityPlayer; - RenderPlayer renderer = event.renderer; + //RenderPlayer renderer = event.renderer; boolean isManly = player.isPotionActive(HbmPotion.death.id); @@ -237,6 +234,23 @@ public class ModEventHandlerRenderer { default: return null; } } + + @SubscribeEvent + public void onDrawHighlight(DrawBlockHighlightEvent event) { + MovingObjectPosition mop = event.target; + + if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) { + Block b = event.player.worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ); + if(b instanceof ICustomBlockHighlight) { + ICustomBlockHighlight cus = (ICustomBlockHighlight) b; + + if(cus.shouldDrawHighlight(event.player.worldObj, mop.blockX, mop.blockY, mop.blockZ)) { + cus.drawHighlight(event, event.player.worldObj, mop.blockX, mop.blockY, mop.blockZ); + event.setCanceled(true); + } + } + } + } private ResourceLocation ashes = new ResourceLocation(RefStrings.MODID + ":textures/misc/overlay_ash.png"); public static int currentBrightness = 0; diff --git a/src/main/java/com/hbm/render/tileentity/RenderCrucible.java b/src/main/java/com/hbm/render/tileentity/RenderCrucible.java index abaacf24c..b0028beba 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderCrucible.java +++ b/src/main/java/com/hbm/render/tileentity/RenderCrucible.java @@ -9,16 +9,19 @@ import com.hbm.lib.RefStrings; import com.hbm.main.ResourceManager; import com.hbm.render.item.ItemRenderBase; import com.hbm.tileentity.machine.TileEntityCrucible; +import com.hbm.wiaj.WorldInAJar; +import com.hbm.wiaj.actors.ITileActorRenderer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; -public class RenderCrucible extends TileEntitySpecialRenderer implements IItemRendererProvider { +public class RenderCrucible extends TileEntitySpecialRenderer implements IItemRendererProvider, ITileActorRenderer { public static final ResourceLocation lava = new ResourceLocation(RefStrings.MODID, "textures/models/machines/lava.png"); @@ -36,7 +39,7 @@ public class RenderCrucible extends TileEntitySpecialRenderer implements IItemRe case 4: GL11.glRotatef(180, 0F, 1F, 0F); break; } - bindTexture(ResourceManager.crucible_tex); + ITileActorRenderer.bindTexture(ResourceManager.crucible_tex); ResourceManager.crucible_heat.renderAll(); TileEntityCrucible crucible = (TileEntityCrucible) tile; @@ -56,7 +59,7 @@ public class RenderCrucible extends TileEntitySpecialRenderer implements IItemRe GL11.glDisable(GL11.GL_CULL_FACE); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F); - bindTexture(lava); + ITileActorRenderer.bindTexture(lava); Tessellator tess = Tessellator.instance; tess.setNormal(0F, 1F, 0F); tess.startDrawingQuads(); @@ -91,4 +94,15 @@ public class RenderCrucible extends TileEntitySpecialRenderer implements IItemRe ResourceManager.crucible_heat.renderAll(); }}; } + + @Override + public void renderActor(WorldInAJar world, int ticks, float interp, NBTTagCompound data) { + int x = data.getInteger("x"); + int y = data.getInteger("y"); + int z = data.getInteger("z"); + renderTileEntityAt(world.getTileEntity(x, y, z), x, y, z, interp); + } + + @Override + public void updateActor(int ticks, NBTTagCompound data) { } } diff --git a/src/main/java/com/hbm/render/tileentity/RenderFENSU.java b/src/main/java/com/hbm/render/tileentity/RenderFENSU.java index a1c420293..71fcc4220 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderFENSU.java +++ b/src/main/java/com/hbm/render/tileentity/RenderFENSU.java @@ -5,6 +5,7 @@ import org.lwjgl.opengl.GL11; import com.hbm.blocks.BlockDummyable; import com.hbm.main.ResourceManager; import com.hbm.tileentity.machine.storage.TileEntityMachineFENSU; +import com.hbm.wiaj.WorldInAJar; import com.hbm.wiaj.actors.ITileActorRenderer; import net.minecraft.client.renderer.OpenGlHelper; @@ -62,7 +63,7 @@ public class RenderFENSU extends TileEntitySpecialRenderer implements ITileActor } @Override - public void renderActor(int ticks, float interp, NBTTagCompound data) { + public void renderActor(WorldInAJar world, int ticks, float interp, NBTTagCompound data) { double x = data.getDouble("x"); double y = data.getDouble("y"); double z = data.getDouble("z"); diff --git a/src/main/java/com/hbm/render/tileentity/RenderFoundry.java b/src/main/java/com/hbm/render/tileentity/RenderFoundry.java index 0976d9c12..8da434312 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderFoundry.java +++ b/src/main/java/com/hbm/render/tileentity/RenderFoundry.java @@ -6,6 +6,8 @@ import org.lwjgl.opengl.GL11; import com.hbm.lib.RefStrings; import com.hbm.tileentity.machine.IRenderFoundry; +import com.hbm.wiaj.WorldInAJar; +import com.hbm.wiaj.actors.ITileActorRenderer; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -19,12 +21,13 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.ForgeHooksClient; -public class RenderFoundry extends TileEntitySpecialRenderer { +public class RenderFoundry extends TileEntitySpecialRenderer implements ITileActorRenderer { public static final ResourceLocation lava = new ResourceLocation(RefStrings.MODID, "textures/models/machines/lava_gray.png"); @@ -50,7 +53,7 @@ public class RenderFoundry extends TileEntitySpecialRenderer { Tessellator tess = Tessellator.instance; Block b = ((ItemBlock)stack.getItem()).field_150939_a; IIcon icon = b.getIcon(1, stack.getItemDamage()); - bindTexture(TextureMap.locationBlocksTexture); + ITileActorRenderer.bindTexture(TextureMap.locationBlocksTexture); tess.startDrawingQuads(); tess.setNormal(0F, 1F, 0F); @@ -91,7 +94,7 @@ public class RenderFoundry extends TileEntitySpecialRenderer { if(foundry.shouldRender()) { - this.bindTexture(lava); + ITileActorRenderer.bindTexture(lava); int hex = foundry.getMat().moltenColor; Color color = new Color(hex); @@ -134,4 +137,15 @@ public class RenderFoundry extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } + + @Override + public void renderActor(WorldInAJar world, int ticks, float interp, NBTTagCompound data) { + int x = data.getInteger("x"); + int y = data.getInteger("y"); + int z = data.getInteger("z"); + renderTileEntityAt(world.getTileEntity(x, y, z), x, y, z, interp); + } + + @Override + public void updateActor(int ticks, NBTTagCompound data) { } } diff --git a/src/main/java/com/hbm/render/tileentity/RenderStirling.java b/src/main/java/com/hbm/render/tileentity/RenderStirling.java index 38699104c..d1544382d 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderStirling.java +++ b/src/main/java/com/hbm/render/tileentity/RenderStirling.java @@ -7,6 +7,7 @@ import com.hbm.blocks.ModBlocks; import com.hbm.main.ResourceManager; import com.hbm.render.item.ItemRenderBase; import com.hbm.tileentity.machine.TileEntityStirling; +import com.hbm.wiaj.WorldInAJar; import com.hbm.wiaj.actors.ITileActorRenderer; import net.minecraft.client.Minecraft; @@ -104,7 +105,7 @@ public class RenderStirling extends TileEntitySpecialRenderer implements IItemRe } @Override - public void renderActor(int ticks, float interp, NBTTagCompound data) { + public void renderActor(WorldInAJar world, int ticks, float interp, NBTTagCompound data) { double x = data.getDouble("x"); double y = data.getDouble("y"); double z = data.getDouble("z"); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningLaser.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningLaser.java index 1fdc124e9..cc37550a2 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningLaser.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineMiningLaser.java @@ -218,7 +218,7 @@ public class TileEntityMachineMiningLaser extends TileEntityMachineBase implemen private void tryFillContainer(int x, int y, int z) { Block b = worldObj.getBlock(x, y, z); - if(b != Blocks.chest && b != Blocks.trapped_chest && b != ModBlocks.crate_iron && + if(b != Blocks.chest && b != Blocks.trapped_chest && b != ModBlocks.crate_iron && b != ModBlocks.crate_desh && b != ModBlocks.crate_steel && b != ModBlocks.safe && b != Blocks.hopper) return; diff --git a/src/main/java/com/hbm/wiaj/GuiWorldInAJar.java b/src/main/java/com/hbm/wiaj/GuiWorldInAJar.java index 5c1473628..4236c83ee 100644 --- a/src/main/java/com/hbm/wiaj/GuiWorldInAJar.java +++ b/src/main/java/com/hbm/wiaj/GuiWorldInAJar.java @@ -16,6 +16,7 @@ import com.hbm.wiaj.actors.ISpecialActor; import com.hbm.wiaj.actors.ActorFancyPanel.Orientation; import com.hbm.wiaj.cannery.*; +import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.FontRenderer; @@ -53,6 +54,12 @@ public class GuiWorldInAJar extends GuiScreen { this.renderer.enableAO = true; this.titlePanel = new ActorFancyPanel(fontRendererObj, 40, 27, new Object[][] {{I18nUtil.resolveKey(title)}}, 0).setColors(CanneryBase.colorGold).setOrientation(Orientation.LEFT); + this.seeAlsoTitles = new ActorFancyPanel[seeAlso.length]; + + for(int i = 0; i < seeAlso.length; i++) { + this.seeAlsoTitles[i] = new ActorFancyPanel(fontRendererObj, 40, 27 + 36 * (i + 1), new Object[][] {{I18nUtil.resolveKey(seeAlso[i].getName())}}, 0).setColors(CanneryBase.colorGrey).setOrientation(Orientation.LEFT); + } + /*WorldInAJar world = new WorldInAJar(15, 15, 15); @@ -169,6 +176,10 @@ public class GuiWorldInAJar extends GuiScreen { this.mc.displayGuiScreen((GuiScreen) null); this.mc.setIngameFocus(); } + + /*try { + Tessellator.instance.draw(); //why, oh why is Tessellator.isDrawing private and without a getter? + } catch(Exception x) {}*/ } @Override @@ -199,6 +210,16 @@ public class GuiWorldInAJar extends GuiScreen { mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); } } + + for(int i = 0; i < seeAlso.length; i++) { + + if(15 <= mouseX && 39 > mouseX && 15 + 36 * (i + 1) < mouseY && 39 + 36 * (i + 1) >= mouseY) { + CanneryBase cannery = seeAlso[i]; + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + FMLCommonHandler.instance().showGuiScreen(new GuiWorldInAJar(cannery.createScript(), cannery.getName(), cannery.getIcon(), cannery.seeAlso())); + return; + } + } } private void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { @@ -242,6 +263,7 @@ public class GuiWorldInAJar extends GuiScreen { GL11.glEnable(GL11.GL_DEPTH_TEST); this.drawTexturedModalRect(15, 15, 136, 48, 24, 24); + RenderHelper.enableGUIStandardItemLighting(); itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.renderEngine, this.icon, 19, 19); itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.renderEngine, this.icon, 19, 19, null); RenderHelper.disableStandardItemLighting(); @@ -249,6 +271,22 @@ public class GuiWorldInAJar extends GuiScreen { if(15 <= mouseX && 39 > mouseX && 15 < mouseY && 39 >= mouseY) { this.titlePanel.drawForegroundComponent(0, 0, this.jarScript.ticksElapsed, this.jarScript.interp); } + + for(int i = 0; i < seeAlso.length; i++) { + CanneryBase also = seeAlso[i]; + + Minecraft.getMinecraft().getTextureManager().bindTexture(guiUtil); + GL11.glDisable(GL11.GL_LIGHTING); + this.drawTexturedModalRect(15, 15 + 36 * (i + 1), 136, 72, 24, 24); + RenderHelper.enableGUIStandardItemLighting(); + itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.renderEngine, also.getIcon(), 19, 19 + 36 * (i + 1)); + itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.renderEngine, also.getIcon(), 19, 19 + 36 * (i + 1), null); + RenderHelper.disableStandardItemLighting(); + + if(15 <= mouseX && 39 > mouseX && 15 + 36 * (i + 1) < mouseY && 39 + 36 * (i + 1) >= mouseY) { + this.seeAlsoTitles[i].drawForegroundComponent(0, 0, this.jarScript.ticksElapsed, this.jarScript.interp); + } + } } private void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) { @@ -282,7 +320,7 @@ public class GuiWorldInAJar extends GuiScreen { for(Entry actor : this.jarScript.actors.entrySet()) { GL11.glPushMatrix(); - actor.getValue().drawBackgroundComponent(this.jarScript.ticksElapsed, this.jarScript.interp); + actor.getValue().drawBackgroundComponent(this.jarScript.world, this.jarScript.ticksElapsed, this.jarScript.interp); GL11.glPopMatrix(); } diff --git a/src/main/java/com/hbm/wiaj/actors/ActorBasicPanel.java b/src/main/java/com/hbm/wiaj/actors/ActorBasicPanel.java index 55290e0bd..62c4079a9 100644 --- a/src/main/java/com/hbm/wiaj/actors/ActorBasicPanel.java +++ b/src/main/java/com/hbm/wiaj/actors/ActorBasicPanel.java @@ -8,6 +8,7 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import com.hbm.wiaj.JarScene; +import com.hbm.wiaj.WorldInAJar; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -40,7 +41,7 @@ public class ActorBasicPanel implements ISpecialActor { } @Override - public void drawBackgroundComponent(int ticks, float interp) { } + public void drawBackgroundComponent(WorldInAJar world, int ticks, float interp) { } @Override public void updateActor(JarScene scene) { } diff --git a/src/main/java/com/hbm/wiaj/actors/ActorFancyPanel.java b/src/main/java/com/hbm/wiaj/actors/ActorFancyPanel.java index c1b4de34f..f40436d6c 100644 --- a/src/main/java/com/hbm/wiaj/actors/ActorFancyPanel.java +++ b/src/main/java/com/hbm/wiaj/actors/ActorFancyPanel.java @@ -9,6 +9,7 @@ import org.lwjgl.opengl.GL12; import com.hbm.lib.RefStrings; import com.hbm.util.I18nUtil; import com.hbm.wiaj.JarScene; +import com.hbm.wiaj.WorldInAJar; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -334,11 +335,12 @@ public class ActorFancyPanel implements ISpecialActor { itemRender.renderItemAndEffectIntoGUI(this.font, texman, stack, x, y - 8); itemRender.renderItemOverlayIntoGUI(this.font, texman, stack, x, y - 8, null); RenderHelper.disableStandardItemLighting(); + GL11.glColor3f(1F, 1F, 1F); GL11.glDisable(GL11.GL_DEPTH_TEST); } //TODO: scaled stacks } - @Override public void drawBackgroundComponent(int ticks, float interp) { } + @Override public void drawBackgroundComponent(WorldInAJar world, int ticks, float interp) { } @Override public void updateActor(JarScene scene) { } @Override public void setActorData(NBTTagCompound data) { } @Override public void setDataPoint(String tag, Object o) { } diff --git a/src/main/java/com/hbm/wiaj/actors/ActorTileEntity.java b/src/main/java/com/hbm/wiaj/actors/ActorTileEntity.java index 50a1f1650..a6b6ec582 100644 --- a/src/main/java/com/hbm/wiaj/actors/ActorTileEntity.java +++ b/src/main/java/com/hbm/wiaj/actors/ActorTileEntity.java @@ -1,6 +1,7 @@ package com.hbm.wiaj.actors; import com.hbm.wiaj.JarScene; +import com.hbm.wiaj.WorldInAJar; import net.minecraft.nbt.NBTTagCompound; @@ -21,8 +22,8 @@ public class ActorTileEntity extends ActorBase { public void drawForegroundComponent(int w, int h, int ticks, float interp) { } @Override - public void drawBackgroundComponent(int ticks, float interp) { - renderer.renderActor(ticks, interp, data); + public void drawBackgroundComponent(WorldInAJar world, int ticks, float interp) { + renderer.renderActor(world, ticks, interp, data); } @Override diff --git a/src/main/java/com/hbm/wiaj/actors/ActorVillager.java b/src/main/java/com/hbm/wiaj/actors/ActorVillager.java index 2d4b02bed..9eabd8e67 100644 --- a/src/main/java/com/hbm/wiaj/actors/ActorVillager.java +++ b/src/main/java/com/hbm/wiaj/actors/ActorVillager.java @@ -3,6 +3,7 @@ package com.hbm.wiaj.actors; import org.lwjgl.opengl.GL11; import com.hbm.wiaj.JarScene; +import com.hbm.wiaj.WorldInAJar; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderManager; @@ -24,7 +25,7 @@ public class ActorVillager implements ISpecialActor { public void drawForegroundComponent(int w, int h, int ticks, float interp) { } @Override - public void drawBackgroundComponent(int ticks, float interp) { + public void drawBackgroundComponent(WorldInAJar world, int ticks, float interp) { double x = data.getDouble("x"); double y = data.getDouble("y"); double z = data.getDouble("z"); diff --git a/src/main/java/com/hbm/wiaj/actors/ISpecialActor.java b/src/main/java/com/hbm/wiaj/actors/ISpecialActor.java index a70be8389..5bcd1beca 100644 --- a/src/main/java/com/hbm/wiaj/actors/ISpecialActor.java +++ b/src/main/java/com/hbm/wiaj/actors/ISpecialActor.java @@ -1,6 +1,7 @@ package com.hbm.wiaj.actors; import com.hbm.wiaj.JarScene; +import com.hbm.wiaj.WorldInAJar; import net.minecraft.nbt.NBTTagCompound; @@ -13,8 +14,8 @@ public interface ISpecialActor { /** Draws things in the foreground like text boxes */ public void drawForegroundComponent(int w, int h, int ticks, float interp); - /** Draws things in the background, fotted to the world renderer like TESRs */ - public void drawBackgroundComponent(int ticks, float interp); + /** Draws things in the background, fitted to the world renderer like TESRs */ + public void drawBackgroundComponent(WorldInAJar world, int ticks, float interp); /** Update ticks to emulate serverside ticking */ public void updateActor(JarScene scene); /** Sets the data object to the passed NBT */ diff --git a/src/main/java/com/hbm/wiaj/actors/ITileActorRenderer.java b/src/main/java/com/hbm/wiaj/actors/ITileActorRenderer.java index 5c98d5b90..3e79842b2 100644 --- a/src/main/java/com/hbm/wiaj/actors/ITileActorRenderer.java +++ b/src/main/java/com/hbm/wiaj/actors/ITileActorRenderer.java @@ -1,12 +1,14 @@ package com.hbm.wiaj.actors; +import com.hbm.wiaj.WorldInAJar; + import net.minecraft.client.Minecraft; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; public interface ITileActorRenderer { - public void renderActor(int ticks, float interp, NBTTagCompound data); + public void renderActor(WorldInAJar world, int ticks, float interp, NBTTagCompound data); public void updateActor(int ticks, NBTTagCompound data); public static void bindTexture(ResourceLocation tex) { diff --git a/src/main/java/com/hbm/wiaj/cannery/CanneryBase.java b/src/main/java/com/hbm/wiaj/cannery/CanneryBase.java index c94397274..9c008849b 100644 --- a/src/main/java/com/hbm/wiaj/cannery/CanneryBase.java +++ b/src/main/java/com/hbm/wiaj/cannery/CanneryBase.java @@ -9,7 +9,7 @@ public abstract class CanneryBase { public static final int[] colorCopper = new int[] {0xFFFDCA88, 0xFFD57C4F, 0xFFAB4223, 0xFF1A1F22}; public static final int[] colorGold = new int[] {0xFFFFFDE0, 0xFFFAD64A, 0xFFDC9613, 0xFF1A1F22}; public static final int[] colorBlue = new int[] {0xFFA5D9FF, 0xFF39ACFF, 0xFF1A6CA7, 0xFF1A1F22}; - public static final int[] colorGrey = new int[] {0xFFA5D9FF, 0xFF39ACFF, 0xFF1A6CA7, 0xFF1A1F22}; + public static final int[] colorGrey = new int[] {0xFFD1D1D1, 0xFF919191, 0xFF5D5D5D, 0xFF302E36}; public abstract ItemStack getIcon(); public abstract String getName(); diff --git a/src/main/java/com/hbm/wiaj/cannery/CanneryCentrifuge.java b/src/main/java/com/hbm/wiaj/cannery/CanneryCentrifuge.java index fe8cde550..fffdfadca 100644 --- a/src/main/java/com/hbm/wiaj/cannery/CanneryCentrifuge.java +++ b/src/main/java/com/hbm/wiaj/cannery/CanneryCentrifuge.java @@ -144,7 +144,7 @@ public class CanneryCentrifuge extends CanneryBase { public static class ActorGasCent implements ITileActorRenderer { @Override - public void renderActor(int ticks, float interp, NBTTagCompound data) { + public void renderActor(WorldInAJar world, int ticks, float interp, NBTTagCompound data) { double x = data.getDouble("x"); double y = data.getDouble("y"); double z = data.getDouble("z"); diff --git a/src/main/java/com/hbm/wiaj/cannery/CanneryCrucible.java b/src/main/java/com/hbm/wiaj/cannery/CanneryCrucible.java new file mode 100644 index 000000000..0e0b7f5ca --- /dev/null +++ b/src/main/java/com/hbm/wiaj/cannery/CanneryCrucible.java @@ -0,0 +1,226 @@ +package com.hbm.wiaj.cannery; + +import com.hbm.blocks.ModBlocks; +import com.hbm.inventory.material.MaterialShapes; +import com.hbm.inventory.material.Mats; +import com.hbm.inventory.material.Mats.MaterialStack; +import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemScraps; +import com.hbm.render.tileentity.RenderCrucible; +import com.hbm.render.tileentity.RenderFoundry; +import com.hbm.tileentity.machine.TileEntityCrucible; +import com.hbm.tileentity.machine.TileEntityFoundryBasin; +import com.hbm.util.I18nUtil; +import com.hbm.wiaj.JarScene; +import com.hbm.wiaj.JarScript; +import com.hbm.wiaj.WorldInAJar; +import com.hbm.wiaj.actions.ActionCreateActor; +import com.hbm.wiaj.actions.ActionRemoveActor; +import com.hbm.wiaj.actions.ActionRotateBy; +import com.hbm.wiaj.actions.ActionSetBlock; +import com.hbm.wiaj.actions.ActionSetTile; +import com.hbm.wiaj.actions.ActionSetZoom; +import com.hbm.wiaj.actions.ActionUpdateActor; +import com.hbm.wiaj.actions.ActionWait; +import com.hbm.wiaj.actors.ActorFancyPanel; +import com.hbm.wiaj.actors.ActorTileEntity; +import com.hbm.wiaj.actors.ActorFancyPanel.Orientation; +import com.hbm.wiaj.cannery.CanneryFirebox.ActorFirebox; + +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class CanneryCrucible extends CanneryBase { + + @Override + public ItemStack getIcon() { + return new ItemStack(ModBlocks.machine_crucible); + } + + @Override + public String getName() { + return "cannery.crucible"; + } + + public CanneryBase[] seeAlso() { + return new CanneryBase[] { + new CanneryFoundryChannel() + }; + } + + @Override + public JarScript createScript() { + WorldInAJar world = new WorldInAJar(5, 4, 5); + JarScript script = new JarScript(world); + + JarScene scene0 = new JarScene(script); + scene0.add(new ActionSetZoom(3, 0)); + + for(int x = 0; x < 5 ; x++) { + for(int z = 0; z < 5; z++) { + scene0.add(new ActionSetBlock(x, 0, z, Blocks.brick_block)); + } + } + scene0.add(new ActionWait(5)); + for(int x = 1; x < 4 ; x++) { + for(int z = 1; z < 4; z++) { + scene0.add(new ActionSetBlock(x, 1, z, Blocks.brick_block)); + } + } + scene0.add(new ActionWait(5)); + + scene0.add(new ActionSetTile(2, 2, 2, new TileEntityFauxCrucible() {{ meta = 14; }})); + scene0.add(new ActionCreateActor(1, new ActorTileEntity(new RenderCrucible(), new NBTTagCompound() {{ setInteger("x", 2); setInteger("y", 2); setInteger("z", 2); }}))); + + scene0.add(new ActionWait(10)); + scene0.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, -30, new Object[][] {{I18nUtil.resolveKey("cannery.crucible.0")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.BOTTOM))); + + scene0.add(new ActionWait(60)); + scene0.add(new ActionRemoveActor(0)); + scene0.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, -30, new Object[][] {{I18nUtil.resolveKey("cannery.crucible.1")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.BOTTOM))); + + scene0.add(new ActionWait(60)); + scene0.add(new ActionRemoveActor(0)); + scene0.add(new ActionWait(10)); + + for(int x = 1; x < 4 ; x++) for(int z = 1; z < 4; z++) scene0.add(new ActionSetBlock(x, 1, z, Blocks.air)); + + NBTTagCompound firebox = new NBTTagCompound(); firebox.setDouble("x", 2); firebox.setDouble("y", 1); firebox.setDouble("z", 2); firebox.setInteger("rotation", 5); + scene0.add(new ActionCreateActor(2, new ActorTileEntity(new ActorFirebox(), firebox))); + + scene0.add(new ActionUpdateActor(2, "open", true)); + scene0.add(new ActionWait(30)); + scene0.add(new ActionUpdateActor(2, "isOn", true)); + + scene0.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, -50, 25, new Object[][] {{new ItemStack(Items.coal)}}, 0) + .setColors(colorCopper).setOrientation(Orientation.RIGHT))); + + scene0.add(new ActionWait(20)); + scene0.add(new ActionRemoveActor(0)); + scene0.add(new ActionWait(10)); + scene0.add(new ActionUpdateActor(2, "open", false)); + scene0.add(new ActionWait(30)); + + JarScene scene1 = new JarScene(script); + + scene1.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, -30, new Object[][] {{I18nUtil.resolveKey("cannery.crucible.2")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.BOTTOM))); + scene1.add(new ActionWait(60)); + + scene1.add(new ActionRemoveActor(0)); + scene1.add(new ActionRotateBy(45, -60, 20)); + scene1.add(new ActionWait(10)); + + scene1.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, 0, new Object[][] {{I18nUtil.resolveKey("cannery.crucible.3")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.CENTER))); + scene1.add(new ActionWait(40)); + + scene1.add(new ActionRemoveActor(0)); + scene1.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, -30, 0, new Object[][] {{I18nUtil.resolveKey("cannery.crucible.4")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.LEFT))); + scene1.add(new ActionWait(60)); + + scene1.add(new ActionRemoveActor(0)); + scene1.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, -30, 0, new Object[][] {{I18nUtil.resolveKey("cannery.crucible.5")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.LEFT))); + scene1.add(new ActionWait(60)); + + scene1.add(new ActionRemoveActor(0)); + scene1.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, -30, 0, new Object[][] {{I18nUtil.resolveKey("cannery.crucible.6")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.LEFT))); + scene1.add(new ActionWait(60)); + + scene1.add(new ActionRemoveActor(0)); + scene1.add(new ActionWait(20)); + scene1.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 30, 0, new Object[][] {{I18nUtil.resolveKey("cannery.crucible.7")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.RIGHT))); + scene1.add(new ActionWait(60)); + + scene1.add(new ActionRemoveActor(0)); + scene1.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 30, 0, new Object[][] {{I18nUtil.resolveKey("cannery.crucible.8")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.RIGHT))); + scene1.add(new ActionWait(60)); + + scene1.add(new ActionRemoveActor(0)); + scene1.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 30, 0, new Object[][] {{I18nUtil.resolveKey("cannery.crucible.9")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.RIGHT))); + scene1.add(new ActionWait(60)); + + scene1.add(new ActionRemoveActor(0)); + scene1.add(new ActionRotateBy(-45, 60, 20)); + scene1.add(new ActionWait(10)); + + JarScene scene2 = new JarScene(script); + scene2.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 30, 0, new Object[][] {{I18nUtil.resolveKey("cannery.crucible.10")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.RIGHT))); + scene2.add(new ActionWait(60)); + + scene2.add(new ActionRemoveActor(0)); + scene2.add(new ActionWait(10)); + scene2.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, -40, new Object[][] {{new ItemStack(Items.gold_ingot, 11)}}, 0) + .setColors(colorCopper).setOrientation(Orientation.BOTTOM))); + scene2.add(new ActionWait(20)); + + scene2.add(new ActionRemoveActor(0)); + scene2.add(new ActionSetTile(2, 2, 2, new TileEntityFauxCrucible() {{ meta = 14; recipeStack.add(new MaterialStack(Mats.MAT_GOLD, MaterialShapes.BLOCK.q(16))); }})); + scene2.add(new ActionWait(10)); + + scene2.add(new ActionSetTile(0, 1, 2, new TileEntityFoundryBasin())); + scene2.add(new ActionCreateActor(3, new ActorTileEntity(new RenderFoundry(), new NBTTagCompound() {{ setInteger("x", 0); setInteger("y", 1); setInteger("z", 2); }}))); + scene2.add(new ActionSetBlock(0, 1, 2, ModBlocks.foundry_basin)); + + scene2.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 42, 25, new Object[][] {{new ItemStack(ModItems.mold, 1, 12)}}, 0) + .setColors(colorCopper).setOrientation(Orientation.BOTTOM))); + scene2.add(new ActionWait(20)); + scene2.add(new ActionRemoveActor(0)); + scene2.add(new ActionSetTile(0, 1, 2, new TileEntityFoundryBasin() {{ slots[0] = new ItemStack(ModItems.mold, 0, 12); }})); + + scene2.add(new ActionWait(20)); + + for(int i = 0; i < 60; i++) { + final int j = i; + scene2.add(new ActionSetTile(2, 2, 2, new TileEntityFauxCrucible() {{ meta = 14; recipeStack.add(new MaterialStack(Mats.MAT_GOLD, MaterialShapes.BLOCK.q((60 - j), 60) * 16)); }})); + scene2.add(new ActionSetTile(0, 1, 2, new TileEntityFoundryBasin() {{ slots[0] = new ItemStack(ModItems.mold, 0, 12); type = Mats.MAT_GOLD; amount = MaterialShapes.BLOCK.q(j + 1, 60); }})); + scene2.add(new ActionWait(1)); + } + + scene2.add(new ActionWait(40)); + scene2.add(new ActionSetTile(0, 1, 2, new TileEntityFoundryBasin() {{ slots[0] = new ItemStack(ModItems.mold, 0, 12); slots[1] = new ItemStack(Blocks.gold_block); }})); + scene2.add(new ActionWait(20)); + scene2.add(new ActionSetTile(0, 1, 2, new TileEntityFoundryBasin() {{ slots[0] = new ItemStack(ModItems.mold, 0, 12); }})); + scene2.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 42, 25, new Object[][] {{new ItemStack(Blocks.gold_block)}}, 0) + .setColors(colorCopper).setOrientation(Orientation.BOTTOM))); + scene2.add(new ActionWait(20)); + scene2.add(new ActionRemoveActor(0)); + + scene2.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, -30, new Object[][] {{I18nUtil.resolveKey("cannery.crucible.11")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.BOTTOM))); + scene2.add(new ActionWait(60)); + scene2.add(new ActionRemoveActor(0)); + scene2.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, -30, new Object[][] {{new ItemStack(Items.iron_shovel), " -> ", ItemScraps.create(new MaterialStack(Mats.MAT_GOLD, 1))}}, 200) + .setColors(colorCopper).setOrientation(Orientation.BOTTOM))); + scene2.add(new ActionSetTile(2, 2, 2, new TileEntityFauxCrucible() {{ meta = 14; }})); + scene2.add(new ActionWait(20)); + scene2.add(new ActionRemoveActor(0)); + + script.addScene(scene0).addScene(scene1).addScene(scene2); + + return script; + } + + public static class TileEntityFauxCrucible extends TileEntityCrucible { + + public int meta = 0; + + @Override + public int getBlockMetadata() { + return meta; + } + } + +} diff --git a/src/main/java/com/hbm/wiaj/cannery/CanneryFirebox.java b/src/main/java/com/hbm/wiaj/cannery/CanneryFirebox.java index 3429c3404..1cde66431 100644 --- a/src/main/java/com/hbm/wiaj/cannery/CanneryFirebox.java +++ b/src/main/java/com/hbm/wiaj/cannery/CanneryFirebox.java @@ -154,7 +154,7 @@ public class CanneryFirebox extends CanneryBase { public static class ActorFirebox implements ITileActorRenderer { @Override - public void renderActor(int ticks, float interp, NBTTagCompound data) { + public void renderActor(WorldInAJar world, int ticks, float interp, NBTTagCompound data) { double x = data.getDouble("x"); double y = data.getDouble("y"); double z = data.getDouble("z"); diff --git a/src/main/java/com/hbm/wiaj/cannery/CanneryFoundryChannel.java b/src/main/java/com/hbm/wiaj/cannery/CanneryFoundryChannel.java new file mode 100644 index 000000000..29c8a3462 --- /dev/null +++ b/src/main/java/com/hbm/wiaj/cannery/CanneryFoundryChannel.java @@ -0,0 +1,185 @@ +package com.hbm.wiaj.cannery; + +import com.hbm.blocks.ModBlocks; +import com.hbm.inventory.material.MaterialShapes; +import com.hbm.inventory.material.Mats; +import com.hbm.inventory.material.Mats.MaterialStack; +import com.hbm.items.ModItems; +import com.hbm.items.machine.ItemScraps; +import com.hbm.render.tileentity.RenderFoundry; +import com.hbm.tileentity.machine.TileEntityFoundryBasin; +import com.hbm.tileentity.machine.TileEntityFoundryChannel; +import com.hbm.tileentity.machine.TileEntityFoundryMold; +import com.hbm.tileentity.machine.TileEntityFoundryOutlet; +import com.hbm.tileentity.machine.TileEntityFoundryTank; +import com.hbm.util.I18nUtil; +import com.hbm.wiaj.JarScene; +import com.hbm.wiaj.JarScript; +import com.hbm.wiaj.WorldInAJar; +import com.hbm.wiaj.actions.ActionCreateActor; +import com.hbm.wiaj.actions.ActionRemoveActor; +import com.hbm.wiaj.actions.ActionSetBlock; +import com.hbm.wiaj.actions.ActionSetTile; +import com.hbm.wiaj.actions.ActionSetZoom; +import com.hbm.wiaj.actions.ActionWait; +import com.hbm.wiaj.actors.ActorFancyPanel; +import com.hbm.wiaj.actors.ActorTileEntity; +import com.hbm.wiaj.actors.ActorFancyPanel.Orientation; + +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class CanneryFoundryChannel extends CanneryBase { + + @Override + public ItemStack getIcon() { + return new ItemStack(ModBlocks.foundry_channel); + } + + @Override + public String getName() { + return "cannery.foundryChannel"; + } + + public CanneryBase[] seeAlso() { + return new CanneryBase[] { + new CanneryCrucible() + }; + } + + @Override + public JarScript createScript() { + WorldInAJar world = new WorldInAJar(5, 4, 4); + JarScript script = new JarScript(world); + + JarScene scene0 = new JarScene(script); + + /// SETUP /// + scene0.add(new ActionSetZoom(3, 0)); + + for(int x = world.sizeX - 1; x >= 0 ; x--) { + for(int z = 0; z < world.sizeZ; z++) { + scene0.add(new ActionSetBlock(x, 0, z, Blocks.brick_block)); + } + } + + scene0.add(new ActionWait(5)); + scene0.add(new ActionSetBlock(1, 1, 2, Blocks.brick_block)); + scene0.add(new ActionSetBlock(2, 1, 2, Blocks.brick_block)); + scene0.add(new ActionSetBlock(3, 1, 2, Blocks.brick_block)); + scene0.add(new ActionSetBlock(3, 1, 3, Blocks.brick_block)); + + scene0.add(new ActionSetTile(3, 1, 1, new TileEntityFoundryBasin() {{ slots[0] = new ItemStack(ModItems.mold, 0, 12); }})); + scene0.add(new ActionCreateActor(1, new ActorTileEntity(new RenderFoundry(), new NBTTagCompound() {{ setInteger("x", 3); setInteger("y", 1); setInteger("z", 1); }}))); + scene0.add(new ActionSetBlock(3, 1, 1, ModBlocks.foundry_basin)); + scene0.add(new ActionSetTile(2, 1, 1, new TileEntityFoundryMold() {{ slots[0] = new ItemStack(ModItems.mold, 0, 2); }})); + scene0.add(new ActionCreateActor(2, new ActorTileEntity(new RenderFoundry(), new NBTTagCompound() {{ setInteger("x", 2); setInteger("y", 1); setInteger("z", 1); }}))); + scene0.add(new ActionSetBlock(2, 1, 1, ModBlocks.foundry_mold)); + + scene0.add(new ActionWait(5)); + scene0.add(new ActionSetBlock(3, 2, 3, Blocks.brick_block)); + scene0.add(new ActionSetTile(1, 2, 2, new TileEntityFoundryMold() {{ slots[0] = new ItemStack(ModItems.mold, 0, 2); }})); + scene0.add(new ActionCreateActor(3, new ActorTileEntity(new RenderFoundry(), new NBTTagCompound() {{ setInteger("x", 1); setInteger("y", 2); setInteger("z", 2); }}))); + scene0.add(new ActionSetBlock(1, 2, 2, ModBlocks.foundry_mold)); + scene0.add(new ActionSetTile(2, 2, 2, new TileEntityFoundryChannel())); + scene0.add(new ActionSetBlock(2, 2, 2, ModBlocks.foundry_channel)); + scene0.add(new ActionSetTile(3, 2, 2, new TileEntityFoundryChannel())); + scene0.add(new ActionSetBlock(3, 2, 2, ModBlocks.foundry_channel)); + + scene0.add(new ActionSetTile(2, 2, 1, new TileEntityFauxOutlet())); + scene0.add(new ActionSetBlock(2, 2, 1, ModBlocks.foundry_outlet, 2)); + scene0.add(new ActionSetTile(3, 2, 1, new TileEntityFauxOutlet())); + scene0.add(new ActionSetBlock(3, 2, 1, ModBlocks.foundry_outlet, 2)); + scene0.add(new ActionWait(5)); + scene0.add(new ActionSetTile(3, 3, 3, new TileEntityFoundryTank() {{ type = Mats.MAT_GOLD; amount = MaterialShapes.BLOCK.q(1); }})); + scene0.add(new ActionSetBlock(3, 3, 3, ModBlocks.foundry_tank)); + scene0.add(new ActionSetTile(3, 3, 2, new TileEntityFauxOutlet())); + scene0.add(new ActionSetBlock(3, 3, 2, ModBlocks.foundry_outlet, 2)); + + scene0.add(new ActionWait(10)); + + scene0.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, -25, new Object[][] {{I18nUtil.resolveKey("cannery.foundryChannel.0")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.LEFT))); + + scene0.add(new ActionWait(60)); + scene0.add(new ActionRemoveActor(0)); + scene0.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, -5, -40, new Object[][] {{I18nUtil.resolveKey("cannery.foundryChannel.1")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.TOP))); + + scene0.add(new ActionWait(60)); + scene0.add(new ActionRemoveActor(0)); + scene0.add(new ActionWait(10)); + scene0.add(new ActionSetTile(3, 2, 2, new TileEntityFoundryChannel() {{ type = Mats.MAT_GOLD; amount = MaterialShapes.INGOT.q(1); }})); + + scene0.add(new ActionWait(10)); + scene0.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, -25, new Object[][] {{I18nUtil.resolveKey("cannery.foundryChannel.2")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.LEFT))); + + scene0.add(new ActionWait(60)); + scene0.add(new ActionRemoveActor(0)); + + for(int i = 0; i < 60; i++) { + final int j = i; + scene0.add(new ActionSetTile(3, 1, 1, new TileEntityFoundryBasin() {{ slots[0] = new ItemStack(ModItems.mold, 0, 12); type = Mats.MAT_GOLD; amount = MaterialShapes.BLOCK.q(j, 60); }})); + scene0.add(new ActionWait(1)); + } + + JarScene scene1 = new JarScene(script); + + scene1.add(new ActionWait(10)); + scene1.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, -25, new Object[][] {{I18nUtil.resolveKey("cannery.foundryChannel.3")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.LEFT))); + + scene1.add(new ActionWait(60)); + scene1.add(new ActionRemoveActor(0)); + + scene1.add(new ActionWait(10)); + scene1.add(new ActionSetTile(2, 2, 2, new TileEntityFoundryChannel() {{ type = Mats.MAT_GOLD; amount = MaterialShapes.INGOT.q(1); }})); + scene1.add(new ActionWait(10)); + + for(int i = 0; i < 60; i++) { + final int j = i; + scene1.add(new ActionSetTile(2, 1, 1, new TileEntityFoundryMold() {{ slots[0] = new ItemStack(ModItems.mold, 0, 2); type = Mats.MAT_GOLD; amount = MaterialShapes.INGOT.q(j, 60); }})); + scene1.add(new ActionSetTile(1, 2, 2, new TileEntityFoundryMold() {{ slots[0] = new ItemStack(ModItems.mold, 0, 2); type = Mats.MAT_GOLD; amount = MaterialShapes.INGOT.q(j, 60); }})); + scene1.add(new ActionWait(1)); + } + + scene1.add(new ActionWait(2)); + scene1.add(new ActionSetTile(3, 3, 3, new TileEntityFoundryTank())); + scene1.add(new ActionWait(20)); + + scene1.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, -25, new Object[][] {{I18nUtil.resolveKey("cannery.foundryChannel.4")}}, 200) + .setColors(colorCopper).setOrientation(Orientation.LEFT))); + scene1.add(new ActionWait(40)); + scene1.add(new ActionRemoveActor(0)); + scene1.add(new ActionWait(10)); + + scene1.add(new ActionSetTile(2, 2, 2, new TileEntityFoundryChannel())); + scene1.add(new ActionSetTile(3, 2, 2, new TileEntityFoundryChannel())); + scene1.add(new ActionCreateActor(0, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, -25, new Object[][] {{new ItemStack(Items.iron_shovel), " -> ", ItemScraps.create(new MaterialStack(Mats.MAT_GOLD, 1))}}, 200) + .setColors(colorCopper).setOrientation(Orientation.LEFT))); + scene1.add(new ActionWait(40)); + scene1.add(new ActionRemoveActor(0)); + + scene1.add(new ActionWait(60)); + scene1.add(new ActionSetTile(2, 1, 1, new TileEntityFoundryMold() {{ slots[1] = new ItemStack(Items.gold_ingot); }})); + scene1.add(new ActionSetTile(1, 2, 2, new TileEntityFoundryMold() {{ slots[1] = new ItemStack(Items.gold_ingot); }})); + scene1.add(new ActionSetTile(3, 1, 1, new TileEntityFoundryBasin() {{ slots[1] = new ItemStack(Blocks.gold_block); }})); + + script.addScene(scene0); + script.addScene(scene1); + + return script; + } + + public static class TileEntityFauxOutlet extends TileEntityFoundryOutlet { + + public boolean isClosed = false; + + @Override + public boolean isClosed() { return isClosed; } + } +} diff --git a/src/main/java/com/hbm/wiaj/cannery/CannerySILEX.java b/src/main/java/com/hbm/wiaj/cannery/CannerySILEX.java index a59b8f1a0..30e0c66e3 100644 --- a/src/main/java/com/hbm/wiaj/cannery/CannerySILEX.java +++ b/src/main/java/com/hbm/wiaj/cannery/CannerySILEX.java @@ -241,7 +241,7 @@ public class CannerySILEX extends CanneryBase { public static class ActorFEL implements ITileActorRenderer { @Override - public void renderActor(int ticks, float interp, NBTTagCompound data) { + public void renderActor(WorldInAJar world, int ticks, float interp, NBTTagCompound data) { double x = data.getDouble("x"); double y = data.getDouble("y"); double z = data.getDouble("z"); @@ -281,7 +281,7 @@ public class CannerySILEX extends CanneryBase { public static class ActorSILEX implements ITileActorRenderer { @Override - public void renderActor(int ticks, float interp, NBTTagCompound data) { + public void renderActor(WorldInAJar world, int ticks, float interp, NBTTagCompound data) { double x = data.getDouble("x"); double y = data.getDouble("y"); double z = data.getDouble("z"); diff --git a/src/main/java/com/hbm/wiaj/cannery/CanneryStirling.java b/src/main/java/com/hbm/wiaj/cannery/CanneryStirling.java index e150b4959..ea5eb2520 100644 --- a/src/main/java/com/hbm/wiaj/cannery/CanneryStirling.java +++ b/src/main/java/com/hbm/wiaj/cannery/CanneryStirling.java @@ -182,7 +182,7 @@ public class CanneryStirling extends CanneryBase { public static class ActorBurner implements ITileActorRenderer { @Override - public void renderActor(int ticks, float interp, NBTTagCompound data) { + public void renderActor(WorldInAJar world, int ticks, float interp, NBTTagCompound data) { double x = data.getDouble("x"); double y = data.getDouble("y"); double z = data.getDouble("z"); diff --git a/src/main/java/com/hbm/wiaj/cannery/Jars.java b/src/main/java/com/hbm/wiaj/cannery/Jars.java index 30907c583..6398fc5e6 100644 --- a/src/main/java/com/hbm/wiaj/cannery/Jars.java +++ b/src/main/java/com/hbm/wiaj/cannery/Jars.java @@ -17,5 +17,7 @@ public class Jars { canneries.put(new ComparableStack(ModBlocks.machine_fensu), new CanneryFEnSU()); canneries.put(new ComparableStack(ModBlocks.machine_fel), new CannerySILEX()); canneries.put(new ComparableStack(ModBlocks.machine_silex), new CannerySILEX()); + canneries.put(new ComparableStack(ModBlocks.foundry_channel), new CanneryFoundryChannel()); + canneries.put(new ComparableStack(ModBlocks.machine_crucible), new CanneryCrucible()); } } diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 4669e98a1..1f9fd132b 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -324,6 +324,20 @@ cannery.centrifuge.3=Uranium hexafluoride can be processed with just two centrif cannery.centrifuge.4=Fully processing it into Uranium-235 and Uranium-238 requires a total of four centrifuges. cannery.centrifuge.5=Some recipes also require the centrifuge overclocking upgrade. +cannery.crucible=Crucible +cannery.crucible.0=The crucible is used to smelt ores, ingots or other metallic items for alloying and to cast them into different shapes. +cannery.crucible.1=It requires an external heat source connected to the bottom, like a firebox. +cannery.crucible.2=Once heated up, the crucible can be used in two ways, with or without a recipe template. +cannery.crucible.3=The crucible has two storage buffers for material: +cannery.crucible.4=The buffer to the left is for §abyproducts§r, all material smelted without a recipe template will land here. +cannery.crucible.5=If a recipe is installed, materials that do not match the recipe will also be stored here. +cannery.crucible.6=Materials in this buffer will not react with each other, they can only be output from the green outlet for casting. +cannery.crucible.7=The buffer to the right is for §crecipes§r, if a recipe is installed and that particular material is relevant to that recipe, it will land here. +cannery.crucible.8=The materials will slowly combine into the output material which is automatically output from the red outlet. +cannery.crucible.9=Note that only this buffer handles recipes. If a template is installed retroactively, materials in the byproduct buffer will not combine, nor transfer to the recipe buffer. +cannery.crucible.10=The outlet will output material automatically, if the target is valid, for example a foundry channel or a mold. +cannery.crucible.11=As with all foundry blocks, a shovel can be used to remove all material from the crucible. + cannery.fensu=FEnSU cannery.fensu.0=The FEnSU is capable of storing absurd amounts of energy, over 9EHE (that's a nine followed by 18 zeros). cannery.fensu.1=There is only one energy connector which can be found on the bottom. @@ -336,6 +350,13 @@ cannery.firebox.2=Heat is given off by the copper contact at the top of the fire cannery.firebox.3=If heat isn't being used up and the heat buffer becomes full, the firebox will shut off to prevent wasting of fuel. cannery.firebox.4=One such machine is the stirling engine, which will turn heat directly into energy. +cannery.foundryChannel=Foundry Channel +cannery.foundryChannel.0=Foundry channels are used to transport molten material from a crucible or storage tank into molds. +cannery.foundryChannel.1=Channels can receive material either by pouring from the top - via an outlet or directly form a crucible - or from the side from other channels. +cannery.foundryChannel.2=When transporting materials, channels will prioritize blocks like outlets and shallow molds. +cannery.foundryChannel.3=When it cannot supply an outlet or a mold, the material will then flow into a neighboring channel. +cannery.foundryChannel.4=Leftover material can be removed by using a shovel. + cannery.silex=FEL & SILEX cannery.silex.0=The Free Electron Laser (FEL) uses energy and a laser crystal to create a powerful laser beam. cannery.silex.1=Be careful, as the laser will burn/melt through weaker blocks... diff --git a/src/main/resources/assets/hbm/textures/gui/processing/gui_crucible.png b/src/main/resources/assets/hbm/textures/gui/processing/gui_crucible.png index 42e8fb314..684157aa2 100644 Binary files a/src/main/resources/assets/hbm/textures/gui/processing/gui_crucible.png and b/src/main/resources/assets/hbm/textures/gui/processing/gui_crucible.png differ diff --git a/src/main/resources/assets/hbm/textures/models/machines/heating_oven.png b/src/main/resources/assets/hbm/textures/models/machines/heating_oven.png index c441b5062..92cc0d2d5 100644 Binary files a/src/main/resources/assets/hbm/textures/models/machines/heating_oven.png and b/src/main/resources/assets/hbm/textures/models/machines/heating_oven.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 4b575ab7c..e316b0191 100755 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "hbm", "name": "Hbm's Nuclear Tech", "description": "A mod that adds weapons, nuclear themed stuff and machines", - "version":"1.0.27_X4403", + "version":"1.0.27_X4410", "mcversion": "1.7.10", "url": "", "updateUrl": "",