• 0

    posted a message on Soul Exploitation - Create mob spawners! New Stable release! - 1.0.2

    It does, so is the server running mc 1.7.10 and forge for 1.7.10 ? The recommended one ?

    Posted in: Minecraft Mods
  • 0

    posted a message on Soul Exploitation - Create mob spawners! New Stable release! - 1.0.2
    Quote from AntVenom»

    My review is up =D.


    Thankyou for the awesome spotlight AntVenom!

    Quote from tomberry87»

    i made a video from italian country whit your mod :D


    Per Italiani : Ragazzi non perdetevi questa mod è molto interessante , compatibile con qualsiasi entità di altre mod e molto piu stabile della vecchia soulshard reborne^^


    I very much appreciate your spotlight thankyou!

    All spotlights will be added on the main post :)_

    Quote from Escman1999»

    isn't this just like soul shards?


    No it is not just like soul shards. The only thing that and this have in common is the ability to make spawners. I have plans for future content such as swords which are only bonded to that soul and can only hurt that mob but doing mass amounts of damage (depends on the tier level).

    Posted in: Minecraft Mods
  • 0

    posted a message on Soul Exploitation - Create mob spawners! New Stable release! - 1.0.2

    Awesome spotlight! Yes, I'll gladly put it on the main post, thankyou!

    Posted in: Minecraft Mods
  • 0

    posted a message on Soul Exploitation - Create mob spawners! New Stable release! - 1.0.2

    Welcome to Soul Exploitation!

    This is a very new mod that adds a couple of blocks and items that can make your mob spawning life much better.

    Note: Although this mod is at a stable release, it still has some bugs. Please message me if you find any.


    Now that that's out of the way, lets begin!

    First off, you're going to need a Mob Crystal. This will allow you to capture a mob by left clicking it (attacking it). Its crafting recipe can be seen here:



    Next, you're going to want to make a Soul Absorber. You need Souls in order to create a Soul Binder for the spawner to work. To get one, simply put a full mob crystal into the absorber.


    Crafting recipe


    The Soul Absorber can only hold one type of mob. To create a soul binder, you need to have a tier of 1 or higher and shift-click it. It will give you the Soul Binder of the current Tier and mob. The tier system works like this:


    Tier 1: 16 Souls

    Tier 2: 64 Souls

    Tier 3: 128 Souls

    Tier 4: 208 Souls

    Tier 5: 336 Souls


    Luckily, you don't have to remember the Tiers, as the Soul Absorber will tell you how many Souls you need to get the next Tier! You'll know you when you've put a mob into the absorber as it will show you the mob on top of it and mousing over the zombie icon in the GUI will tell you.




    So now I have a Tiered Soul Absorber, what now? Like I said, shift right-click it you will get a Soul Binder of that tier and mob, displayed in the tooltip. Now you need to craft a spawner. Once you've got that, simply place it and it looks pretty ordinary. Now right click the new Soul Binder on the spawner. Wolla! The spawning mob is spinning in its spawner and you'll notice it takes your binder.




    Now for the thing most of you probably have been hanging out for (other than the other screenshots :D) what goodies the Tiers do. Glad you asked.


    Tier 1: Exactly like a normal vanilla spawner

    Tier 2: A bit faster, the maximum number of mobs near it before it stops spawning is 6.

    Tier 3: Faster again, and can spawn 8 at a time.

    Tier 4: Even faster, can spawn mobs 6 blocks away.

    Tier 5, The fastest, crazy fast. Can spawn 10 with a maximum of 10 mobs near it before it stops spawning.

    Note: You don't need to be near any tier of spawner for it to spawn! Only the chunk it is in must be loaded.


    New!

    Part of the new 1.0.2 version a block called the Binding Ritual and a new weapon called the Soul Splicer. Firstly, in order to get a Binding Ritual you need the follow in the recipe:



    Once you've made one, place it in the world. Right click an item or block to be put on the altar. Sneak-right click it with an empty hand to get it back. Now to get the Soul Splicer. Firstly put a diamond sword on the altar. Right click the sword with any soul binding. And done! You have a Soul Splicer. Now what can it do? To put it simply, it will do a lot of damage to the mob that was applied to it from the soul binding. The higher the tier, the more damage it does to that mob. Note: It wont do any damage to any other mob. I'll let you discover the effects of having a higher tiered Soul Splicer!




    You can upgrade a Soul Splicer as long as the mob is the same and the Tier you are trying to apply is higher than the current one. Simply put the Splicer on the Altar and right click it with a soul binding of a higher tier and the same mob. Done! Now it has been upgraded.





    Download: Download Soul Exploitation - 1.0.2


    Screenshots!



    Spotlights!


    By SliceOfMeat


    By tomberry87


    By AntVenom


    Changelog


    10/05/2015 - Development started

    -Added Mob Crystal


    11/05/2015

    -Added Soul Absorber


    14/05/2015

    -Added Caged Spawner

    -Added mob render in Soul Absorber

    -Updated to 1.0.1


    28/05/2015

    -Added Binding Ritual

    -Added Soul Splicer

    -Made mobs rotate on the Soul Absorber

    -Updated to 1.0.2


    All suggestions welcome!

    Posted in: Minecraft Mods
  • 0

    posted a message on Creating Entity with NBT

    Oh dammit! I hate this forums code format -_-

    The link is in the thread now.

    Posted in: Modification Development
  • 0

    posted a message on Creating Entity with NBT

    Hello all!

    I'm very curious how and why this does not work:

    Entity e = EntityList.createEntityFromNBT(stack.stackTagCompound.getCompoundTag("EntityNBT"), world);

    When I mean it does not work, all its says when its trying to be spawned is "Skipping entity with ID:"

    Here's my item, thanks in advanced!

    Item: http://pastebin.com/xc7UVNR6

    Posted in: Modification Development
  • 0

    posted a message on [Solved!]Custom Furnace current burn time keeps changes to zero

    Thanks coolAlias, that's the wake-up I needed.

    Posted in: Modification Development
  • 0

    posted a message on [Solved!]Custom Furnace current burn time keeps changes to zero

    Hiya all, I've been making a generator based on a furnace and its going quite well. The only thing is, I want to scale the burn time on the GUI and the current burn time (Burn time for a fresh copy of the item) seems to be changing.

    Example: Put coal in it, coals is 1600, so the current burn time should always be 1600 but it keeps changing to zero, thus giving me a divided by zero crash. Thanks in advanced!


    Crash report:


    net.minecraft.util.ReportedException: Rendering screen
    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1168) ~[EntityRenderer.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1056) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_71]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_71]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_71]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
    at GradleStart.main(GradleStart.java:45) [start/:?]
    Caused by: java.lang.ArithmeticException: / by zero
    at hyper.pipes.tile.TileEntityEnergyGenerator.getScaledBurnTime(TileEntityEnergyGenerator.java:140) ~[TileEntityEnergyGenerator.class:?]
    at hyper.pipes.client.gui.GuiEnergyGenerator.drawGuiContainerBackgroundLayer(GuiEnergyGenerator.java:62) ~[GuiEnergyGenerator.class:?]
    at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:93) ~[GuiContainer.class:?]
    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137) ~[EntityRenderer.class:?]
    ... 11 more
    [23:33:09] [Client thread/INFO] [STDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
    // Daisy, daisy...

    Time: 21/04/15 11:33 PM
    Description: Rendering screen

    java.lang.ArithmeticException: / by zero
    at hyper.pipes.tile.TileEntityEnergyGenerator.getScaledBurnTime(TileEntityEnergyGenerator.java:140)
    at hyper.pipes.client.gui.GuiEnergyGenerator.drawGuiContainerBackgroundLayer(GuiEnergyGenerator.java:62)
    at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:93)
    at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1056)
    at net.minecraft.client.Minecraft.run(Minecraft.java:951)
    at net.minecraft.client.main.Main.main(Main.java:164)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
    at GradleStart.main(GradleStart.java:45)

    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------

    -- Head --
    Stacktrace:
    at hyper.pipes.tile.TileEntityEnergyGenerator.getScaledBurnTime(TileEntityEnergyGenerator.java:140)
    at hyper.pipes.client.gui.GuiEnergyGenerator.drawGuiContainerBackgroundLayer(GuiEnergyGenerator.java:62)
    at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:93)

    -- Screen render details --
    Details:
    Screen name: hyper.pipes.client.gui.GuiEnergyGenerator
    Mouse location: Scaled: (213, 119). Absolute: (427, 240)
    Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2

    -- Affected level --


    TileEntityEnergyGenerator class:


    [/p]
    [p]package hyper.pipes.tile;[/p]
    [p]import hyper.pipes.energy.IEnergyBattery;
    import hyper.pipes.energy.IEnergyGenerator;
    import hyper.pipes.energy.IEnergySink;
    import hyper.pipes.handlers.GeneratorRecipes;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.init.Blocks;
    import net.minecraft.inventory.ISidedInventory;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemBlock;
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.nbt.NBTTagList;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraftforge.common.util.ForgeDirection;[/p]
    [p]public class TileEntityEnergyGenerator extends TileEnergyGenerator implements ISidedInventory{[/p]
    [p]public static int[] slot_top = new int[]{0};
     
     private ItemStack[] generator_slots = new ItemStack[1]; //one slot, slot if for fuel
     
     public int maxEnergy = 0;
     public int currentEnergy = 0;
     public int energyOutput = 0;
     /** The number of ticks that a fresh copy of the currently-burning item would keep the furnace burning for */
     public int currentBurnTime;
     /** The number of ticks that the current item has been cooking for */
     public int fuelCookTime;
     
     public TileEntityEnergyGenerator() {
     this.maxEnergy = 10000;
     this.energyOutput = 10;
     this.currentEnergy = 0;
     
     
     }
     
     @Override
     public void updateEntity() {
     boolean isBurning = this.fuelCookTime > 0;
     boolean flag = false;
     if(this.fuelCookTime > 0) //if the generator is burning, decrease time every tick
     {
     this.fuelCookTime--;
     //create power here
     }
     // System.out.println("Fuel cook time: " + fuelCookTime);
     if(!this.worldObj.isRemote)
     {
     if (this.fuelCookTime != 0 || this.generator_slots[0] != null) // checks if is burning or there is something in the fuel slot
     {
     //System.out.println("Something worked here");
     // System.out.println("Can burn == " + this.canBurn());
     
     if(this.fuelCookTime == 0 && this.canBurn()) //check if the generator isnt burning but it can
     {
     
     //if so, set the amount to burn for to the total burn time of the fuel
     //System.out.println("Current burn time and fuel time: " + this.fuelCookTime);
     if(this.fuelCookTime == 0) //check if it is burning 
     {
     
     this.fuelCookTime = this.currentBurnTime = getItemBurnTime(this.generator_slots[0]);
     flag = true; //flag for update is set to true
     if(this.generator_slots[0] != null) //check if there is something in fuel slot
     {
     this.generator_slots[0].stackSize -= 1; //if so, decrease it by one
     
     
     if(this.generator_slots[0].stackSize == 0) //if there is nothing in the fuel slot
     {
     this.generator_slots[0] = generator_slots[0].getItem().getContainerItem(this.generator_slots[0]);
     }
     
     }
     }
     }
     }
     if(this.fuelCookTime < 0)
     {
     flag = true;
     //update block state
     }
     if(flag)
     {
     this.markDirty();
     }
     
     }
     
     outputEnergyPerTick();
     
     }
     
     private void createEnergy() {
     
     System.out.println("Creating energy");
     }[/p]
    [p]private boolean canBurn() {
     
     if(this.getCurrentEnergy() < this.getEnergyMax())
     {
     // System.out.println("Has energy");
     int energyThatCanBeCreated = GeneratorRecipes.getEnergyPerTickFromStack(this.generator_slots[0]);
     //System.out.println(energyThatCanBeCreated);
     int currentSpace = this.getCurrentEnergy() - this.getEnergyMax();
     // System.out.println(currentSpace);
     return currentSpace <= energyThatCanBeCreated;
     }
     else
     {
     return false;
     }
     }[/p]
    [p]public boolean isBurning() {
     
     return fuelCookTime > 0;
     }
     
     public boolean hasItemBurnTime()
     {
     return currentBurnTime > 0;
     }
     
     public int getScaledBurnTime(int par1)
     {
     NBTTagCompound tag = new NBTTagCompound();
     
     if (this.currentBurnTime == 0)
     {
     System.out.println("Current burn time did equal zero");
     this.currentBurnTime = (int)tag.getShort("CurrentCookTime");
     }
     return this.fuelCookTime * par1 / this.currentBurnTime;
     }
     
     @Override
     public int getEnergyMax() {
     
     return this.maxEnergy;
     }[/p]
    [p]@Override
     public int getCurrentEnergy() {
     
     return this.currentEnergy;
     }[/p]
    [p]@Override
     public void setEnergyOutput(int energyValue) {
     energyValue = this.energyOutput;
     
     }[/p]
    [p]@Override
     public int getEnergyOutput() {
     
     return energyOutput;
     }
     
     @Override
     public int canFill(ForgeDirection dir, int input, boolean doFill) {
     
     return 0;
     }[/p]
    [p]@Override
     public void setCurrentEnergy(int energy) {
     
     this.currentEnergy = energy;
     }[/p]
    [p]@Override
     public void setMaxEnergy(int energyMax) {
     this.maxEnergy = energyMax;
     
     }
     
     @Override
     public void writeToNBT(NBTTagCompound nbt) {
     
     super.writeToNBT(nbt);
     nbt.setInteger("CurrentEnergy", this.getCurrentEnergy());
     nbt.setInteger("MaxOutput", this.getEnergyOutput()); 
     
     nbt.setShort("BurnTime", (short) this.fuelCookTime);
     nbt.setShort("CurrentCookTime",(short) this.currentBurnTime);
     
     NBTTagList tagList = new NBTTagList();[/p]
    [p]for (int i = 0; i < this.generator_slots.length; ++i) {
     if (this.generator_slots[i] != null) {
     NBTTagCompound tagCompound1 = new NBTTagCompound();
     tagCompound1.setByte("Slot", (byte) i);
     this.generator_slots[i].writeToNBT(tagCompound1);
     tagList.appendTag(tagCompound1);
     }
     }[/i][/i][/p]
    [p][i][i] nbt.setTag("Items", tagList);
     
     
     }
     @Override
     public void readFromNBT(NBTTagCompound tag) {
     
     super.readFromNBT(tag);
     this.setCurrentEnergy(tag.getInteger("CurrentEnergy"));
     this.setEnergyOutput(tag.getInteger("MaxOutput"));
     
     NBTTagList tagList = tag.getTagList("Items", 10);
     this.generator_slots = new ItemStack[this.getSizeInventory()];[/i][/i][/p]
    [p][i][i] for (int i = 0; i < tagList.tagCount(); ++i) {
     NBTTagCompound tabCompound1 = tagList.getCompoundTagAt(i);
     byte byte0 = tabCompound1.getByte("Slot");[/i][/i][/p]
    [p][i][i] if (byte0 >= 0 && byte0 < this.generator_slots.length) {
     this.generator_slots[byte0] = ItemStack.loadItemStackFromNBT(tabCompound1);
     }
     }[/i][/i][/p]
    [p][i][i] this.fuelCookTime = tag.getShort("BurnTime");
     
     this.currentBurnTime = tag.getShort("CurrentCookTime");
     
     }[/i][/i][/p]
    [p][i][i] private int getItemBurnTime(ItemStack itemStack) {
     
     if(itemStack == null)
     {
     return 0;
     }
     else
     {
     return GeneratorRecipes.getEnergyPerTickFromStack(itemStack);
     
     }
     }[/i][/i][/p]
    [p][i][i] @Override
     public int getSizeInventory() {
     
     return this.generator_slots.length;
     }[/i][/i][/p]
    [p][i][i] @Override
     public ItemStack getStackInSlot(int slot) {
     
     return this.generator_slots[slot];
     }[/i][/i][/p]
    [p][i][i] @Override
     public ItemStack decrStackSize(int par1, int par2) {
     if(this.generator_slots[par1] != null)
     {
     ItemStack stack;
     if(this.generator_slots[par1].stackSize <= par2)
     {
     stack = this.generator_slots[par1];
     this.generator_slots[par1] = null;
     return stack;
     }
     else {
     stack = this.generator_slots[par1].splitStack(par2);[/i][/i][/p]
    [p][i][i] if (this.generator_slots[par1].stackSize == 0) {
     this.generator_slots[par1] = null;
     }
     return stack;
     }
     } else {
     return null;
     }
     }[/i][/i][/p]
    [p][i][i] @Override
     public ItemStack getStackInSlotOnClosing(int slot) {
     if (this.generator_slots[slot] != null) {
     ItemStack itemstack = this.generator_slots[slot];
     this.generator_slots[slot] = null;
     return itemstack;
     } else {
     return null;
     }
     }[/i][/i][/p]
    [p][i][i] @Override
     public void setInventorySlotContents(int slot, ItemStack stack) {
     this.generator_slots[slot] = stack;[/i][/i][/p]
    [p][i][i] if (stack != null && stack.stackSize > this.getInventoryStackLimit()) {
     stack.stackSize = this.getInventoryStackLimit();
     }
     
     }[/i][/i][/p]
    [p][i][i] 
     
     
     
     @Override
     public String getInventoryName() {
     
     return "Energy Generator";
     }[/i][/i][/p]
    [p][i][i] @Override
     public boolean hasCustomInventoryName() {
     
     return true;
     }[/i][/i][/p]
    [p][i][i] @Override
     public int getInventoryStackLimit() {
     
     return 64;
     }[/i][/i][/p]
    [p][i][i] @Override
     public boolean isUseableByPlayer(EntityPlayer player) {
     
     return (player.getDistanceSq(xCoord, yCoord, zCoord) <= (double)5);
     }[/i][/i][/p]
    [p][i][i] @Override
     public void openInventory() {}[/i][/i][/p]
    [p][i][i] @Override
     public void closeInventory() {}[/i][/i][/p]
    [p][i][i] @Override
     public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
     // TODO Auto-generated method stub
     return false;
     }[/i][/i][/p]
    [p][i][i] @Override
     public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
     // TODO Auto-generated method stub
     return null;
     }[/i][/i][/p]
    [p][i][i] @Override
     public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_,
     int p_102007_3_) {
     // TODO Auto-generated method stub
     return false;
     }[/i][/i][/p]
    [p][i][i] @Override
     public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_,
     int p_102008_3_) {
     // TODO Auto-generated method stub
     return false;
     }
     
    }
    [/i][/i][/p]
    [p]


    GuiEnergyGenerator class:


    [/p]
    [p]package hyper.pipes.client.gui;[/p]
    [p]import hyper.pipes.Constants;
    import hyper.pipes.inventory.ContainerEnergyGenerator;
    import hyper.pipes.tile.TileEntityEnergyGenerator;
    import net.minecraft.client.gui.inventory.GuiContainer;
    import net.minecraft.client.resources.I18n;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.inventory.Container;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;[/p]
    [p]public class GuiEnergyGenerator extends GuiContainer{[/p]
    [p]private World world;
     private EntityPlayer player;
     private TileEntityEnergyGenerator generator;
     ResourceLocation textures = new ResourceLocation(Constants.MODID + ":" + "textures/gui/gui_energy_generator.png");
     private int x, y, z;
     private int xSize, ySize;
     
     
     public GuiEnergyGenerator(World world, EntityPlayer player, TileEntityEnergyGenerator gen, int x, int y, int z) {
     super(new ContainerEnergyGenerator(gen, player.inventory));
     this.world = world;
     this.player = player;
     this.generator = gen;
     this.x = x;
     this.y = y;
     this.z = z;
     this.xSize = 176;
     this.ySize = 166;
     
     }[/p]
    [p]@Override
     public boolean doesGuiPauseGame() {
     
     return false;
     }
     
     @Override
     protected void drawGuiContainerForegroundLayer(int p_146979_1_,
     int p_146979_2_) {
     String s = this.generator.hasCustomInventoryName() ? this.generator.getInventoryName() : I18n.format(this.generator.getInventoryName(), new Object[0]);
     this.fontRendererObj.drawString("Custom Furnace", this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
     this.fontRendererObj.drawString("Inventory", 8, this.ySize - 96 + 2, 4210752);
     }
     
     @Override
     protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
     int p_146976_2_, int p_146976_3_) {
     
     mc.getTextureManager().bindTexture(textures);
     int x = (this.width - this.xSize) / 2;
     int y = (this.height - this.ySize) / 2;
     drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
     //System.out.println("Generator is burning == " + this.generator.isBurning());
     if (this.generator.isBurning())
     {
     System.out.println("Is Burning and should be scaling");
     int i1 = this.generator.getScaledBurnTime(13);
     this.drawTexturedModalRect(x + 56, y + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 1);
     }
     
     }[/p]
    [p]}[/p]
    [p]


    Posted in: Modification Development
  • 0

    posted a message on The Scouter - See Mob Properties such as Health!

    Thanks man :)

    Posted in: WIP Mods
  • 1

    posted a message on The Scouter - See Mob Properties such as Health!

    The Scouter! What does it do you might ask? Put it on and have a look!

    Note: This is just a Work In Progress, not all features and bugs have been implemented or fixed!


    To create it, you need two items first: The Scouter Lens and the Scouter System. Once you have them, just put them together and walah!

    We are going to implement it into baubles instead of as an armor piece. Once you've got the head piece on, nothing seems to look any different. Press the '0' key by default, (can be configured in controls) and the HUD shows up! The bar on the top left hand corner while display the health of the mob you are looking at. Underneath that bar, shows the "Power level" or how much health the mob has, in half hearts.

    See attached images for the scouter mod!

    Posted in: WIP Mods
  • 0

    posted a message on [RESLOVED] Modeled Helmet bug, renders 2D texture around the head like a helmet

    Okay, I've narrowed it down to a rendering bug. The model and texture are fine, somehow, when I render it on the player, probably in the helmet class, it gives that weird headwear I dont want. How do I fix it?

    Posted in: Modification Development
  • 0

    posted a message on [RESLOVED] Modeled Helmet bug, renders 2D texture around the head like a helmet

    Hello all! I need a bit of help. I'm creating a 3D model for my helmet, and I keep getting the texture of the model showing around the head like a helmet (See attached image) Whats up with that? My model works fine, but I just have this weird bug with the texture showing around the players head. How do I get rid of it?

    Here is my Helmet Class:


    </p> <p>package hyper.scouter.items;</p> <p> import hyper.scouter.ScouterMod;<br>import net.minecraft.client.gui.ScaledResolution;<br>import net.minecraft.client.model.ModelBiped;<br>import net.minecraft.entity.Entity;<br>import net.minecraft.entity.EntityLivingBase;<br>import net.minecraft.entity.player.EntityPlayer;<br>import net.minecraft.item.ItemArmor;<br>import net.minecraft.item.ItemStack;<br>import net.minecraft.world.World;</p> <p>public class ScouterHelmet extends ItemArmor{</p> <p>public ScouterHelmet(ArmorMaterial armor, int render, int slot) {<br> super(armor, render, slot);<br> setCreativeTab(ScouterMod.ScouterTab);<br> <br> }<br> <br> @Override<br> public String getArmorTexture(ItemStack stack, Entity entity, int slot,<br> String type) {<br> <br> if(stack.getItem() == ScouterItems.scouterHelmet)<br> {<br> return "scouter:textures/models/Scouter12.png";<br> }<br> return null;<br> }<br> <br> @Override<br> public void onArmorTick(World world, EntityPlayer player,<br> ItemStack itemStack) {<br> <br> <br> <br> }<br> <br> <br> @Override<br> public ModelBiped getArmorModel(EntityLivingBase entityLiving,<br> ItemStack itemStack, int armorSlot) {<br> ModelBiped armorModel = null; if(itemStack != null){ <br> if(itemStack.getItem() instanceof ScouterHelmet){ <br> int type = ((ItemArmor)itemStack.getItem()).armorType; <br> if(type == 0){ <br> armorModel = ScouterMod.proxy.getArmorModel(0);<br> if(armorModel != null){ <br> armorModel.bipedHead.showModel = armorSlot == 0; <br> <br> //armorModel.bipedHeadwear.showModel = armorSlot == 0;<br> armorModel.bipedBody.showModel = armorSlot == 1 || armorSlot == 2;<br> armorModel.bipedRightArm.showModel = armorSlot == 1;<br> armorModel.bipedLeftArm.showModel = armorSlot == 1;<br> armorModel.bipedRightLeg.showModel = armorSlot == 2 || armorSlot == 3; <br> armorModel.bipedLeftLeg.showModel = armorSlot == 2 || armorSlot == 3; <br> armorModel.isSneak = entityLiving.isSneaking(); <br> armorModel.isRiding = entityLiving.isRiding(); <br> armorModel.isChild = entityLiving.isChild(); <br> // entityLiving.getCurrentItemOrArmor(0) != null ? 1 :0; <br> <br> if(entityLiving instanceof EntityPlayer){ <br> armorModel.aimedBow =((EntityPlayer)entityLiving).getItemInUseDuration() > 2;<br> } <br> return armorModel;<br> }<br> <br> } <br> }<br> <br> }<br> return armorModel;<br> } <br> <br>}</p> <p>


    Here is my model class:


    </p> <p>// Date: 13/04/2015 9:31:03 PM<br>// Template version 1.1<br>// Java generated by Techne<br>// Keep in mind that you still need to fill in some blanks<br>// - ZeuX</p> <br><br><p> package hyper.scouter;</p> <p>import net.minecraft.client.model.ModelBiped;<br>import net.minecraft.client.model.ModelRenderer;<br>import net.minecraft.entity.Entity;</p> <p>public class ModelScouter extends ModelBiped<br>{<br> //fields<br> ModelRenderer scouterbase;<br> ModelRenderer scouterarm;<br> ModelRenderer scouterlens;<br> ModelRenderer scouterpc;<br> <br> <br> public ModelScouter(float f)<br> {<br> super(f, 0, 64, 32);<br> <br> scouterbase = new ModelRenderer(this, 32, 0);<br> scouterbase.addBox(4F, -7F, -3F, 1, 5, 4);<br> scouterbase.setRotationPoint(0F, 0F, 0F);<br> scouterbase.setTextureSize(64, 32);<br> scouterbase.mirror = true;<br> setRotation(scouterbase, 0F, 0F, 0F);<br> this.bipedHeadwear.addChild(scouterbase);<br> scouterarm = new ModelRenderer(this, 42, 0);<br> scouterarm.addBox(4F, -6F, -5F, 1, 3, 2);<br> scouterarm.setRotationPoint(0F, 0F, 0F);<br> scouterarm.setTextureSize(64, 32);<br> scouterarm.mirror = true;<br> setRotation(scouterarm, 0F, 0F, 0F);<br> this.bipedHeadwear.addChild(scouterarm);<br> scouterlens = new ModelRenderer(this, 48, 0);<br> scouterlens.addBox(1F, -6F, -5F, 4, 3, 0);<br> scouterlens.setRotationPoint(0F, 0F, 0F);<br> scouterlens.setTextureSize(64, 32);<br> scouterlens.mirror = true;<br> setRotation(scouterlens, 0F, 0F, 0F);<br> this.bipedHeadwear.addChild(scouterlens);<br> scouterpc = new ModelRenderer(this, 32, 9);<br> scouterpc.addBox(5F, -6F, -2F, 1, 3, 2);<br> scouterpc.setRotationPoint(0F, 0F, 0F);<br> scouterpc.setTextureSize(64, 32);<br> scouterpc.mirror = true;<br> setRotation(scouterpc, 0F, 0F, 0F);<br> this.bipedHeadwear.addChild(scouterpc);<br> <br> }<br> <br> public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)<br> {<br> super.render(entity, f, f1, f2, f3, f4, f5);<br> setRotationAngles(f, f1, f2, f3, f4, f5, entity);<br> <br> <br> }<br> <br> private void setRotation(ModelRenderer model, float x, float y, float z)<br> {<br> model.rotateAngleX = x;<br> model.rotateAngleY = y;<br> model.rotateAngleZ = z;<br> }<br> </p> <p>}</p> <p>


    Thanks in advanced!


    EDIT: SOLVED! I had in the model each part being a child of the headwear, which is why it rendered as well, headwear.

    Posted in: Modification Development
  • 0

    posted a message on NBT Not working in Tile Entity
    Okay, so I have a tile entity in my block and I need it to save the Forge Direction of where it is facing when you place it. For some reason It writes to it fine, but it doesnt load it, here is my tile entity: and yes it is registered. Thanks in advanced

    package ryan.mod.tile;
    import java.util.ArrayList;
    import ryan.mod.utils.ForgeDirectionUtils;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.init.Blocks;
    import net.minecraft.init.Items;
    import net.minecraft.inventory.IInventory;
    import net.minecraft.item.ItemPickaxe;
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.nbt.NBTTagList;
    import net.minecraft.network.NetworkManager;
    import net.minecraft.network.Packet;
    import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.world.World;
    import net.minecraftforge.common.util.ForgeDirection;
    public class TileQuarryBlock extends TileEntity implements IInventory {

    public boolean clicked = false;
    int i = 0;
    int j = 0;
    int k= 1;
    int l = 0;
    private boolean needsUpdate = false;
    int harvestLevel = 4;
    ItemStack items[] = new ItemStack[1];
    public ForgeDirection direction;
    public TileQuarryBlock() {
    direction = ForgeDirection.UNKNOWN;
    }





    @Override
    public void updateEntity() {

    needsUpdate = true;
    if (needsUpdate)
    {
    if (i == 0)
    {
    i = 20; // every 1 ticks it will send an update
    }
    else
    {
    --i;
    if (i == 0)
    {
    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
    if(items[0] != null)
    {

    onActivated(xCoord, k, zCoord);
    k++;
    }


    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
    needsUpdate = false;
    }
    }
    }
    }

    public void onActivated(int i,int j, int k)
    {

    int y = yCoord - j;
    mine(i, y, k);

    }

    public void mineInCube(World world, int i, int j, int k)
    {
    System.out.println(ForgeDirectionUtils.mineInCube(getFacingDirection(), i, k));

    }

    public void mine(int i, int j, int k)
    {

    if(items[0].getItem() != null)
    {
    if(items[0].getItem() == Items.wooden_pickaxe)
    {
    harvestLevel = 0;
    }
    else if(items[0].getItem() == Items.stone_pickaxe)
    {
    harvestLevel = 1;
    }
    else if(items[0].getItem() == Items.iron_pickaxe)
    {
    harvestLevel = 2;
    }
    else if(items[0].getItem() == Items.diamond_pickaxe)
    {
    harvestLevel = 3;
    }

    if(j != 0 && harvestLevel != 4){
    if(worldObj.getBlock(i, j, k).getHarvestLevel(worldObj.getBlockMetadata(i, j, k)) != -1)
    {
    if(worldObj.getBlock(i, j, k).getHarvestLevel(worldObj.getBlockMetadata(i, j, k)) <= harvestLevel)
    {
    moveToAdjacentChest(worldObj, worldObj.getBlock(i, j, k).getDrops(worldObj, i, j, k, 0, 0), xCoord, yCoord, zCoord);

    worldObj.setBlockToAir(i, j, k);
    items[0].getItem().setDamage(items[0], items[0].getItem().getDamage(items[0]) - 1);
    }
    }
    else if(worldObj.getBlock(i, j, k) == Blocks.bedrock)
    {
    clicked = false;
    }
    }
    else if(j == 0)
    {
    clicked = false;
    }
    }
    else
    {
    clicked = false;

    }

    }
    private void moveToAdjacentChest(World world, ArrayList<ItemStack> arrayList, int x, int y, int z) {

    for(ForgeDirection dir : ForgeDirection.values())
    {
    if(world.getTileEntity(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) instanceof IInventory)
    {

    IInventory inventory = (IInventory)world.getTileEntity(x + dir.offsetX, y, z + dir.offsetZ);
    if(inventory != null && !(inventory instanceof TileQuarryBlock))
    {
    for(int i = 0; i < inventory.getSizeInventory(); i++)
    {
    for(ItemStack stack : arrayList)
    {
    if(inventory.getStackInSlot(i) == null)
    {
    inventory.setInventorySlotContents(i, stack.copy());
    return;
    }
    else if(inventory.getStackInSlot(i).getItem() == stack.getItem() && inventory.getStackInSlot(i).stackSize < inventory.getInventoryStackLimit())
    {
    inventory.getStackInSlot(i).stackSize += stack.stackSize;
    return;
    }


    }

    }
    }
    }
    }
    }
    @Override
    public int getSizeInventory() {

    return items.length;
    }
    @Override
    public ItemStack getStackInSlot(int slot) {

    return items[slot];
    }
    @Override
    public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {

    if (this.items[p_70298_1_] != null)
    {
    ItemStack itemstack;
    if (this.items[p_70298_1_].stackSize <= p_70298_2_)
    {
    itemstack = this.items[p_70298_1_];
    this.items[p_70298_1_] = null;
    return itemstack;
    }
    else
    {
    itemstack = this.items[p_70298_1_].splitStack(p_70298_2_);
    if (this.items[p_70298_1_].stackSize == 0)
    {
    this.items[p_70298_1_] = null;
    }
    return itemstack;
    }
    }
    else
    {
    return null;
    }
    }
    @Override
    public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
    if (this.items[p_70304_1_] != null)
    {
    ItemStack itemstack = this.items[p_70304_1_];
    this.items[p_70304_1_] = null;
    return itemstack;
    }
    else
    {
    return null;
    }
    }
    @Override
    public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
    this.items[p_70299_1_] = p_70299_2_;
    if (p_70299_2_ != null && p_70299_2_.stackSize > this.getInventoryStackLimit())
    {
    p_70299_2_.stackSize = this.getInventoryStackLimit();
    }

    }
    @Override
    public String getInventoryName() {

    return "Quarry";
    }
    @Override
    public boolean hasCustomInventoryName() {

    return true;
    }
    @Override
    public int getInventoryStackLimit() {

    return 1;
    }
    @Override
    public boolean isUseableByPlayer(EntityPlayer entityplayer) {

    return entityplayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) <= 64;
    }
    @Override
    public void openInventory() {
    // TODO Auto-generated method stub

    }
    @Override
    public void closeInventory() {
    // TODO Auto-generated method stub

    }
    @Override
    public void readFromNBT(NBTTagCompound tag) {
    super.readFromNBT(tag);

    direction = ForgeDirection.getOrientation(tag.getInteger("dire"));
    // System.out.println("Read: " + ForgeDirectionUtils.getDirectionFromInt(tag.getInteger("dire")));
    // System.out.println("Read: " +tag.getBoolean("Bool"));
    NBTTagList nbttaglist = tag.getTagList("Items", 10);
    this.items = new ItemStack[this.getSizeInventory()];
    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
    NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
    byte b0 = nbttagcompound1.getByte("Slot");
    if (b0 >= 0 && b0 < this.items.length)
    {
    this.items[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
    }
    }
    }

    @Override
    public void writeToNBT(NBTTagCompound tag) {
    tag.setInteger("dire", ForgeDirectionUtils.convertDirectionToInt(direction));
    tag.setBoolean("Bool", true);
    // System.out.println("Wrote: " +tag.getInteger("dire"));
    // System.out.println("Wrote: " +tag.getBoolean("Bool"));
    NBTTagList nbttaglist = new NBTTagList();
    for (int i = 0; i < this.items.length; ++i)
    {
    if (this.items[i] != null)
    {
    NBTTagCompound nbttagcompound1 = new NBTTagCompound();
    nbttagcompound1.setByte("Slot", (byte)i);
    this.items[i].writeToNBT(nbttagcompound1);
    nbttaglist.appendTag(nbttagcompound1);
    }
    }
    tag.setTag("Items", nbttaglist);
    }

    public void setFacingDirection(ForgeDirection dire)
    {
    this.direction = dire;
    }

    public ForgeDirection getFacingDirection()
    {
    return this.direction;
    }

    @Override
    public boolean isItemValidForSlot(int slot, ItemStack stack) {
    if(stack.getItem() instanceof ItemPickaxe)
    {
    return true;
    }
    else
    return false;
    }


    @Override
    public Packet getDescriptionPacket()
    {
    NBTTagCompound tag = new NBTTagCompound();
    writeToNBT(tag);
    return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag);
    }
    @Override
    public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
    {
    NBTTagCompound tag = pkt.func_148857_g();
    readFromNBT(tag);
    }
    }


    [i][i]
    [/i][/i]
    Posted in: Modification Development
  • 0

    posted a message on [1.7.10]Minecraft Forge Modding Tutorials! - Now with Custom Fluid Tank Tutorial and Structure Generation!
    Yes, I was informed about that. I will explain the code, its just school has been getting on my nerves lately.
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on [1.7.10]Minecraft Forge Modding Tutorials! - Now with Custom Fluid Tank Tutorial and Structure Generation!
    Custom Fluid Tank
    Hello again! I couldnt get the code for this on my website just yet, so I'll put it here instead. Remember! Not all the code is copy paste, all things that arent are basic things you should know like texture registry and language localisations.
    Here are the classes you need:
    Block



     package forgingmc.minecraftthing.blocks;<br>import java.util.Random;<br> <br> <br> <br>import cpw.mods.fml.common.registry.GameRegistry;<br>import forgingmc.minecraftthing.Constants;<br>import forgingmc.minecraftthing.ForgingMC;<br>import forgingmc.minecraftthing.Utils;<br>import forgingmc.minecraftthing.items.ItemBlockLeadTank;<br>import forgingmc.minecraftthing.render.RenderLeadTank;<br>import forgingmc.minecraftthing.tile.TileLeadTank;<br>import net.minecraft.block.Block;<br>import net.minecraft.block.BlockContainer;<br>import net.minecraft.block.ITileEntityProvider;<br>import net.minecraft.block.material.Material;<br>import net.minecraft.creativetab.CreativeTabs;<br>import net.minecraft.entity.Entity;<br>import net.minecraft.entity.EntityLivingBase;<br>import net.minecraft.entity.player.EntityPlayer;<br>import net.minecraft.item.ItemStack;<br>import net.minecraft.nbt.NBTTagCompound;<br>import net.minecraft.tileentity.TileEntity;<br>import net.minecraft.util.IIcon;<br>import net.minecraft.util.MovingObjectPosition;<br>import net.minecraft.world.EnumSkyBlock;<br>import net.minecraft.world.Explosion;<br>import net.minecraft.world.IBlockAccess;<br>import net.minecraft.world.World;<br>import net.minecraftforge.common.util.ForgeDirection;<br>import net.minecraftforge.fluids.FluidContainerRegistry;<br>import net.minecraftforge.fluids.FluidStack;<br>import net.minecraftforge.fluids.FluidTankInfo;<br>public class LeadTank extends Block implements ITileEntityProvider{<br>public static int renderID;<br>public static IIcon icon;<br>public LeadTank() {<br> super(Material.glass);<br> setBlockName(Constants.MOD_ID + "_" + Constants.LEAD_TANK_NAME);<br> setBlockTextureName(Constants.MOD_ID + ":" + Constants.LEAD_TANK_TEXTURE);<br> setCreativeTab(ForgingMC.forgingMCTab);<br> GameRegistry.registerBlock(this, ItemBlockLeadTank.class, Constants.LEAD_TANK_NAME);<br>}<br> <br> <br><br>@Override<br> public ItemStack getPickBlock(MovingObjectPosition target, World world,<br> int x, int y, int z) {<br> // TODO Auto-generated method stub<br> return Utils.getTankStackFromTile((TileLeadTank) world.getTileEntity(x, y, z), true);<br> }<br>@Override<br> public boolean hasComparatorInputOverride() {<br>return true;<br> }<br>public TileEntity createNewTileEntity(World world, int meta) {<br>return new TileLeadTank();<br> }<br>@Override<br> public boolean isOpaqueCube() {<br>return false;<br> }<br>@Override<br> public int getRenderType() {<br> <br> return renderID;<br> }<br>@Override<br> public boolean renderAsNormalBlock() {<br>return false;<br> }<br>@Override<br> public int getRenderBlockPass() {<br>return 1;<br> }<br><br> @Override<br> public boolean canRenderInPass(int pass) {<br>RenderLeadTank.renderPass = pass;<br> return true;<br> }<br>@Override<br>public int quantityDropped(Random rnd) {<br>return 0;<br>}<br> <br><br>@Override<br>public int getComparatorInputOverride(World world, int x, int y, int z, int opSide) {<br>return 0;<br>}<br>@Override<br> public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {<br>ItemStack stack = player.inventory.getCurrentItem();<br> if (stack != null) {<br>FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(stack);<br> TileLeadTank tank = (TileLeadTank) world.getTileEntity(x, y, z);<br>if (liquid != null) {<br>int amount = tank.fill(ForgeDirection.UNKNOWN, liquid, false);<br>if (amount == liquid.amount) {<br>tank.fill(ForgeDirection.UNKNOWN, liquid, true);<br> if (!player.capabilities.isCreativeMode)<br> player.inventory.setInventorySlotContents(player.inventory.currentItem, Utils.useItemSafely(stack));<br> <br> if(tank.tank.getFluid().getFluid().getBlock() != null)<br> {<br> //z world.setLightValue(EnumSkyBlock.Sky., tank.xCoord, tank.xCoord, tank.xCoord, tank.tank.getFluid().getFluid().getBlock().getLightValue());<br> }<br> <br> <br> return true;<br> }<br>else<br> return true;<br> }<br>else if (FluidContainerRegistry.isBucket(stack)) {<br>FluidTankInfo[] tanks = tank.getTankInfo(ForgeDirection.UNKNOWN);<br>if (tanks[0] != null) {<br>FluidStack fillFluid = tanks[0].fluid;<br> ItemStack fillStack = FluidContainerRegistry.fillFluidContainer(fillFluid, stack);<br>if (fillStack != null) {<br>tank.drain(ForgeDirection.UNKNOWN, FluidContainerRegistry.getFluidForFilledItem(fillStack).amount, true);<br>if (!player.capabilities.isCreativeMode) {<br>if (stack.stackSize == 1)<br> player.inventory.setInventorySlotContents(player.inventory.currentItem, fillStack);<br>else {<br> player.inventory.setInventorySlotContents(player.inventory.currentItem, Utils.useItemSafely(stack));<br>if (!player.inventory.addItemStackToInventory(fillStack))<br> player.dropPlayerItemWithRandomChoice(fillStack, false);<br> }<br> }<br> return true;<br> }<br>else<br> return true;<br> }<br> <br> }<br> }<br>return false;<br> }<br>@Override<br> public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {<br>if (!player.capabilities.isCreativeMode) {<br>TileLeadTank tank = (TileLeadTank) world.getTileEntity(x, y, z);<br> <br> Utils.dropStackInWorld(world, x, y, z, Utils.getTankStackFromTile(tank, true));<br> <br> <br> <br> }<br>return world.setBlockToAir(x, y, z);<br> }<br>@Override<br> public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {<br>if (stack.hasTagCompound()) {<br>TileLeadTank tank = (TileLeadTank) world.getTileEntity(x, y, z);<br>if (tank != null) {<br>NBTTagCompound tagFluid = stack.getTagCompound().getCompoundTag("Fluid");<br>if (tagFluid != null) {<br>FluidStack liquid = FluidStack.loadFluidStackFromNBT(tagFluid);<br> tank.tank.setFluid(liquid);<br>}<br><br>}<br>}<br>}<br>@Override<br>public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {<br>Utils.dropStackInWorld(world, x, y, z, Utils.getTankStackFromTile((TileLeadTank) world.getTileEntity(x, y, z), true));<br>world.setBlockToAir(x, y, z);<br>onBlockDestroyedByExplosion(world, x, y, z, explosion);<br>}<br> <br> <br>}<br></span>


    RenderBlock

    </span> package forgingmc.minecraftthing.blocks;<br>import cpw.mods.fml.common.registry.GameRegistry;<br>import net.minecraft.block.Block;<br>import net.minecraft.block.material.Material;<br>public class RenderBlock extends Block {<br>protected RenderBlock() {<br> super(Material.air);<br> GameRegistry.registerBlock(this, "renderBlocks");<br> }<br>}<br>


    TileEntity


    package forgingmc.minecraftthing.tile;
    import java.util.HashMap;
    import net.minecraft.block.Block;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.network.NetworkManager;
    import net.minecraft.network.Packet;
    import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraftforge.common.util.ForgeDirection;
    import net.minecraftforge.fluids.Fluid;
    import net.minecraftforge.fluids.FluidStack;
    import net.minecraftforge.fluids.FluidTank;
    import net.minecraftforge.fluids.FluidTankInfo;
    import net.minecraftforge.fluids.IFluidHandler;
    public class TileLeadTank extends TileEntity implements IFluidHandler{
    public FluidTank tank = new FluidTank(20000);
    private boolean needsUpdate = false;
    private int updateTimer = 0;


    public TileLeadTank() {

    }
    public TileLeadTank(int x, int y, int z) {
    worldObj.getTileEntity(x, y, z);

    }

    public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
    {
    needsUpdate = true;
    return this.tank.fill(resource, doFill);
    }

    public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
    {
    return this.tank.drain(resource.amount, doDrain);
    }

    public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
    {
    needsUpdate = true;
    return this.tank.drain(maxDrain, doDrain);
    }

    public boolean canFill(ForgeDirection from, Fluid fluid)
    {
    return true;
    }

    public boolean canDrain(ForgeDirection from, Fluid fluid)
    {
    return true;
    }

    public FluidTankInfo[] getTankInfo(ForgeDirection from)
    {
    return new FluidTankInfo[] {this.tank.getInfo()};
    }

    public float getAdjustedVolume()
    {
    float amount = tank.getFluidAmount();
    float capacity = tank.getCapacity();
    float volume = (amount/capacity)*0.8F;
    return volume;
    }

    public void updateEntity()
    {
    needsUpdate = true;
    if (needsUpdate)
    {
    if (updateTimer == 0)
    {
    updateTimer = 16; // every 1 ticks it will send an update
    }
    else
    {
    --updateTimer;
    if (updateTimer == 0)
    {
    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);





    worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
    needsUpdate = false;
    }
    }
    }
    }

    @Override
    public void readFromNBT(NBTTagCompound tag)
    {
    super.readFromNBT(tag);
    tank.readFromNBT(tag);

    }

    @Override
    public void writeToNBT(NBTTagCompound tag)
    {
    super.writeToNBT(tag);
    tank.writeToNBT(tag);
    writeCustomNBT(tag);
    }

    private void writeCustomNBT(NBTTagCompound tag) {
    NBTTagCompound comp = new NBTTagCompound();


    }
    @Override
    public Packet getDescriptionPacket()
    {
    NBTTagCompound tag = new NBTTagCompound();
    writeToNBT(tag);
    return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag);
    }
    @Override
    public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
    {
    NBTTagCompound tag = pkt.func_148857_g();
    readFromNBT(tag);
    }
    }


    Utils

    </span> package forgingmc.minecraftthing;<br>import org.lwjgl.opengl.GL11;<br>import net.minecraft.block.Block;<br>import net.minecraft.client.renderer.RenderBlocks;<br>import net.minecraft.client.renderer.Tessellator;<br>import net.minecraft.entity.item.EntityItem;<br>import net.minecraft.init.Blocks;<br>import net.minecraft.item.Item;<br>import net.minecraft.item.ItemStack;<br>import net.minecraft.nbt.NBTTagCompound;<br>import net.minecraft.util.IIcon;<br>import net.minecraft.world.World;<br>import net.minecraftforge.fluids.Fluid;<br>import net.minecraftforge.fluids.FluidStack;<br>import forgingmc.minecraftthing.blocks.InitBlocks;<br>import forgingmc.minecraftthing.tile.TileLeadTank;<br>public class Utils {<br>public static void renderBlockByCompleteness(Block block, Fluid fluid, int meta, RenderBlocks renderer, double complete, int x, int y, int z) {<br> <br> renderer.setRenderBounds(0.01, 0.01, 0.01, 0.99, complete * 0.99, 0.99);<br> renderer.setOverrideBlockTexture(fluid.getIcon()); <br> renderer.renderStandardBlock(block, x, y, z);<br> renderer.clearOverrideBlockTexture();<br> }<br>public static ItemStack useItemSafely(ItemStack stack) {<br> if (stack.stackSize == 1) {<br>if (stack.getItem().hasContainerItem(stack))<br> return stack.getItem().getContainerItem(stack);<br> else<br> return null;<br> }<br>else {<br>stack.splitStack(1);<br> return stack;<br> }<br> }<br>public static void dropStackInWorld(World world, int x, int y, int z,<br> ItemStack stack) {<br> if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) {<br>float f = 0.7F;<br> double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;<br> double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;<br> double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;<br> EntityItem entityitem = new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, stack);<br> entityitem.delayBeforeCanPickup = 10;<br> world.spawnEntityInWorld(entityitem);<br> }<br> <br> }<br>public static ItemStack getTankStackFromTile(TileLeadTank tank,<br> boolean keepFluid) {<br>ItemStack stack = new ItemStack(InitBlocks.lead_tank);<br> stack.setTagCompound(new NBTTagCompound());<br> FluidStack fluid = tank.tank.getFluid();<br>if (fluid != null && keepFluid) {<br>NBTTagCompound tagFluid = new NBTTagCompound();<br> fluid.writeToNBT(tagFluid);<br> stack.getTagCompound().setTag("Fluid", tagFluid);<br> }<br> <br>return stack;<br> }<br>public static void renderInventoryBlock(RenderBlocks renderblocks, Block block, IIcon icon) {<br>Tessellator tessellator = Tessellator.instance;<br>GL11.glTranslatef(-0.5F, -0.5F, -0.5F);<br> tessellator.startDrawingQuads();<br> tessellator.setNormal(0.0F, -1F, 0.0F);<br> renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));<br> tessellator.draw();<br> tessellator.startDrawingQuads();<br> tessellator.setNormal(0.0F, 1.0F, 0.0F);<br> renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));<br> tessellator.draw();<br> tessellator.startDrawingQuads();<br> tessellator.setNormal(0.0F, 0.0F, -1F);<br> renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));<br> tessellator.draw();<br> tessellator.startDrawingQuads();<br> tessellator.setNormal(0.0F, 0.0F, 1.0F);<br> renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));<br> tessellator.draw();<br> tessellator.startDrawingQuads();<br> tessellator.setNormal(-1F, 0.0F, 0.0F);<br> renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));<br> tessellator.draw();<br> tessellator.startDrawingQuads();<br> tessellator.setNormal(1.0F, 0.0F, 0.0F);<br> renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(icon));<br> tessellator.draw();<br> GL11.glTranslatef(0.5F, 0.5F, 0.5F);<br> }<br> <br> public static void renderInventoryBlock(RenderBlocks renderblocks, Block block, Fluid fluid) {<br>Tessellator tessellator = Tessellator.instance;<br> GL11.glTranslatef(-0.5F, -0.5F, -0.5F);<br> tessellator.startDrawingQuads();<br> tessellator.setNormal(0.0F, -1F, 0.0F);<br> renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(fluid.getIcon()));<br> tessellator.draw();<br> tessellator.startDrawingQuads();<br> tessellator.setNormal(0.0F, 1.0F, 0.0F);<br> renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(fluid.getIcon()));<br> tessellator.draw();<br> tessellator.startDrawingQuads();<br> tessellator.setNormal(0.0F, 0.0F, -1F);<br> renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(fluid.getIcon()));<br> tessellator.draw();<br> tessellator.startDrawingQuads();<br> tessellator.setNormal(0.0F, 0.0F, 1.0F);<br> renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(fluid.getIcon()));<br> tessellator.draw();<br> tessellator.startDrawingQuads();<br> tessellator.setNormal(-1F, 0.0F, 0.0F);<br> renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(fluid.getIcon()));<br> tessellator.draw();<br> tessellator.startDrawingQuads();<br> tessellator.setNormal(1.0F, 0.0F, 0.0F);<br> renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(fluid.getIcon()));<br> tessellator.draw();<br> GL11.glTranslatef(0.5F, 0.5F, 0.5F);<br> }<br>private static IIcon getValidIIcon(IIcon icon) {<br> if (icon != null)<br> return icon;<br>return Blocks.fire.getIcon(0, 0);<br> }<br>public static ItemStack getTankStackFromData() {<br>ItemStack stack = new ItemStack(Item.getItemFromBlock(InitBlocks.lead_tank));<br> NBTTagCompound tag = new NBTTagCompound();<br> stack.setTagCompound(tag);<br> return stack;<br> }<br>public static ItemStack getItemBlockForCreativeTab(Block block)<br> {<br> ItemStack stack = new ItemStack(Item.getItemFromBlock(block));<br> return stack;<br> }<br> <br> <br> <br>}<br>


    ItemBlock

     package forgingmc.minecraftthing.items;<br>import java.util.List;<br> <br>import cpw.mods.fml.relauncher.Side;<br>import cpw.mods.fml.relauncher.SideOnly;<br>import forgingmc.minecraftthing.Utils;<br>import net.minecraft.block.Block;<br>import net.minecraft.creativetab.CreativeTabs;<br>import net.minecraft.entity.player.EntityPlayer;<br>import net.minecraft.item.Item;<br>import net.minecraft.item.ItemBlock;<br>import net.minecraft.item.ItemStack;<br>import net.minecraft.nbt.NBTTagCompound;<br>import net.minecraftforge.fluids.FluidStack;<br>public class ItemBlockLeadTank extends ItemBlock{<br>public ItemBlockLeadTank(Block p_i45328_1_) {<br> super(p_i45328_1_);<br> this.setMaxStackSize(1);<br> }<br>@SideOnly(Side.CLIENT)<br> @Override<br> public void addInformation(ItemStack stack, EntityPlayer player,<br> List tooltip, boolean isAdvanced) {<br> <br> if (stack.hasTagCompound()) {<br>NBTTagCompound tag = stack.stackTagCompound;<br>FluidStack fluid = null;<br>if (tag.hasKey("Fluid")) {<br>fluid = FluidStack.loadFluidStackFromNBT((NBTTagCompound) tag.getTag("Fluid"));<br> tooltip.add("Fluid " + ": " + fluid.getLocalizedName());<br> }<br>int amount = (fluid != null) ? fluid.amount : 0;<br>tooltip.add("Amount" + ": " + amount + " / " + 20000 + " mB");<br> <br> }<br>else<br> tooltip.add("Item Error");<br> }<br> <br> <br> @SideOnly(Side.CLIENT)<br> public void getSubItems(Item item, CreativeTabs tab, List itemList) {<br><br> itemList.add(Utils.getTankStackFromData());<br> <br>}<br> <br> <br>}<br> <br>
    <br><br>BlockRender<br><br>
     package forgingmc.minecraftthing.render;<br>import net.minecraft.block.Block;<br>import net.minecraft.client.renderer.RenderBlocks;<br>import net.minecraft.world.IBlockAccess;<br>import net.minecraftforge.fluids.Fluid;<br>import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;<br>import forgingmc.minecraftthing.Utils;<br>import forgingmc.minecraftthing.blocks.InitBlocks;<br>import forgingmc.minecraftthing.tile.TileLeadTank;<br>public class RenderLeadTank implements ISimpleBlockRenderingHandler{<br>public static int renderID;<br> public static int renderPass = 0;<br>public RenderLeadTank(int renderingID) {<br>renderID = renderingID;<br> }<br>@Override<br> public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) {<br>}<br>@Override<br> public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {<br>if (modelId == renderID) {<br>TileLeadTank tank = (TileLeadTank) world.getTileEntity(x, y, z);<br>if (renderPass == 0) {<br>if (tank.tank.getFluid() != null) {<br>Fluid fluid = tank.tank.getFluid().getFluid();<br> Utils.renderBlockByCompleteness(InitBlocks.renderBlock,fluid, world.getBlockMetadata(x, y, z), renderer, (double) tank.tank.getFluidAmount() / (double) tank.tank.getCapacity(), x, y, z);<br> }<br> }<br>else if (renderPass == 1) {<br>renderer.setRenderBounds(0, 0, 0, 1, 1, 1);<br>renderer.renderStandardBlock(block, x, y, z);<br>renderer.setRenderFromInside(true);<br> renderer.setRenderBounds(0, 0, 0, 1, 1, 1);<br> renderer.renderStandardBlock(block, x, y, z);<br> renderer.setRenderFromInside(false);<br> }<br> }<br> return true;<br> }<br>@Override<br> public boolean shouldRender3DInInventory(int modelId) {<br>return false;<br> }<br>@Override<br> public int getRenderId() {<br>return renderID;<br> }<br>}<br>[/spoiler]
    
    
    ItemBlock Render
    
    [spoiler][code] package forgingmc.minecraftthing.render;<br>import org.lwjgl.opengl.GL11;<br>import forgingmc.minecraftthing.Utils;<br>import forgingmc.minecraftthing.blocks.InitBlocks;<br>import net.minecraft.block.Block;<br>import net.minecraft.client.renderer.RenderBlocks;<br>import net.minecraft.item.ItemStack;<br>import net.minecraft.nbt.NBTTagCompound;<br>import net.minecraftforge.client.IItemRenderer;<br>import net.minecraftforge.client.IItemRenderer.ItemRenderType;<br>import net.minecraftforge.client.IItemRenderer.ItemRendererHelper;<br>import net.minecraftforge.fluids.FluidStack;<br>public class RenderItemBlockLeadTank implements IItemRenderer {<br>@Override<br> public boolean handleRenderType(ItemStack item, ItemRenderType type) {<br>return type == ItemRenderType.INVENTORY || type == ItemRenderType.ENTITY || type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.EQUIPPED;<br> }<br>@Override<br> public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {<br>return true;<br> }<br>@Override<br> public void renderItem(ItemRenderType type, ItemStack item, Object... data) {<br>RenderBlocks renderblocks = (RenderBlocks) data[0];<br> Block block = Block.getBlockFromItem(item.getItem());<br>if (item.hasTagCompound()) {<br>NBTTagCompound tag = item.stackTagCompound;<br>if (tag.hasKey("Fluid")) {<br>FluidStack liquid = FluidStack.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("Fluid"));<br> if (liquid != null) {<br>GL11.glEnable(GL11.GL_BLEND);<br> float height = ((float) liquid.amount / (float) 20000 * (float) 0.99);<br> renderblocks.setRenderBounds(0.01, 0.01, 0.01, 0.99, height, 0.99);<br> Utils.renderInventoryBlock(renderblocks, InitBlocks.renderBlock, liquid.getFluid());<br> GL11.glDisable(GL11.GL_BLEND);<br> }<br> }<br> <br>GL11.glEnable(GL11.GL_ALPHA_TEST);<br> renderblocks.setRenderBounds(0, 0, 0, 1, 1, 1);<br>Utils.renderInventoryBlock(renderblocks, block, InitBlocks.lead_tank.getIcon(0, 0));<br> GL11.glDisable(GL11.GL_ALPHA_TEST);<br> <br> }<br> }<br>}<br>


    BlocksInit (registry of blocks)

     package forgingmc.minecraftthing.blocks;<br>import net.minecraft.block.Block;<br>import net.minecraftforge.fluids.Fluid;<br>public class InitBlocks {<br>public static Block ore_lead;<br> public static Block lead_block;<br> public static Block lead_tank;<br> public static Block renderBlock;<br> public static Block liquidLead;<br> public static Fluid fluidLead;<br> <br> public static void init()<br> {<br> liquidLead = new BlockFluidLead();<br> ore_lead = new LeadOre();<br> lead_block = new LeadBlock();<br> lead_tank = new LeadTank();<br> renderBlock = new RenderBlock();<br> }<br> <br> <br>}<br>


    Client and Common Proxies

     package forgingmc.minecraftthing;<br>import net.minecraft.item.Item;<br>import net.minecraftforge.client.MinecraftForgeClient;<br>import cpw.mods.fml.client.registry.RenderingRegistry;<br>import forgingmc.minecraftthing.blocks.InitBlocks;<br>import forgingmc.minecraftthing.blocks.LeadTank;<br>import forgingmc.minecraftthing.render.RenderItemBlockLeadTank;<br>import forgingmc.minecraftthing.render.RenderLeadTank;<br>public class ClientProxy extends CommonProxy{<br><br> @Override<br> public void registerRenders() {<br> int tank_id = RenderingRegistry.getNextAvailableRenderId();<br> LeadTank.renderID = tank_id;<br> RenderingRegistry.registerBlockHandler(tank_id, new RenderLeadTank(tank_id));<br> MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(InitBlocks.lead_tank), new RenderItemBlockLeadTank());<br> <br> <br> }<br> <br> <br>}<br>

     package forgingmc.minecraftthing;<br>import cpw.mods.fml.common.registry.GameRegistry;<br>import forgingmc.minecraftthing.tile.TileLeadTank;<br>public class CommonProxy {<br>public void init()<br> {<br> registerRenders();<br> registerTiles();<br> }<br> <br> <br> public void registerTiles()<br> {<br> GameRegistry.registerTileEntity(TileLeadTank.class, "leadTank");<br> }<br> <br> public void registerRenders()<br> {<br> <br> }<br> <br>}<br>
    Posted in: Mapping and Modding Tutorials
  • To post a comment, please .