Everything posted by SuperKael
-
[1.7.10] Help with getting raw texture data
I think the FrameBufferObject may be the way to go. Because I don't need to write back onto the texture sheet. after looking at the code for spawn eggs, I can give a color tint to the texture on a pass-by-pass basis, so I just make grayscale template images, and color them like so.
-
[1.8] Sword help
basicaly, change: public class tutorialsword { to: public class tutorialsword extends ItemSword { and add: public tutorialsword(){ super(test); } to the tutorialsword class. (Sorry if I am wrong about something, I havn't actually tried coding in 1.8 before)
-
[Solved] Crash help
I may be wrong, but it seems like TerraCraftBlocks.init() is not being called. Also, your main class and your client proxy would be helpful aswell if that doesn't fix the problem.
-
[Solved] Crash help
We need your code, Specifically your TerraCraftBlocks file.
-
[1.7.10] Help with getting raw texture data
Sorry for the late reply. I am aware of this, my pickaxe actually uses 5 passes for each part of it to be rendered individually.
-
[1.7.10] Help with getting raw texture data
Sadly, that won't work for me. I am trying to make "universal tools" that can be made from anything. say, an emerald pickaxe. it needs to dynamicaly determine that emeralds are green, and such make the head of the pickaxe look green. I have everything set up, I just need the raw texture
-
[1.7.10] Help with getting raw texture data
I am trying to determine the "average color" of a texture, for various purposes, and I have everything figured out except, I need some way to get the texture of an item the form of an Image, Int[], or Int[][]. I am completely stumped, it seems like the Minecraft source code somehow never manages to actually reference images anywhere in the code. it just uses IIcons and and TextureMaps, and I simply can't figure it out. In order to obtain said texture, I have access to IIcons, the string name, etc. Someone please tell me how I can accomplish this.
-
[1.7.10] Using Another Mod's API
Sorry that I caused so much confusion. what I was saying is that you put the compiled jar in mods, and put the uncompiled source files in libs. EDIT: this is the way that I have been doing it. looking back on it, that doesn't seem like the best way after all
-
[1.7.10]Freeze when using custom container without any console output
Yeah, that's my issue. for unknown reasons, I can't run my mod in my workspace. my mods relies on multiple other mods as dependencies, and running it in the workspace results in a crash about 10 seconds after start. so in order to test, I have to export the mod then run it in MultiMC. EDIT: OMG I'VE DONE IT! with the help of CodeChickenCore, and downloading the dev edition of CoFHCore, I got minecraft to run in my dev environment! I will return with results from breakpoints. EDIT 2: Um, hm. apparently I havn't done it. I actually need the source code of CoFHCore
-
[1.7.10] Using Another Mod's API
In order to do it in Eclipse, simply add a folder called "libs" (or anything for that matter) and right click it and say Build Path -> Use as source folder. then, in the mods directory, add the mod/api you wish to use. finnaly, get the source code of the mod (or use a program such as JD-GUI to get it) and put the decompiled source into the libs folder. make sure the source files are NOT compressed, but rather in extracted directories form. now, go to your build.gradle file and add this to the dependencies section: compile files("mods/ModJarName.jar") Note: the above code MUST be used whether you are just referencing the mod or you are doing a dependency. you should now go into eclipse and right click the libs folder and click refresh. you can start using the data from the other mod/api! if you are just referencing the mod and not using it as a dependency, always make sure the relevent mod is actualy present before referencing it's resources, to make sure of this, create a variable in your main class called: public boolean isApiModLoaded; and in your postinit, add: isApiModLoaded = Loader.isModLoaded("modid") and whenever you want to access the mod's resources, just use an if block with the isApiModLoaded variable to make sure that the mod is actualy loaded, if not you will get an error. if you wish to make a mod a dependency instead of just referencing it, add this to your mcmod.info: "dependencies": ["modid"] and add this to your @Mod anotation: dependencies = "required-after:modid" in case it isn't clear, the variable doesn't have to be called isApiModLoaded, you can name it whatever you want. additionaly, if you want to use multiple mods, add more sources to the libs directory, and add more entries to the build.gradle. if you want to just reference them, just add more variables in the main class. as for if you want more dependencies, in mcmod.info use: "dependencies": ["modid1","modid2","modid3","etc..."] and in the @Mod anotation: dependencies = "required-after:modid1;required-after:modid2;required-after:modid3;required-after:etc..."
-
using an item to extend the players inventory
I'm probably wrong, because I am reletively new to modding, but as far as I know, what you are looking for isn't really possible.
-
[1.7.10]Freeze when using custom container without any console output
[move]Le Bump[/move]
-
[1.7.10] Key Troubles
Try this: if(Minecraft.getMinecraft().thePlayer.getCurrentArmor(0) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(0).getItem().equals(YourMod.yourArmorBoots)) if(Minecraft.getMinecraft().thePlayer.getCurrentArmor(1) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(1).getItem().equals(YourMod.yourArmorLeggings)) if(Minecraft.getMinecraft().thePlayer.getCurrentArmor(2) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(2).getItem().equals(YourMod.yourArmorChestplate)) if(Minecraft.getMinecraft().thePlayer.getCurrentArmor(3) != null && Minecraft.getMinecraft().thePlayer.getCurrentArmor(3).getItem().equals(YourMod.yourArmorHelmet)) { Minecraft.getMinecraft().thePlayer.openGui... } Quick explanation: first of all, we want to check the player's ARMOR, so we use getCurrentArmor. second of all, we want to make sure the correct armor slots are non-null, AKA empty, or we will get a NullPointerException. third of all, if you want to check someone's armor, you want to make sure they are wearing the full set right? well that's what i'm doing here. If that's not what you want, simply remove the lines about the specific armor pieces. finnaly, I am using Object.equals(Object) instead of Object == Object, because .equals is safer, and is better practice. also, one more thing to remember, tracking key presses is safe, but you need to be careful with Minecraft.getMinecraft(), because if this is running on the internal/external server instead of the client, that will cause a crash.
-
[1.7.10]Freeze when using custom container without any console output
Um, I told you, A: there was no console output and B: Minecraft never closed, I had to reboot my computer. So basicaly, no crash report at all. EDIT: The last line in the console before the freeze: [14:49:08] [server thread/INFO]: [<USERNAME>: Set own game mode to Creative Mode] That is the very last entry in the log. nothing after that.
-
[1.7.10]Freeze when using custom container without any console output
I am working on a mod for this youtuber named CrinkleCraft's modpack, and it's primary purpose is it adds a block called the "blood bottler." for a while, it has contained blood based on a simple integer, but I wanted to make it use an actual tank. I set it up to use a FluidTankAdv from CoFHCore, and I had a couple issues. first of all, the tank is missing a texture. Although I can probably work that issue out. that problem I came here for is that, when I put in some glass bottles to be filled, the game froze. It froze so badly, I need to reboot my computer to get Minecraft to close. Now, freezes of this nature aren't particularly rare, I blame it on my terrible graphics card, but It has never frozen for any known reason before. As it said in the Subject, there was no console output of any kind. Here is all of my potentialy relevant code: EDIT: Since apparently it wasn't clear, there IS NO CRASH REPORT. Technicaly, it never crashed. it just froze, it never shut down because I had to forcibly reboot my computer. BottleOBlood package bottleoblood; import java.util.List; import bottleoblood.block.*; import bottleoblood.event.BucketHandler; import bottleoblood.fluid.*; import bottleoblood.item.*; import bottleoblood.tileentity.*; import bottleoblood.client.gui.*; import net.minecraft.block.*; import net.minecraft.block.material.Material; import net.minecraft.init.Items; import net.minecraft.item.*; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; import cpw.mods.fml.common.*; import cpw.mods.fml.common.Mod.*; import cpw.mods.fml.common.event.*; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = ModInfo.MODID, version = ModInfo.VERSION, name = ModInfo.MODNAME, dependencies = ModInfo.DEPENDENCIES) public class BottleOBlood{ @Instance("BottleOBlood") public static BottleOBlood instance; public static Item itemBottleBlood; public static Item itemCorruptBottleBlood; public static Item itemVampiricBottleBlood; public static Item itemBucketBlood; public static Item itemCorruptBucketBlood; public static Item itemVampiricBucketBlood; public static BlockContainer blockBloodBottler; public static Block bloodNormal; public static Block bloodCorrupt; public static Block bloodVampiric; public static Fluid bloodNormalFluid; public static Fluid bloodCorruptFluid; public static Fluid bloodVampiricFluid; public boolean isVampZInstalled; public boolean isEvilCraftInstalled; public boolean isBloodMagicInstalled; public boolean isNecromancyInstalled; public boolean isBiomesOPlentyInstalled; public boolean isCannibalismInstalled; public boolean isVampiricBloodEnabled; public boolean isCorruptBloodEnabled; public boolean isVampiricBloodExtractable; public boolean isCorruptBloodExtractable; @EventHandler public void preinit(FMLPreInitializationEvent event){ Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); Property isVampiricBloodEnabledProperty = config.get(Configuration.CATEGORY_GENERAL, "enableVampiricBlood", false); Property isCorruptBloodEnabledProperty = config.get(Configuration.CATEGORY_GENERAL, "enableCorruptBlood", true); Property isVampiricBloodExtractableProperty = config.get(Configuration.CATEGORY_GENERAL, "enableVampiricBloodExtraction", true); Property isCorruptBloodExtractableProperty = config.get(Configuration.CATEGORY_GENERAL, "enableCorruptBloodExtraction", true); isVampiricBloodEnabledProperty.comment = "Setting this to true will enable extraction of vampiric blood. if set to false, you will only be able to get normal blood. Default: false"; isCorruptBloodEnabledProperty.comment = "Setting this to true will enable extraction of corrupt blood. if set to false, you will only be able to get normal blood. Default: true"; isVampiricBloodExtractableProperty.comment = "Sets if it is possible to extract blood from items containing vampiric blood. the previous setting does not affect this. Default: true"; isCorruptBloodExtractableProperty.comment = "Sets if it is possible to extract blood from items containing corrupt blood. the previous setting does not affect this. Default: true"; isVampiricBloodEnabled = isVampiricBloodEnabledProperty.getBoolean(false); isCorruptBloodEnabled = isCorruptBloodEnabledProperty.getBoolean(true); isVampiricBloodExtractable = isVampiricBloodExtractableProperty.getBoolean(true); isCorruptBloodExtractable = isCorruptBloodExtractableProperty.getBoolean(true); config.save(); MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE); } @EventHandler public void init(FMLInitializationEvent event){ itemBottleBlood = new ItemBottleBlood(); itemCorruptBottleBlood = new ItemCorruptBottleBlood(); itemVampiricBottleBlood = new ItemVampiricBottleBlood(); itemBucketBlood = new ItemBucketBlood(); itemCorruptBucketBlood = new ItemCorruptBucketBlood(); itemVampiricBucketBlood = new ItemVampiricBucketBlood(); blockBloodBottler = new BlockBloodBottler(); bloodNormalFluid = new Fluid("blood"); bloodVampiricFluid = new Fluid("bloodVampiric"); bloodCorruptFluid = new Fluid("bloodCorrupt"); FluidRegistry.registerFluid(bloodNormalFluid); FluidRegistry.registerFluid(bloodVampiricFluid); FluidRegistry.registerFluid(bloodCorruptFluid); bloodNormal = new BlockBloodNormal(bloodNormalFluid, Material.water).setBlockName("blood"); bloodVampiric = new BlockBloodVampiric(bloodVampiricFluid, Material.water).setBlockName("bloodVampiric"); bloodCorrupt = new BlockBloodCorrupt(bloodCorruptFluid, Material.water).setBlockName("bloodNormal"); GameRegistry.registerBlock(blockBloodBottler, "blockBloodBottler"); GameRegistry.registerBlock(bloodNormal, "blood"); GameRegistry.registerBlock(bloodVampiric, "bloodVampiric"); GameRegistry.registerBlock(bloodCorrupt, "bloodCorrupt"); GameRegistry.registerItem(itemBottleBlood, "itemBottleBlood"); GameRegistry.registerItem(itemCorruptBottleBlood, "itemCorruptBottleBlood"); GameRegistry.registerItem(itemVampiricBottleBlood, "itemVampiricBottleBlood"); GameRegistry.registerItem(itemBucketBlood, "itemBucketBlood"); GameRegistry.registerItem(itemCorruptBucketBlood, "itemBucketCorruptBlood"); GameRegistry.registerItem(itemVampiricBucketBlood, "itemBucketVampiricBlood"); FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack(bloodNormalFluid.getName(), FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(itemBucketBlood,1), new ItemStack(Items.bucket,1)); FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack(bloodCorruptFluid.getName(), FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(itemCorruptBucketBlood,1), new ItemStack(Items.bucket,1)); FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack(bloodVampiricFluid.getName(), FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(itemVampiricBucketBlood,1), new ItemStack(Items.bucket,1)); BucketHandler.INSTANCE.buckets.put(bloodNormal, itemBucketBlood); BucketHandler.INSTANCE.buckets.put(bloodCorrupt, itemCorruptBucketBlood); BucketHandler.INSTANCE.buckets.put(bloodVampiric, itemVampiricBucketBlood); GameRegistry.registerTileEntity(BloodBottlerEntity.class, "entityBloodBottler"); NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler()); } @EventHandler public void postinit(FMLPostInitializationEvent event){ if(Loader.isModLoaded("vampz") && Loader.isModLoaded("evilcraft")){ GameRegistry.addShapedRecipe(new ItemStack(blockBloodBottler), "###", "#$#", "###", '#', GameRegistry.findBlock("vampz", "Bloodycobblestone"), '$', GameRegistry.findItem("evilcraft", "bloodInfusionCore")); } if(Loader.isModLoaded("vampz")){ isVampZInstalled = true; try{ GameRegistry.addShapelessRecipe(new ItemStack(itemCorruptBottleBlood), GameRegistry.findItem("vampz", "CorruptedBlood"), Items.glass_bottle); GameRegistry.addShapelessRecipe(new ItemStack(itemBottleBlood), GameRegistry.findItem("vampz", "Blood"), Items.glass_bottle); GameRegistry.addShapelessRecipe(new ItemStack(itemBottleBlood), GameRegistry.findItem("vampz", "CowBlood"), Items.glass_bottle); GameRegistry.addShapelessRecipe(new ItemStack(itemBottleBlood), GameRegistry.findItem("vampz", "SheepBlood"), Items.glass_bottle); GameRegistry.addShapelessRecipe(new ItemStack(itemBottleBlood), GameRegistry.findItem("vampz", "ChickenBlood"), Items.glass_bottle); }catch(Exception e){} @SuppressWarnings("unchecked") List<IRecipe> Recipes = (List<IRecipe>)CraftingManager.getInstance().getRecipeList(); try{ for(int i = 0;i < Recipes.size();i++){ if(Recipes.get(i).getRecipeOutput().equals(new ItemStack(GameRegistry.findItem("vampz", "BottleOfBlood")))){ Recipes.remove(i); } } }catch(Exception e){} System.out.println("Successfuly loaded mod VampZ"); }else{ isVampZInstalled = false; System.err.println("Unable to load mod VampZ! It is recomended that you install this! If you have and are getting this message, please contact SuperKael."); } if(Loader.isModLoaded("evilcraft")){ isEvilCraftInstalled = true; System.out.println("Successfuly loaded mod EvilCraft"); }else{ isEvilCraftInstalled = false; System.err.println("Unable to load mod EvilCraft! It is recomended that you install this! If you have and are getting this message, please contact SuperKael."); } if(Loader.isModLoaded("AWWayofTime")){ isBloodMagicInstalled = true; System.out.println("Successfuly loaded mod Blood Magic"); }else{ isBloodMagicInstalled = false; System.out.println("Didn't load mod Blood Magic because it is not present."); } if(Loader.isModLoaded("necromancy")){ isNecromancyInstalled = true; System.out.println("Successfuly loaded mod Necromancy"); }else{ isNecromancyInstalled = false; System.out.println("Didn't load mod Necromancy because it is not present."); } if(Loader.isModLoaded("BiomesOPlenty")){ isBiomesOPlentyInstalled = true; System.out.println("Successfuly loaded mod Biomes O Plenty"); }else{ isBiomesOPlentyInstalled = false; System.out.println("Didn't load mod Biomes O Plenty because it is not present."); } if(Loader.isModLoaded("cannibalism")){ isCannibalismInstalled = true; System.out.println("Successfuly loaded mod Cannibalism"); }else{ isCannibalismInstalled = false; System.out.println("Didn't load mod Cannibalism because it is not present."); } } } BloodBottlerEntity (Warning, a bit larger than it probably realy needs to be) EDIT: Removed large portions of the code that you don't need to see, with a basic explanation of what the method does. package bottleoblood.tileentity; import cofh.core.util.fluid.FluidTankAdv; import cpw.mods.fml.common.registry.GameRegistry; import bottleoblood.BottleOBlood; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ISidedInventory; 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.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidContainerItem; import net.minecraftforge.fluids.IFluidHandler; import net.minecraftforge.fluids.ItemFluidContainer; public class BloodBottlerEntity extends TileEntity implements IFluidHandler, ISidedInventory{ public ItemStack[] inv; FluidTankAdv tank = new FluidTankAdv(10000); public BloodBottlerEntity(){ inv = new ItemStack[4]; } @Override public int getSizeInventory(){ return inv.length; } @Override public ItemStack getStackInSlot(int slot){ return inv[slot]; } @Override public void setInventorySlotContents(int slot, ItemStack stack){ inv[slot] = stack; if(stack != null && stack.stackSize > getInventoryStackLimit()){ stack.stackSize = getInventoryStackLimit(); } } @Override public ItemStack decrStackSize(int slot, int amt) { ItemStack stack = getStackInSlot(slot); if (stack != null) { if (stack.stackSize <= amt) { setInventorySlotContents(slot, null); } else { stack = stack.splitStack(amt); if (stack.stackSize == 0) { setInventorySlotContents(slot, null); } } } return stack; } @Override public ItemStack getStackInSlotOnClosing(int slot) { ItemStack stack = getStackInSlot(slot); if (stack != null) { setInventorySlotContents(slot, null); } return stack; } @Override public int getInventoryStackLimit() { return 64; } @Override public boolean isUseableByPlayer(EntityPlayer player) { return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64; } @Override public void readFromNBT(NBTTagCompound tagCompound){ super.readFromNBT(tagCompound); NBTTagList nbttaglist = tagCompound.getTagList("Items", 10); this.inv = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); ++i){ NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); int j = nbttagcompound.getByte("Slot") & 255; if (j >= 0 && j < this.inv.length){ this.inv[j] = ItemStack.loadItemStackFromNBT(nbttagcompound); } } readFromSyncableNBT(tagCompound); } @Override public void writeToNBT(NBTTagCompound tagCompound){ super.writeToNBT(tagCompound); NBTTagList nbttaglist = new NBTTagList(); for(int i = 0; i < this.inv.length; ++i){ if(this.inv[i] != null){ NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.setByte("Slot", (byte)i); this.inv[i].writeToNBT(nbttagcompound); nbttaglist.appendTag(nbttagcompound); } } tagCompound.setTag("Items", nbttaglist); writeToSyncableNBT(tagCompound); } public void readFromSyncableNBT(NBTTagCompound tagCompound){ tank.readFromNBT(tagCompound); } public void writeToSyncableNBT(NBTTagCompound tagCompound){ tank.writeToNBT(tagCompound); } @Override public String getInventoryName(){ return "bottleoblood.bloodBottlerEntity"; } @Override public boolean hasCustomInventoryName(){ return false; } @Override public void openInventory(){ } @Override public void closeInventory(){ } @Override public boolean isItemValidForSlot(int slot, ItemStack item){ switch(slot){ case 0: if(isItemBlood(item) || isItemBloodContainer(item)){ return true; } case 2: if(item.getItem() == Items.glass_bottle || isItemBloodContainer(item)){ return true; }else{ return false; } } return false; } public static boolean isItemBlood(ItemStack item){ // SNIP - Returns true if item has a blood value. } public static int getItemBloodValue(ItemStack item){ // SNIP - Returns how much blood, in mBs, an item contains. } public static ItemStack getBloodItemReturn(ItemStack item){ // SNIP - Returns, as an ItemStack, what should be returned after extracting blood from an item. returns null if should return nothing. } public static Fluid getItemBloodType(ItemStack item){ // SNIP - Returns, as a Fluid, what type of blood is produced by an item (BottleOBLood.bloodNormalFluid,BottleOBlood.bloodCorruptFluid, or BottleOBlood.bloodVampiricFluid) } @Override public void updateEntity(){ if(!worldObj.isRemote){ if(inv[0] != null && inv[0].stackSize > 0){ if(tank.getFluidAmount() < 10000){ if(isItemBloodContainer(inv[0])){ IFluidContainerItem fluidContainer = (IFluidContainerItem)inv[0].getItem(); if(fluidContainer.getFluid(inv[0]) != null && (fluidContainer.getFluid(inv[0]).amount > 0 && fluidContainer.getFluid(inv[0]).getFluid().equals(FluidRegistry.getFluid("evilcraftblood")))){ int bloodToDrain = Math.min(fluidContainer.getFluid(inv[0]).amount, 100); tank.fill(fluidContainer.drain(inv[0], bloodToDrain, true),true); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); markDirty(); } }else{ if(isItemBlood(inv[0])){ if(!BottleOBlood.instance.isCorruptBloodExtractable && getItemBloodType(inv[0]) == BottleOBlood.bloodCorruptFluid)return; if(!BottleOBlood.instance.isVampiricBloodExtractable && getItemBloodType(inv[0]) == BottleOBlood.bloodVampiricFluid)return; tank.fill(new FluidStack(getItemBloodType(inv[0]),getItemBloodValue(inv[0])),true); ItemStack outputStack = getBloodItemReturn(inv[0]); if(outputStack != null){ if(inv[1] == null){ inv[1] = outputStack; }else if(inv[1].getItem() == outputStack.getItem() && inv[1].stackSize < 64){ inv[1].stackSize++; } } if(getItemBloodType(inv[0]) != BottleOBlood.bloodNormalFluid){ if(BottleOBlood.instance.isCorruptBloodEnabled && getItemBloodType(inv[0]) == BottleOBlood.bloodCorruptFluid){ tank.setFluid(new FluidStack(BottleOBlood.bloodCorruptFluid,tank.getFluidAmount())); } if(BottleOBlood.instance.isVampiricBloodEnabled && (getItemBloodType(inv[0]) == BottleOBlood.bloodVampiricFluid && tank.getFluid().getFluid() == BottleOBlood.bloodNormalFluid)){ tank.setFluid(new FluidStack(BottleOBlood.bloodVampiricFluid,tank.getFluidAmount())); } } inv[0].stackSize--; if(inv[0].stackSize < 1)inv[0] = null; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); markDirty(); } } } } if(inv[2] != null && inv[2].stackSize > 0){ if(inv[2].getItem() == Items.glass_bottle){ if(tank.getFluidAmount() >= 1000){ if(tank.getFluid().getFluid() == BottleOBlood.bloodNormalFluid){ if(inv[3] != null && inv[3].getItem().equals(BottleOBlood.itemBottleBlood)){ if(inv[3].stackSize < 64){ inv[3].stackSize += 1; }else{ return; } }else{ inv[3] = new ItemStack(BottleOBlood.itemBottleBlood,1); } } if(tank.getFluid().getFluid() == BottleOBlood.bloodCorruptFluid){ if(inv[3] != null && inv[3].getItem().equals(BottleOBlood.itemCorruptBottleBlood)){ if(inv[3].stackSize < 64){ inv[3].stackSize += 1; }else{ return; } }else{ inv[3] = new ItemStack(BottleOBlood.itemCorruptBottleBlood,1); } } if(tank.getFluid().getFluid() == BottleOBlood.bloodVampiricFluid){ if(inv[3] != null && inv[3].getItem().equals(BottleOBlood.itemVampiricBottleBlood)){ if(inv[3].stackSize < 64){ inv[3].stackSize += 1; }else{ return; } }else{ inv[3] = new ItemStack(BottleOBlood.itemVampiricBottleBlood,1); } } tank.drain(1000, true); inv[2].stackSize--; if(inv[2].stackSize < 1)inv[2] = null; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); markDirty(); } } if(inv[2].getItem() == Items.bucket){ if(tank.getFluidAmount() >= 1000 && inv[3] == null){ if(tank.getFluid().getFluid() == BottleOBlood.bloodNormalFluid){ if(inv[3] == null){ inv[3] = new ItemStack(BottleOBlood.itemBucketBlood,1); } } if(tank.getFluid().getFluid() == BottleOBlood.bloodCorruptFluid){ if(inv[3] == null){ inv[3] = new ItemStack(BottleOBlood.itemCorruptBucketBlood,1); } } if(tank.getFluid().getFluid() == BottleOBlood.bloodVampiricFluid){ if(inv[3] == null){ inv[3] = new ItemStack(BottleOBlood.itemVampiricBucketBlood,1); } } tank.drain(1000, true); inv[2].stackSize--; if(inv[2].stackSize < 1)inv[2] = null; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); markDirty(); } } if(isItemBloodContainer(inv[2]) && tank.getFluid().getFluid() == BottleOBlood.bloodNormalFluid){ IFluidContainerItem fluidContainer = (IFluidContainerItem)inv[2].getItem(); int bloodToDrain = 0; if((fluidContainer.getFluid(inv[2]) != null && fluidContainer.getFluid(inv[2]).amount < fluidContainer.getCapacity(inv[2])) && fluidContainer.getFluid(inv[2]).getFluid().equals(FluidRegistry.getFluid("evilcraftblood"))){ int spaceInContainer = fluidContainer.getCapacity(inv[2]) - fluidContainer.getFluid(inv[2]).amount; bloodToDrain = Math.min(tank.getFluidAmount(), spaceInContainer); bloodToDrain = Math.min(bloodToDrain, 100); }else if(fluidContainer.getFluid(inv[2]) == null){ bloodToDrain = Math.min(tank.getFluidAmount(), 100); }; fluidContainer.fill(inv[2], tank.drain(bloodToDrain, true), true); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); markDirty(); } } } } public int getBloodStoredScaled(float scale){ return Math.round((float)tank.getFluidAmount() * (scale / 10000f)); } @Override public Packet getDescriptionPacket(){ NBTTagCompound syncData = new NBTTagCompound(); writeToSyncableNBT(syncData); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, syncData); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){ readFromSyncableNBT(pkt.func_148857_g()); } @Override public int[] getAccessibleSlotsFromSide(int side){ if(side == 0){ return new int[]{1}; }else if(side == 1){ return new int[]{0}; }else if(side == getWorldObj().getBlockMetadata(xCoord, yCoord, zCoord)){ return new int[]{3}; }else{ return new int[]{2}; } } @Override public boolean canInsertItem(int par1, ItemStack par2, int par3) { return true; } @Override public boolean canExtractItem(int par1, ItemStack par2, int par3) { return true; } public FluidTankAdv getTank(){ return this.tank; } public int fill(ForgeDirection paramForgeDirection, FluidStack paramFluidStack, boolean paramBoolean){ return 0; } public FluidStack drain(ForgeDirection paramForgeDirection, FluidStack paramFluidStack, boolean paramBoolean){ return this.tank.drain(paramFluidStack.amount, paramBoolean); } public FluidStack drain(ForgeDirection paramForgeDirection, int paramInt, boolean paramBoolean){ return this.tank.drain(paramInt, paramBoolean); } public boolean canFill(ForgeDirection paramForgeDirection, Fluid paramFluid){ return false; } public boolean canDrain(ForgeDirection paramForgeDirection, Fluid paramFluid){ return true; } public FluidTankInfo[] getTankInfo(ForgeDirection paramForgeDirection){ return new FluidTankInfo[] { this.tank.getInfo() }; } } BloodBottlerGui package bottleoblood.client.gui.tileentity; //import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; import cofh.core.gui.GuiBaseAdv; import cofh.lib.gui.element.ElementFluidTank; import bottleoblood.container.BloodBottlerContainer; import bottleoblood.tileentity.BloodBottlerEntity; public class BloodBottlerGui extends GuiBaseAdv{ BloodBottlerEntity tileEntity; public BloodBottlerGui(InventoryPlayer inventoryPlayer, BloodBottlerEntity tileEntity) { //the container is instantiated and passed to the superclass for handling super(new BloodBottlerContainer(inventoryPlayer, tileEntity)); this.tileEntity = tileEntity; } @Override protected void drawGuiContainerForegroundLayer(int param1, int param2){ //draw text and stuff here //the parameters for drawString are: string, x, y, color mc.fontRenderer.drawString("Blood Bottler", 5, 3, 4210752); //draws "Inventory" or your regional equivalent mc.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 5, ySize - 94, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3){ super.func_73866_w_(); addElement(new ElementFluidTank(this, 43, 13, tileEntity.getTank())); //draw your Gui here, only thing you need to change is the path GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.getTextureManager().bindTexture(new ResourceLocation("bottleoblood", "textures/gui/BloodBottlerGui.png")); int x = (width - xSize) / 2; int y = (height - ySize) / 2; drawTexturedModalRect(x, y, 0, 0, xSize, ySize); drawTexturedModalRect(x + 43, y + 14, 176, 58, 16, 58); } } GuiHandler package bottleoblood.client.gui; import bottleoblood.container.*; import bottleoblood.client.gui.tileentity.*; import bottleoblood.tileentity.*; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); if(tileEntity instanceof BloodBottlerEntity){ return new BloodBottlerContainer(player.inventory, (BloodBottlerEntity) tileEntity); } return null; } @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tileEntity = world.getTileEntity(x, y, z); if(tileEntity instanceof BloodBottlerEntity){ return new BloodBottlerGui(player.inventory, (BloodBottlerEntity) tileEntity); } return null; } }
IPS spam blocked by CleanTalk.