diff --git a/src/main/java/com/hbm/commands/CommandReloadRecipes.java b/src/main/java/com/hbm/commands/CommandReloadRecipes.java new file mode 100644 index 000000000..ea28801d5 --- /dev/null +++ b/src/main/java/com/hbm/commands/CommandReloadRecipes.java @@ -0,0 +1,37 @@ +package com.hbm.commands; + +import com.hbm.inventory.recipes.loader.SerializableRecipe; +import com.hbm.util.ChatBuilder; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +public class CommandReloadRecipes extends CommandBase { + + @Override + public String getCommandName() { + return "ntmreload"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "/ntmreload"; + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + try { + SerializableRecipe.initialize(); + sender.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Reload complete :)")); + } catch(Exception ex) { + sender.addChatMessage(ChatBuilder.start("----------------------------------").color(EnumChatFormatting.GRAY).flush()); + sender.addChatMessage(ChatBuilder.start("An error has occoured during loading, consult the log for details.").color(EnumChatFormatting.RED).flush()); + sender.addChatMessage(ChatBuilder.start(ex.getLocalizedMessage()).color(EnumChatFormatting.RED).flush()); + sender.addChatMessage(ChatBuilder.start(ex.getStackTrace()[0].toString()).color(EnumChatFormatting.RED).flush()); + sender.addChatMessage(ChatBuilder.start("----------------------------------").color(EnumChatFormatting.GRAY).flush()); + throw ex; + } + } +} 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 8e3c85a2f..163a35473 100644 --- a/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java +++ b/src/main/java/com/hbm/inventory/recipes/loader/SerializableRecipe.java @@ -58,6 +58,8 @@ public abstract class SerializableRecipe { for(SerializableRecipe recipe : recipeHandlers) { + recipe.deleteRecipes(); + File recFile = new File(recDir.getAbsolutePath() + File.separatorChar + recipe.getFileName()); if(recFile.exists() && recFile.isFile()) { MainRegistry.logger.info("Reading recipe file " + recFile.getName()); @@ -166,7 +168,7 @@ public abstract class SerializableRecipe { int stacksize = array.size() > 2 ? array.get(2).getAsInt() : 1; if("item".equals(type)) { Item item = (Item) Item.itemRegistry.getObject(array.get(1).getAsString()); - int meta = array.size() > 3 ? array.get(3).getAsInt() : 2; + int meta = array.size() > 3 ? array.get(3).getAsInt() : 0; return new ComparableStack(item, stacksize, meta); } if("dict".equals(type)) { diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index e715ee150..d04e5c040 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -42,6 +42,7 @@ import org.apache.logging.log4j.Logger; import com.google.common.collect.ImmutableList; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockMotherOfAllOres; +import com.hbm.commands.CommandReloadRecipes; import com.hbm.config.*; import com.hbm.creativetabs.*; import com.hbm.entity.EntityMappings; @@ -847,6 +848,7 @@ public class MainRegistry { World world = event.getServer().getEntityWorld(); RBMKDials.createDials(world); SiegeOrchestrator.createGameRules(world); + event.registerServerCommand(new CommandReloadRecipes()); } private void loadConfig(FMLPreInitializationEvent event) { diff --git a/src/main/java/com/hbm/render/block/ct/CT.java b/src/main/java/com/hbm/render/block/ct/CT.java index f9448160a..6e3bf5ca5 100644 --- a/src/main/java/com/hbm/render/block/ct/CT.java +++ b/src/main/java/com/hbm/render/block/ct/CT.java @@ -1,8 +1,5 @@ package com.hbm.render.block.ct; -import java.util.ArrayList; -import java.util.List; - import cpw.mods.fml.client.registry.RenderingRegistry; public class CT { diff --git a/src/main/java/com/hbm/render/block/ct/CTStitchReceiver.java b/src/main/java/com/hbm/render/block/ct/CTStitchReceiver.java index be89c4ef2..e6b661bdc 100644 --- a/src/main/java/com/hbm/render/block/ct/CTStitchReceiver.java +++ b/src/main/java/com/hbm/render/block/ct/CTStitchReceiver.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.util.IIcon; -import net.minecraftforge.client.event.TextureStitchEvent; public class CTStitchReceiver { diff --git a/src/main/java/com/hbm/render/block/ct/IBlockCT.java b/src/main/java/com/hbm/render/block/ct/IBlockCT.java index 58453e4ee..a7896f433 100644 --- a/src/main/java/com/hbm/render/block/ct/IBlockCT.java +++ b/src/main/java/com/hbm/render/block/ct/IBlockCT.java @@ -3,7 +3,6 @@ package com.hbm.render.block.ct; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; public interface IBlockCT { diff --git a/src/main/java/com/hbm/render/block/ct/IconCT.java b/src/main/java/com/hbm/render/block/ct/IconCT.java index dd66acd29..2145bdd72 100644 --- a/src/main/java/com/hbm/render/block/ct/IconCT.java +++ b/src/main/java/com/hbm/render/block/ct/IconCT.java @@ -1,6 +1,5 @@ package com.hbm.render.block.ct; -import static com.hbm.render.block.ct.CT.*; import net.minecraft.util.IIcon; public class IconCT implements IIcon { diff --git a/src/main/java/com/hbm/render/block/ct/RenderBlocksCT.java b/src/main/java/com/hbm/render/block/ct/RenderBlocksCT.java index 5d44aa9b4..e59c4a6b5 100644 --- a/src/main/java/com/hbm/render/block/ct/RenderBlocksCT.java +++ b/src/main/java/com/hbm/render/block/ct/RenderBlocksCT.java @@ -2,7 +2,6 @@ package com.hbm.render.block.ct; import org.lwjgl.opengl.GL11; -import com.hbm.blocks.ModBlocks; import com.hbm.main.MainRegistry; import com.hbm.render.block.ct.CTContext.CTFace; diff --git a/src/main/java/com/hbm/render/tileentity/RenderFENSU.java b/src/main/java/com/hbm/render/tileentity/RenderFENSU.java index 1ace84964..a1c420293 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderFENSU.java +++ b/src/main/java/com/hbm/render/tileentity/RenderFENSU.java @@ -5,12 +5,14 @@ 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.actors.ITileActorRenderer; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -public class RenderFENSU extends TileEntitySpecialRenderer { +public class RenderFENSU extends TileEntitySpecialRenderer implements ITileActorRenderer { @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) { @@ -59,4 +61,58 @@ public class RenderFENSU extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } + @Override + public void renderActor(int ticks, float interp, NBTTagCompound data) { + double x = data.getDouble("x"); + double y = data.getDouble("y"); + double z = data.getDouble("z"); + int rotation = data.getInteger("rotation"); + float lastSpin = data.getFloat("lastSpin"); + float spin = data.getFloat("spin"); + + GL11.glPushMatrix(); + GL11.glTranslated(x + 0.5D, y, z + 0.5D); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glShadeModel(GL11.GL_SMOOTH); + + switch(rotation) { + case 3: GL11.glRotatef(0, 0F, 1F, 0F); break; + case 5: GL11.glRotatef(90, 0F, 1F, 0F); break; + case 2: GL11.glRotatef(180, 0F, 1F, 0F); break; + case 4: GL11.glRotatef(270, 0F, 1F, 0F); break; + } + + ITileActorRenderer.bindTexture(ResourceManager.fensu_tex); + ResourceManager.fensu.renderPart("Base"); + + float rot = lastSpin + (spin - lastSpin) * interp; + + GL11.glTranslated(0, 2.5, 0); + GL11.glRotated(rot, 1, 0, 0); + GL11.glTranslated(0, -2.5, 0); + ResourceManager.fensu.renderPart("Disc"); + ResourceManager.fensu.renderPart("Lights"); + GL11.glShadeModel(GL11.GL_FLAT); + + GL11.glPopMatrix(); + } + + @Override + public void updateActor(int ticks, NBTTagCompound data) { + + float lastSpin = 0; + float spin = data.getFloat("spin"); + float speed = data.getFloat("speed"); + + lastSpin = spin; + spin += speed; + + if(spin >= 360) { + lastSpin -= 360; + spin -= 360; + } + + data.setFloat("lastSpin", lastSpin); + data.setFloat("spin", spin); + } } diff --git a/src/main/java/com/hbm/wiaj/GuiWorldInAJar.java b/src/main/java/com/hbm/wiaj/GuiWorldInAJar.java index c555b6ba4..9a05c907c 100644 --- a/src/main/java/com/hbm/wiaj/GuiWorldInAJar.java +++ b/src/main/java/com/hbm/wiaj/GuiWorldInAJar.java @@ -22,6 +22,7 @@ import com.hbm.wiaj.actions.ActionWait; import com.hbm.wiaj.actors.ActorFancyPanel; import com.hbm.wiaj.actors.ActorTileEntity; import com.hbm.wiaj.actors.ISpecialActor; +import com.hbm.wiaj.cannery.*; import com.hbm.wiaj.actors.ActorFancyPanel.Orientation; import net.minecraft.client.Minecraft; @@ -36,6 +37,8 @@ import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; //krass @@ -50,8 +53,6 @@ public class GuiWorldInAJar extends GuiScreen { super(); this.fontRendererObj = Minecraft.getMinecraft().fontRenderer; WorldInAJar world = new WorldInAJar(15, 15, 15); - renderer = new RenderBlocks(world); - renderer.enableAO = true; testScript = new JarScript(world); JarScene startingScene = new JarScene(testScript); @@ -130,11 +131,20 @@ public class GuiWorldInAJar extends GuiScreen { //brickScene.add(new ActionCreateActor(1, new ActorBasicPanel(0, 0, new Object[]{ new ItemStack(ModItems.ammo_arty, 1, 5)," shit *and* piss" }))); - brickScene.add(new ActionCreateActor(1, new ActorFancyPanel(this.fontRendererObj, 0, 30, new Object[][] {{"I've come to make an announcement: Shadow the Hedgehog's a bitch-ass motherfucker. He pissed on my fucking wife. That's right. He took his hedgehog fuckin' quilly dick out and he pissed on my FUCKING wife, and he said his dick was THIS BIG, and I said that's disgusting. So I'm making a callout post on my Twitter.com. Shadow the Hedgehog, you got a small dick. It's the size of this walnut except WAY smaller. And guess what? Here's what my dong looks like. That's right, baby. Tall points, no quills, no pillows, look at that, it looks like two balls and a bong. He fucked my wife, so guess what, I'm gonna fuck the earth. That's right, this is what you get! My SUPER LASER PISS! Except I'm not gonna piss on the earth. I'm gonna go higher. I'm pissing on the MOOOON! How do you like that, OBAMA? I PISSED ON THE MOON, YOU IDIOT! You have twenty-three hours before the piss DROPLETS hit the fucking earth, now get out of my fucking sight before I piss on you too! "}}, 450) + brickScene.add(new ActionCreateActor(1, new ActorFancyPanel(this.fontRendererObj, 0, 30, new Object[][] {{"I've come to make an announcement: Shadow the Hedgehog's a" + + " bitch-ass motherfucker. He pissed on my fucking wife. That's right. He took his hedgehog fuckin' quilly dick out and he pissed on my FUCKING wife, and he" + + " said his dick was THIS BIG, and I said that's disgusting. So I'm making a callout post on my Twitter.com. Shadow the Hedgehog, you got a small dick. It's" + + " the size of this walnut except WAY smaller. And guess what? Here's what my dong looks like. That's right, baby. Tall points, no quills, no pillows, look " + + "at that, it looks like two balls and a bong. He fucked my wife, so guess what, I'm gonna fuck the earth. That's right, this is what you get! My SUPER LASE" + + "R PISS! Except I'm not gonna piss on the earth. I'm gonna go higher. I'm pissing on the MOOOON! How do you like that, OBAMA? I PISSED ON THE MOON, YOU IDI" + + "OT! You have twenty-three hours before the piss DROPLETS hit the fucking earth, now get out of my fucking sight before I piss on you too! "}}, 450) .setColors(0xFFFDCA88, 0xFFD57C4F, 0xFFAB4223, 0xff1A1F22).setOrientation(Orientation.BOTTOM))); brickScene.add(new ActionWait(200)); - this.testScript.addScene(startingScene).addScene(brickScene); + //this.testScript.addScene(startingScene).addScene(brickScene); + this.testScript = CanneryCentrifuge.createScript(); + renderer = new RenderBlocks(testScript.world); + renderer.enableAO = true; //SKY BLUE: 0xffA5D9FF, 0xff39ACFF, 0xff1A6CA7, 0xff1A1F22 } @@ -147,10 +157,20 @@ public class GuiWorldInAJar extends GuiScreen { testScript.run(); } - this.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); - GL11.glDisable(GL11.GL_LIGHTING); - this.drawGuiContainerForegroundLayer(mouseX, mouseY); - GL11.glEnable(GL11.GL_LIGHTING); + try { + this.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); + GL11.glDisable(GL11.GL_LIGHTING); + this.drawGuiContainerForegroundLayer(mouseX, mouseY); + GL11.glEnable(GL11.GL_LIGHTING); + } catch(Exception ex) { + + for(StackTraceElement line : ex.getStackTrace()) { + this.mc.thePlayer.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + line.toString())); + } + + this.mc.displayGuiScreen((GuiScreen) null); + this.mc.setIngameFocus(); + } } @Override @@ -270,6 +290,9 @@ public class GuiWorldInAJar extends GuiScreen { GL11.glTranslated(width / 2, height / 2, 400); GL11.glScaled(scale, scale, scale); GL11.glScaled(1, 1, 0.5); //incredible flattening power + + double zoom = testScript.zoom(); + GL11.glScaled(zoom, zoom, zoom); GL11.glRotated(testScript.pitch(), 1, 0, 0); GL11.glRotated(testScript.yaw(), 0, 1, 0); diff --git a/src/main/java/com/hbm/wiaj/JarScript.java b/src/main/java/com/hbm/wiaj/JarScript.java index 5261c39db..caa8d65b8 100644 --- a/src/main/java/com/hbm/wiaj/JarScript.java +++ b/src/main/java/com/hbm/wiaj/JarScript.java @@ -6,10 +6,8 @@ import java.util.List; import java.util.Map.Entry; import com.hbm.util.BobMathUtil; -import com.hbm.wiaj.actions.IJarAction; import com.hbm.wiaj.actors.ISpecialActor; -import net.minecraft.init.Blocks; import net.minecraft.util.MathHelper; public class JarScript { @@ -25,6 +23,7 @@ public class JarScript { public double lastOffsetX = 0, offsetX = 0; public double lastOffsetY = 0, offsetY = 0; public double lastOffsetZ = 0, offsetZ = 0; + public double lastZoom = 1, zoom = 1; public float interp = 0F; @@ -79,6 +78,7 @@ public class JarScript { this.lastOffsetX = this.offsetX; this.lastOffsetY = this.offsetY; this.lastOffsetZ = this.offsetZ; + this.lastZoom = this.zoom; if(this.currentScene != null) { @@ -160,6 +160,7 @@ public class JarScript { this.lastOffsetX = this.offsetX = 0D; this.lastOffsetY = this.offsetY = 0D; this.lastOffsetZ = this.offsetZ = 0D; + this.lastZoom = this.zoom = 1D; this.lastRotationYaw = this.rotationYaw = -45D; this.lastRotationPitch = this.rotationPitch = -30D; @@ -194,4 +195,5 @@ public class JarScript { public double offsetX() { return BobMathUtil.interp(this.lastOffsetX, this.offsetX, interp); } public double offsetY() { return BobMathUtil.interp(this.lastOffsetY, this.offsetY, interp); } public double offsetZ() { return BobMathUtil.interp(this.lastOffsetZ, this.offsetZ, interp); } + public double zoom() { return BobMathUtil.interp(this.lastZoom, this.zoom, interp); } } diff --git a/src/main/java/com/hbm/wiaj/WorldInAJar.java b/src/main/java/com/hbm/wiaj/WorldInAJar.java index b83622160..099cdc444 100644 --- a/src/main/java/com/hbm/wiaj/WorldInAJar.java +++ b/src/main/java/com/hbm/wiaj/WorldInAJar.java @@ -54,7 +54,7 @@ public class WorldInAJar implements IBlockAccess { return; this.blocks[x][y][z] = b; - this.meta[x][y][z] = (short) Math.abs(meta % 16); + this.meta[x][y][z] = (short)meta; } @Override @@ -72,9 +72,14 @@ public class WorldInAJar implements IBlockAccess { if(x < 0 || x >= sizeX || y < 0 || y >= sizeY || z < 0 || z >= sizeZ) return null; - //TileEntity tile = this.tiles[x][y][z]; + return this.tiles[x][y][z]; + } + + public void setTileEntity(int x, int y, int z, TileEntity tile) { + if(x < 0 || x >= sizeX || y < 0 || y >= sizeY || z < 0 || z >= sizeZ) + return; - return null; + this.tiles[x][y][z] = tile; } //always render fullbright, if the situation requires it we could add a very rudimentary system that diff --git a/src/main/java/com/hbm/wiaj/actions/ActionOffsetBy.java b/src/main/java/com/hbm/wiaj/actions/ActionOffsetBy.java index 814c1ac09..4035fedb1 100644 --- a/src/main/java/com/hbm/wiaj/actions/ActionOffsetBy.java +++ b/src/main/java/com/hbm/wiaj/actions/ActionOffsetBy.java @@ -32,5 +32,11 @@ public class ActionOffsetBy implements IJarAction { scene.script.offsetX += this.motionX; scene.script.offsetY += this.motionY; scene.script.offsetZ += this.motionZ; + + if(this.time == 0) { + scene.script.lastOffsetX = scene.script.offsetX; + scene.script.lastOffsetY = scene.script.offsetY; + scene.script.lastOffsetZ = scene.script.offsetZ; + } } } diff --git a/src/main/java/com/hbm/wiaj/actions/ActionSetTile.java b/src/main/java/com/hbm/wiaj/actions/ActionSetTile.java new file mode 100644 index 000000000..3317557dc --- /dev/null +++ b/src/main/java/com/hbm/wiaj/actions/ActionSetTile.java @@ -0,0 +1,31 @@ +package com.hbm.wiaj.actions; + +import com.hbm.wiaj.JarScene; +import com.hbm.wiaj.WorldInAJar; + +import net.minecraft.tileentity.TileEntity; + +public class ActionSetTile implements IJarAction { + + int x; + int y; + int z; + TileEntity tile; + + public ActionSetTile(int x, int y, int z, TileEntity tile) { + this.x = x; + this.y = y; + this.z = z; + this.tile = tile; + } + + @Override + public int getDuration() { + return 0; + } + + @Override + public void act(WorldInAJar world, JarScene scene) { + world.setTileEntity(x, y, z, tile); + } +} diff --git a/src/main/java/com/hbm/wiaj/actions/ActionSetZoom.java b/src/main/java/com/hbm/wiaj/actions/ActionSetZoom.java new file mode 100644 index 000000000..23e093a49 --- /dev/null +++ b/src/main/java/com/hbm/wiaj/actions/ActionSetZoom.java @@ -0,0 +1,30 @@ +package com.hbm.wiaj.actions; + +import com.hbm.wiaj.JarScene; +import com.hbm.wiaj.WorldInAJar; + +public class ActionSetZoom implements IJarAction { + + int time; + double zoom; + + public ActionSetZoom(double zoom, int time) { + this.zoom = zoom / (time + 1); + this.time = time; + } + + @Override + public int getDuration() { + return this.time; + } + + @Override + public void act(WorldInAJar world, JarScene scene) { + + if(this.getDuration() == 0) { + scene.script.lastZoom = scene.script.zoom = this.zoom; + } else { + scene.script.zoom += this.zoom; + } + } +} diff --git a/src/main/java/com/hbm/wiaj/actors/ActorTileEntity.java b/src/main/java/com/hbm/wiaj/actors/ActorTileEntity.java index 3cd80af1b..50a1f1650 100644 --- a/src/main/java/com/hbm/wiaj/actors/ActorTileEntity.java +++ b/src/main/java/com/hbm/wiaj/actors/ActorTileEntity.java @@ -2,6 +2,8 @@ package com.hbm.wiaj.actors; import com.hbm.wiaj.JarScene; +import net.minecraft.nbt.NBTTagCompound; + public class ActorTileEntity extends ActorBase { ITileActorRenderer renderer; @@ -9,6 +11,11 @@ public class ActorTileEntity extends ActorBase { public ActorTileEntity(ITileActorRenderer renderer) { this.renderer = renderer; } + + public ActorTileEntity(ITileActorRenderer renderer, NBTTagCompound data) { + this(renderer); + this.data = data; + } @Override public void drawForegroundComponent(int w, int h, int ticks, float interp) { } diff --git a/src/main/java/com/hbm/wiaj/actors/ITileActorRenderer.java b/src/main/java/com/hbm/wiaj/actors/ITileActorRenderer.java index 22fcaa9c5..5c98d5b90 100644 --- a/src/main/java/com/hbm/wiaj/actors/ITileActorRenderer.java +++ b/src/main/java/com/hbm/wiaj/actors/ITileActorRenderer.java @@ -1,9 +1,15 @@ package com.hbm.wiaj.actors; +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 updateActor(int ticks, NBTTagCompound data); + + public static void bindTexture(ResourceLocation tex) { + Minecraft.getMinecraft().getTextureManager().bindTexture(tex); + } } diff --git a/src/main/java/com/hbm/wiaj/cannery/CanneryCentrifuge.java b/src/main/java/com/hbm/wiaj/cannery/CanneryCentrifuge.java new file mode 100644 index 000000000..cff8a1c67 --- /dev/null +++ b/src/main/java/com/hbm/wiaj/cannery/CanneryCentrifuge.java @@ -0,0 +1,169 @@ +package com.hbm.wiaj.cannery; + +import org.lwjgl.opengl.GL11; + +import com.hbm.blocks.ModBlocks; +import com.hbm.inventory.fluid.Fluids; +import com.hbm.items.ModItems; +import com.hbm.main.ResourceManager; +import com.hbm.render.tileentity.RenderFENSU; +import com.hbm.tileentity.network.TileEntityPipeBaseNT; +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.ITileActorRenderer; +import com.hbm.wiaj.actors.ActorFancyPanel.Orientation; + +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +public class CanneryCentrifuge { + + public static JarScript createScript() { + WorldInAJar world = new WorldInAJar(9, 5, 5); + JarScript script = new JarScript(world); + + JarScene scene0 = new JarScene(script); + + scene0.add(new ActionSetZoom(2, 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)); + } + + if(x == 7) { + scene0.add(new ActionSetTile(7, 1, 2, new Dummies.JarDummyConnector())); + scene0.add(new ActionSetBlock(7, 1, 2, ModBlocks.barrel_tcalloy)); + } + + if(x == 6) { + TileEntityPipeBaseNT duct = new TileEntityPipeBaseNT(); + duct.setType(Fluids.UF6); + scene0.add(new ActionSetTile(6, 1, 2, duct)); + scene0.add(new ActionSetBlock(6, 1, 2, ModBlocks.fluid_duct_neo, 0)); + } + + if(x == 5) { + scene0.add(new ActionSetTile(5, 1, 2, new Dummies.JarDummyConnector())); + NBTTagCompound cent = new NBTTagCompound(); + cent.setDouble("x", 5); + cent.setDouble("y", 1); + cent.setDouble("z", 2); + cent.setInteger("rotation", 2); + scene0.add(new ActionCreateActor(0, new ActorTileEntity(new ActorGasCent(), cent))); + } + + scene0.add(new ActionWait(2)); + } + + scene0.add(new ActionCreateActor(1, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, -15, -50, new Object[][] {{"Gas centrifuges can be supplied with fluid " + + "using regular fluid ducts."}}, 200) + .setColors(0xFFFDCA88, 0xFFD57C4F, 0xFFAB4223, 0xff1A1F22).setOrientation(Orientation.BOTTOM))); + + scene0.add(new ActionWait(60)); + scene0.add(new ActionRemoveActor(1)); + + JarScene scene1 = new JarScene(script); + + scene1.add(new ActionCreateActor(1, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, -15, 10, new Object[][] {{"Most recipes require multiple centrifuges. " + + "The intermediate products cannot be transported via pipes."}}, 200) + .setColors(0xFFFDCA88, 0xFFD57C4F, 0xFFAB4223, 0xff1A1F22).setOrientation(Orientation.CENTER))); + + scene1.add(new ActionWait(60)); + scene1.add(new ActionRemoveActor(1)); + + scene1.add(new ActionSetZoom(4, 20)); + + scene1.add(new ActionCreateActor(1, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, 40, new Object[][] {{"This side acts as a connector which " + + "outputs the intermediate product into an adjecent centrifuge."}}, 150) + .setColors(0xFFFDCA88, 0xFFD57C4F, 0xFFAB4223, 0xff1A1F22).setOrientation(Orientation.LEFT))); + + scene1.add(new ActionWait(60)); + scene1.add(new ActionRemoveActor(1)); + scene1.add(new ActionSetZoom(-2, 20)); + scene1.add(new ActionWait(20)); + + NBTTagCompound c2 = new NBTTagCompound(); c2.setDouble("x", 4); c2.setDouble("y", 1); c2.setDouble("z", 2); c2.setInteger("rotation", 2); + scene1.add(new ActionCreateActor(1, new ActorTileEntity(new ActorGasCent(), c2))); + scene1.add(new ActionWait(10)); + + scene1.add(new ActionCreateActor(2, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, 0, new Object[][] {{"Uranium hexafluoride can be processed with just " + + "two centrifuges, this however will produce Uranium fuel and Uranium-238."}}, 200) + .setColors(0xFFFDCA88, 0xFFD57C4F, 0xFFAB4223, 0xff1A1F22).setOrientation(Orientation.CENTER))); + + scene1.add(new ActionWait(100)); + scene1.add(new ActionRemoveActor(2)); + scene1.add(new ActionSetZoom(-2, 20)); + + scene1.add(new ActionCreateActor(2, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, 0, new Object[][] {{"Fully processing it into Uranium-235 and Uranium-238 " + + "requires a total of four centrifuges."}}, 200) + .setColors(0xFFFDCA88, 0xFFD57C4F, 0xFFAB4223, 0xff1A1F22).setOrientation(Orientation.CENTER))); + + scene1.add(new ActionWait(60)); + scene1.add(new ActionRemoveActor(2)); + + NBTTagCompound c3 = new NBTTagCompound(); c3.setDouble("x", 3); c3.setDouble("y", 1); c3.setDouble("z", 2); c3.setInteger("rotation", 2); + scene1.add(new ActionCreateActor(2, new ActorTileEntity(new ActorGasCent(), c3))); + scene1.add(new ActionWait(10)); + NBTTagCompound c4 = new NBTTagCompound(); c4.setDouble("x", 2); c4.setDouble("y", 1); c4.setDouble("z", 2); c4.setInteger("rotation", 2); + scene1.add(new ActionCreateActor(3, new ActorTileEntity(new ActorGasCent(), c4))); + scene1.add(new ActionWait(10)); + + scene1.add(new ActionCreateActor(4, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, 0, new Object[][] {{"Some recipes also require the centrifuge speed upgrade."}}, 200) + .setColors(0xFFFDCA88, 0xFFD57C4F, 0xFFAB4223, 0xff1A1F22).setOrientation(Orientation.CENTER))); + + scene1.add(new ActionWait(60)); + scene1.add(new ActionRemoveActor(4)); + + scene1.add(new ActionCreateActor(4, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 28, -30, new Object[][] {{new ItemStack(ModItems.upgrade_gc_speed)}}, 0) + .setColors(0xFFFDCA88, 0xFFD57C4F, 0xFFAB4223, 0xff1A1F22).setOrientation(Orientation.BOTTOM))); + + scene1.add(new ActionCreateActor(5, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 45, 35, new Object[][] {{" = ", new ItemStack(ModItems.nugget_u238, 11), new ItemStack(ModItems.nugget_u235)}}, 0) + .setColors(0xFFFDCA88, 0xFFD57C4F, 0xFFAB4223, 0xff1A1F22).setOrientation(Orientation.LEFT))); + + script.addScene(scene0).addScene(scene1); + return script; + } + + public static class ActorGasCent implements ITileActorRenderer { + + @Override + public void renderActor(int ticks, float interp, NBTTagCompound data) { + double x = data.getDouble("x"); + double y = data.getDouble("y"); + double z = data.getDouble("z"); + int rotation = data.getInteger("rotation"); + + GL11.glTranslated(x + 0.5D, y, z + 0.5D); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glShadeModel(GL11.GL_SMOOTH); + + switch(rotation) { + case 3: GL11.glRotatef(0, 0F, 1F, 0F); break; + case 5: GL11.glRotatef(90, 0F, 1F, 0F); break; + case 2: GL11.glRotatef(180, 0F, 1F, 0F); break; + case 4: GL11.glRotatef(270, 0F, 1F, 0F); break; + } + + ITileActorRenderer.bindTexture(ResourceManager.gascent_tex); + ResourceManager.gascent.renderPart("Centrifuge"); + ResourceManager.gascent.renderPart("Flag"); + + GL11.glShadeModel(GL11.GL_FLAT); + } + + @Override + public void updateActor(int ticks, NBTTagCompound data) { } + } +} diff --git a/src/main/java/com/hbm/wiaj/cannery/CanneryFEnSU.java b/src/main/java/com/hbm/wiaj/cannery/CanneryFEnSU.java new file mode 100644 index 000000000..418c0551d --- /dev/null +++ b/src/main/java/com/hbm/wiaj/cannery/CanneryFEnSU.java @@ -0,0 +1,95 @@ +package com.hbm.wiaj.cannery; + +import com.hbm.blocks.ModBlocks; +import com.hbm.render.tileentity.RenderFENSU; +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.ActionOffsetBy; +import com.hbm.wiaj.actions.ActionRemoveActor; +import com.hbm.wiaj.actions.ActionRotateBy; +import com.hbm.wiaj.actions.ActionSetBlock; +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.nbt.NBTTagCompound; + +public class CanneryFEnSU { + + public static JarScript createScript() { + WorldInAJar world = new WorldInAJar(11, 5, 5); + JarScript script = new JarScript(world); + + JarScene scene0 = new JarScene(script); + scene0.add(new ActionSetZoom(1.5D, 0)); + scene0.add(new ActionOffsetBy(-2D, 0D, 0D, 0)); + NBTTagCompound fensu = new NBTTagCompound(); + fensu.setDouble("x", 7); + fensu.setDouble("y", 1); + fensu.setDouble("z", 2); + fensu.setInteger("rotation", 4); + fensu.setFloat("speed", 10F); + scene0.add(new ActionCreateActor(0, new ActorTileEntity(new RenderFENSU(), fensu))); + + scene0.add(new ActionCreateActor(1, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, -50, new Object[][] {{"The FEnSU is capable of storing absurd " + + "amounts of energy, over 9EHE (that's a nine followed by 18 zeros)."}}, 200) + .setColors(0xFFFDCA88, 0xFFD57C4F, 0xFFAB4223, 0xff1A1F22).setOrientation(Orientation.BOTTOM))); + scene0.add(new ActionWait(80)); + scene0.add(new ActionRemoveActor(1)); + scene0.add(new ActionWait(10)); + scene0.add(new ActionRotateBy(45, 90, 20)); + + scene0.add(new ActionCreateActor(1, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, 20, new Object[][] {{"There is only one energy connector " + + "which can be found on the bottom."}}, 200) + .setColors(0xFFFDCA88, 0xFFD57C4F, 0xFFAB4223, 0xff1A1F22).setOrientation(Orientation.TOP))); + scene0.add(new ActionWait(60)); + scene0.add(new ActionRemoveActor(1)); + + scene0.add(new ActionCreateActor(1, new ActorFancyPanel(Minecraft.getMinecraft().fontRenderer, 0, 20, new Object[][] {{"This is also the only place where the" + + " FEnSU can receive a redstone signal."}}, 200) + .setColors(0xFFFDCA88, 0xFFD57C4F, 0xFFAB4223, 0xff1A1F22).setOrientation(Orientation.TOP))); + scene0.add(new ActionWait(60)); + scene0.add(new ActionRemoveActor(1)); + + scene0.add(new ActionSetBlock(7, 0, 2, ModBlocks.red_wire_coated)); + scene0.add(new ActionWait(10)); + scene0.add(new ActionSetBlock(6, 0, 2, Blocks.lever, 2)); + scene0.add(new ActionWait(10)); + scene0.add(new ActionRotateBy(0, -60, 20)); + scene0.add(new ActionWait(10)); + scene0.add(new ActionSetBlock(6, 0, 2, Blocks.lever, 10)); + scene0.add(new ActionWait(20)); + scene0.add(new ActionSetBlock(6, 0, 2, Blocks.lever, 2)); + scene0.add(new ActionWait(20)); + scene0.add(new ActionRotateBy(-45, -30, 20)); + scene0.add(new ActionOffsetBy(2D, 0D, 0D, 10)); + /// END OF SCENE 1 /// + + JarScene scene1 = new JarScene(script); + + for(int x = world.sizeX - 1; x >= 0 ; x--) { + for(int z = 0; z < world.sizeZ; z++) { + if(z == 2 && x > 0 && x < 10) + scene1.add(new ActionSetBlock(x, 0, z, ModBlocks.red_wire_coated)); + else + scene1.add(new ActionSetBlock(x, 0, z, Blocks.brick_block)); + } + scene1.add(new ActionWait(2)); + } + + scene1.add(new ActionWait(18)); + scene1.add(new ActionSetBlock(1, 1, 2, ModBlocks.machine_detector)); + scene1.add(new ActionWait(10)); + scene1.add(new ActionSetBlock(1, 1, 2, ModBlocks.machine_detector, 1)); + scene1.add(new ActionWait(60)); + + script.addScene(scene0).addScene(scene1); + return script; + } +} diff --git a/src/main/java/com/hbm/wiaj/cannery/Dummies.java b/src/main/java/com/hbm/wiaj/cannery/Dummies.java new file mode 100644 index 000000000..adbc22ee6 --- /dev/null +++ b/src/main/java/com/hbm/wiaj/cannery/Dummies.java @@ -0,0 +1,20 @@ +package com.hbm.wiaj.cannery; + +import com.hbm.inventory.fluid.FluidType; + +import api.hbm.energy.IEnergyConnector; +import api.hbm.fluid.IFluidConnector; +import net.minecraft.tileentity.TileEntity; + +public class Dummies { + + public static class JarDummyConnector extends TileEntity implements IEnergyConnector, IFluidConnector { + + @Override public boolean isLoaded() { return false; } + @Override public long transferFluid(FluidType type, long fluid) { return 0; } + @Override public long getDemand(FluidType type) { return 0; } + @Override public long transferPower(long power) { return 0; } + @Override public long getPower() { return 0; } + @Override public long getMaxPower() { return 0; } + } +} diff --git a/src/main/java/com/hbm/wiaj/cannery/package-info.java b/src/main/java/com/hbm/wiaj/cannery/package-info.java new file mode 100644 index 000000000..a3380c776 --- /dev/null +++ b/src/main/java/com/hbm/wiaj/cannery/package-info.java @@ -0,0 +1,9 @@ +/** + * @author hbm + */ +package com.hbm.wiaj.cannery; + +/* + * as it turns out, a factory for filling jars is called a "cannery", not a "jarrery", even though they don't necessarily + * fill cans there. well it sure beats calling every damn class a "JarFactory" + */ \ No newline at end of file