-
Posts
235 -
Joined
-
Last visited
Everything posted by abused_master
-
Hey guys, so i need some help creating a multiblock tank. So the tank will be as so, 5x5x5, contains a tank controller and an input valve and output valve, and once put together will have a custom model. Now I don't really know anything about making a multiblock, how would i do this? is it something along the lines of like when the controller is placed check if certain blocks are placed around it? or is there a much better way to do this? once the multiblock is created how do i set the input and output blocks to only do their respective parts? and lastly how would i specify the model? would it be ok to be a json made to a 5x5x5 size or would it have to be something like a java model/obj model? and would i need a TESR? i presume so to render the liquid thanks for the help even though i think i'm asking a lot.
-
oh i see, didn't realize this, thanks was able to get everything done
-
So while testing with the total cook time i ran into a problem, if(inventory.getStackInSlot(3).getItem() == new ItemStack(ModItems.ItemUpgrades, 1, 1).getItem()) { return 120; } that's for my speed upgrade 1, the problem is if i do the same for all others it only uses 1 of the returned values from all 3 if(), however when i switch the items to gold, diamond, and iron, it works fine, i'm guessing this is an issue with meta, anyone know how to solve this?
-
Thanks guys, was able to figure it out Now i have another question, this one deals with custom upgrades. I want my Crusher to allow speed upgrades and speed up the cook time. The problem is i dont know what the best way to do it is. I have thought about creating a method and checking each upgrade and changing the total cook time based on that, thought of incrementing the cook time by 2, 4, and 8 based on the upgrade, but i'd like to hear what the best way you guys think it should be done.
-
So i did that and denied extraction and then tried to ignore it in the slot impl but i could only extract on shift click and couldn't figure out why normal click doesn't extract. Slot Class: public class SlotInput extends SlotItemHandler { private final ItemStackHandlerCustom handler; public SlotInput(ItemStackHandlerCustom handler, int index, int xPosition, int yPosition) { super(handler, index, xPosition, yPosition); this.handler = handler; } @Override public boolean isItemValid(ItemStack stack) { return !stack.isEmpty(); } @Override @Nonnull public ItemStack getStack(){ return this.handler.getStackInSlot(this.getSlotIndex()); } @Override public void putStack(ItemStack stack){ this.handler.setStackInSlot(this.getSlotIndex(), stack); this.onSlotChanged(); } @Override public int getItemStackLimit(ItemStack stack) { return stack.getMaxStackSize(); } @Override public boolean canTakeStack(EntityPlayer playerIn) { return true; } @Override public ItemStack decrStackSize(int amount) { return this.handler.extractItemInternal(this.getSlotIndex(), amount, false); } }
-
All right i see, but i was wondering, how would i prevent extraction from pipes completely in a certain slot, say my upgrade slot, i dont mind an upgrade being piped in but i dont want it to accidentally get piped out while exporting my outputs
-
what type of handlers are available to use in such a fashion?
-
so now with that done and tested everything seems to work just fine, but going back to the topic what would i use instead of canExtract/getSlotsForFace/canInsert?
-
while doing a bit of digging through i was able to come up with this that works fine: addSlotToContainer(new SlotItemHandler(itemHandler, 1, 116, 15) { @Override public boolean isItemValid(@Nonnull ItemStack stack) { return false; } }); addSlotToContainer(new SlotItemHandler(itemHandler, 2, 116, 36) { @Override public boolean isItemValid(@Nonnull ItemStack stack) { return false; } }); but subclassing it would be much neater so i might just go with that
-
Ok, fine, switching to IItemHandler, so i have a question in my container i was previously using SlotFurnaceOutput, do i just add SlotItemHandler instead? how do i specify its an output only slot not input? this is my new code did i convert correctly? public static final int SIZE = 4; private ItemStackHandler itemStackHandler = new ItemStackHandler(SIZE) { @Override protected void onContentsChanged(int slot) { TileEntityCrusher.this.markDirty(); } }; @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); if (nbt.hasKey("items")) { itemStackHandler.deserializeNBT((NBTTagCompound) nbt.getTag("items")); } this.cookTime = nbt.getInteger("CookTime"); this.totalCookTime = nbt.getInteger("TotalCookTime"); storage.readFromNBT(nbt); } @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setTag("items", itemStackHandler.serializeNBT()); nbt.setInteger("cookTime", (short)this.cookTime); nbt.setInteger("TotalCookTime", (short)this.totalCookTime); return storage.writeToNBT(nbt); } public boolean canInteractWith(EntityPlayer playerIn) { return !isInvalid() && playerIn.getDistanceSq(pos.add(0.5D, 0.5D, 0.5D)) <= 64D; } @Override public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) { if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return true; } return super.hasCapability(capability, facing); } @Nullable @Override public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) { if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return (T) itemStackHandler; } return super.getCapability(capability, facing); } Container: private TileEntityCrusher tileCrusher; public ContainerPulverizer(IInventory playerInv, TileEntityCrusher te) { super(playerInv, te); this.tileCrusher = te; IItemHandler itemHandler = this.tileCrusher.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); //input addSlotToContainer(new SlotItemHandler(itemHandler, 0, 56, 26)); //output 1 & 2 addSlotToContainer(new SlotItemHandler(itemHandler, 1, 116, 15)); addSlotToContainer(new SlotItemHandler(itemHandler, 2, 116, 36)); //upgrade slot addSlotToContainer(new SlotItemHandler(itemHandler, 3, 8, 58)); /* addSlotToContainer(new Slot(iinventory, 0, 56, 26)); addSlotToContainer(new SlotFurnaceOutput(playerInv.player, iinventory, 1, 116, 15)); addSlotToContainer(new SlotFurnaceOutput(playerInv.player, iinventory, 2, 116, 36)); addSlotToContainer(new Slot(iinventory, 3, 8, 58)); */ } and then how would i specify piping in/out from pipes/hopper?
-
im using the IInventory wrapper private net.minecraftforge.items.IItemHandler itemHandler; protected net.minecraftforge.items.IItemHandler createUnSidedHandler() { return new net.minecraftforge.items.wrapper.InvWrapper(this); } @SuppressWarnings("unchecked") @Override @javax.annotation.Nullable public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @javax.annotation.Nullable net.minecraft.util.EnumFacing facing) { if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) return (T) (itemHandler == null ? (itemHandler = createUnSidedHandler()) : itemHandler); return super.getCapability(capability, facing); } @Override public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, @javax.annotation.Nullable net.minecraft.util.EnumFacing facing) { return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); }
-
Hey guys, so i'm having some trouble with my tile entity inventory methods, specifically: @Override public int[] getSlotsForFace(EnumFacing side) { return new int[] {0, 1, 2}; } @Override public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) { return index == 0; } @Override public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) { return index == 1 || index == 2; } I'm not sure if i'm just not understanding it correctly or doing it wrong, but my goal is to allow piping in from anything to go into slot 0 which works, but i want to make it so that extraction only works on slots 1 and 2 which is what i defined in canExtractItem but that doesn't seem to work it extracts from slot 0 anyways
-
Which event should i use? How can i go about checking if an outside damagesource is registered?
-
Hey guys, so i was working on my armor and wanted to an ability for that protected against void damage or any damage source that had . setDamageBypassesArmo() but i had no idea how i could go about protecting against it or set it so it doesn't damage at all
-
So what someone advised me to do is bind another texture within the models render method, with that being said i did it as such: @Override public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) { if(!entityLiving.onGround) { Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(AAdditions.MODID, "textures/models/armor/infinity_wings.png")); return InfinityWingsModel.INSTANCE; } return super.getArmorModel(entityLiving, itemStack, armorSlot, _default); } but that doesnt seem to work
-
Hey guys, so i was working with armor and was wondering how i can render a model alongside the regular armor texture. What i mean by that is having this @Override public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) { return "eadditions:textures/models/infinity_armor.png"; } for the regular armor and then render wings on when the player is flying, as such @Override public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) { if(!entityLiving.onGround) { return InfinityWingsModel.INSTANCE; } return super.getArmorModel(entityLiving, itemStack, armorSlot, _default); } and calling the texture, while still rendering the armor, so basically render both not 1 or the other
-
Hey guys, so im working on my Machine and i added a slot for an "Energy Upgrade" . Basically what i want this to do is when its in the correct slot it will double the amount of energy the block can store. The problem im having is i cant figure out how to dynamically change it. if tried setting it to energyStored * energyMultiplier and set energyMultiplier to 2 if the upgrade is detected but i get nothing out of that. public int storageMultiplier = 1; public TilePulverizer() { if(pulverizerInv.get(5).getItem() == ModItems.EnergyUpgrade) storageMultiplier = 2; if(pulverizerInv.get(5).isEmpty()) storageMultiplier = 1; } public EnergyStorage storage = new EnergyStorage(50000 * storageMultiplier);
-
[1.10.2] texture overlay and coloring
abused_master replied to abused_master's topic in Modder Support
Ah i see, all right thank you, iv managed to get it working -
[1.10.2] texture overlay and coloring
abused_master replied to abused_master's topic in Modder Support
Iv managed to figure out both of those, but to a certain extent, this item has 9 other sub items, iv colored the main item, and the overlay easilly, but for the sub items i did this: public class ItemSingularity extends Item implements IItemColor { SingularityType type; public ItemSingularity(String UnlocalizedName){ this.setHasSubtypes(true); this.setMaxDamage(0); this.setUnlocalizedName(UnlocalizedName); this.setCreativeTab(AvaritiaAdditions.AvaritiaAdditions); GameRegistry.register(this.setRegistryName(UnlocalizedName)); } @Override public String getUnlocalizedName(ItemStack stack) { int i = MathHelper.clamp_int(stack.getItemDamage(), 0, SingularityType.values().length); return "item.singularity_" + SingularityType.values()[i]; } @SuppressWarnings({ "unchecked", "rawtypes" }) @SideOnly(Side.CLIENT) @Override public void getSubItems(Item item, CreativeTabs tab, List list) { for (int j = 0; j < SingularityType.values().length; ++j) { list.add(new ItemStack(item, 1, j)); } } @Override public EnumRarity getRarity(ItemStack stack) { return EnumRarity.UNCOMMON; } @Override public int getColorFromItemstack(ItemStack stack, int tintIndex) { switch (type) { case iron: if (tintIndex == 0) return 0x7F7F7F; if (tintIndex == 1) return 0xBFBFBF; break; case gold: if (tintIndex == 0) return 0xdba213; if (tintIndex == 1) return 0xBFBFBF; break; case lapis: if (tintIndex == 0) return 0x224baf; if (tintIndex == 1) return 0x5a82e2; break; case redstone: if (tintIndex == 0) return 0x900000; if (tintIndex == 1) return 0xDF0000; break; case netherquartz: if (tintIndex == 0) return 0x94867d; if (tintIndex == 1) return 0xeeebe6; break; case copper: if (tintIndex == 0) return 0x89511A; if (tintIndex == 1) return 0xE47200; break; case tin: if (tintIndex == 0) return 0x9BA9B2; if (tintIndex == 1) return 0xA5C7DE; break; case lead: if (tintIndex == 0) return 0x3E3D4E; if (tintIndex == 1) return 0x444072; break; case silver: if (tintIndex == 0) return 0xD5D5D5; if (tintIndex == 1) return 0xF9F9F9; break; case nickel: if (tintIndex == 0) return 0xC4C698; if (tintIndex == 1) return 0xDEE187; break; } return 0; } public enum SingularityType implements IStringSerializable { iron("iron"), gold("gold"), lapis("lapis"), redstone("redstone"), netherquartz("quartz"), copper("copper"), tin("tin"), lead("lead"), silver("silver"), nickel("nickel"); final String name; SingularityType(String name) { this.name = name; } @Override public String getName() { return name; } } } could someone tell me if i did this right or wrong? and if wrong what i need to change/fix? my json: { "parent": "item/generated", "textures": { "layer0": "avaritiaadditions:items/singularity2", "layer1": "avaritiaadditions:items/singularity" } } how do i go about rending the other sub items? -
Hey guys, so im trying to do 2 things atm, #1 Render a texture overlay with my item, #2 Color my item like the grassblock does Could someone maybe point me to some repository that does this/explain how i could go about doing it.
-
Never mind i managed to figure it out Thanks for the help
-
All right i updated forge which fixed it from crashing. So now, what exactly is an IStateMapper and how can i go about setting one?
-
Hey guys, so i was attempting to make a custom tree, but ran into a crash that i cant figure out how to fix or whats causing it with the leaves. Crash Report: http://pastebin.com/i9T3vTjA RubberLeaves: http://pastebin.com/STLZU272 the rendering in game isnt working correct either, inventory is fine but placed isnt, and there are no texture errors in console BlockState: { "variants": { "normal": { "model": "techexpansion:rubber_leaves" }, "inventory": { "model": "techexpansion:rubber_leaves" } } } and block model json: { "parent": "block/leaves", "textures": { "all": "techexpansion:blocks/rubber_leaves" } } Yes i registered the render in my modblocks class
-
Is there no way around it? someone suggested i do something like this: public static ItemStack getOreDict(String oreIdName) { List<ItemStack> res = OreDictionary.getOres(oreIdName); if (res != null) { ItemStack[] res2 = res.toArray(new ItemStack[res.size()]); for (int i = 0; i < res.size(); ++i) { return new ItemStack(res2[i].getItem()); } } return null; } thought id get some others opinions on it.
-
Hey guys, so im having a bit of trouble figuring out oreDictionary for smelting recipes, iv done this for crafting recipes: public static void addShapedRecipe(ItemStack output, Object... input){ GameRegistry.addRecipe(new ShapedOreRecipe(output, input)); } public static void addShapelessRecipe(ItemStack output, Object... input){ GameRegistry.addRecipe(new ShapelessOreRecipe(output, input)); } but i cant figure out how to do this for smelting recipes