Everything posted by gmod622
- Using / Implementing API?
-
Using / Implementing API?
Hey all! So I want to use Baubles in my mod, however, I'm having trouble getting it into my environment.
-
Learning to Mod.
Thanks! Any tips in learning functions and important things I should know? Or does that just come with experience
-
Learning to Mod.
What are some good tutorials for 1.10 that help explain minecraft, create efficient mods, and overall help me with modding. I already know a few, including -TGG Blog -Shadow Facts any other really well put together ones?
-
Creating a crafting handler the exports multiple items
Okay, So I'm having a problem with applying the multiple output slots, the item smelts, but doesn't give an output nor get used. I KNOW there is something with it, but I cant figure it out: private boolean canSmelt() {return smeltItem(false);} /** * Smelt an input item into an output slot, if possible */ private void smeltItem() {smeltItem(true);} /** * checks that there is an item to be smelted in one of the input slots and that there is room for the result in the output slots * If desired, performs the smelt * @param performSmelt if true, perform the smelt. if false, check whether smelting is possible, but don't change the inventory * @return false if no items can be smelted, true otherwise */ private boolean smeltItem(boolean performSmelt) { Integer firstSuitableInputSlot = null; Integer firstSuitableOutputSlot = null; ItemStack result = null; if (itemStacks[0] != null) { result = getSmeltingResultForItem(itemStacks[0]); if (result != null) { for (int outputSlot = FIRST_OUTPUT_SLOT; outputSlot < FIRST_OUTPUT_SLOT + OUTPUT_SLOTS_COUNT; outputSlot++) { ItemStack outputStack = itemStacks[outputSlot]; if (outputStack == null) { firstSuitableOutputSlot = outputSlot; break; } if (outputStack.getItem() == result.getItem() && (!outputStack.getHasSubtypes() || outputStack.getMetadata() == outputStack.getMetadata()) && ItemStack.areItemStackTagsEqual(outputStack, result)) { int combinedSize = itemStacks[outputSlot].stackSize + result.stackSize; if (combinedSize <= getInventoryStackLimit() && combinedSize <= itemStacks[outputSlot].getMaxStackSize()) { firstSuitableOutputSlot = outputSlot; break; } } } } } return true; } // returns the smelting result for the given stack. Returns null if the given stack can not be smelted public static ItemStack getSmeltingResultForItem(ItemStack stack) { return FurnaceRecipes.instance().getSmeltingResult(stack); } // re EDIT: Just trying to get the regular furnace recipes working
-
How to use item property override, jsons and inheritance?
A good tutorial about the game: http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html
-
Creating a crafting handler the exports multiple items
It was when I had multiple inputs, but I changed the slots, will change.
-
Liqiud .json?
Well, my game is still looking for different fluid states, ex: [12:01:00] [Client thread/ERROR] [FML]: Exception loading model for variant plentifulmisc:liquid_galium#level=13 for blockstate "plentifulmisc:liquid_galium[level=13]" net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model plentifulmisc:liquid_galium#level=13 with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:241) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:145) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:229) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:146) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:132) [simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:113) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:799) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:340) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:561) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1184) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 24 more [12:01:00] [Client thread/ERROR] [FML]: Exception loading model for variant plentifulmisc:liquid_galium#level=14 for blockstate "plentifulmisc:liquid_galium[level=14]" net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model plentifulmisc:liquid_galium#level=14 with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:241) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:145) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:229) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:146) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:132) [simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:113) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:799) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:340) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:561) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1184) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 24 more [12:01:00] [Client thread/ERROR] [FML]: Exception loading model for variant plentifulmisc:liquid_galium#level=15 for blockstate "plentifulmisc:liquid_galium[level=15]" net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model plentifulmisc:liquid_galium#level=15 with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:241) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:145) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:229) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:146) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:132) [simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:113) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:799) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:340) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:561) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1184) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?] ... 24 more
-
Creating a crafting handler the exports multiple items
No I have a 1 input > 5 output slots
-
Container disappears when created by item.
package com.lambda.PlentifulMisc.item; import com.lambda.PlentifulMisc.block.ModBlocks; import com.lambda.PlentifulMisc.main.PlentifulMisc; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemSeedFood; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; public class ModItems { public static ItemCheese cheese; public static Item ROCKCRESS; //Craftables public static ItemAtPAP2 AtPAP2; public static ItemWaxHoe waxHoe; public static ItemGaliumT treatedGal; public static ItemFuelEfficiencyUpgrade fuelEffUpgrade; public static ItemSpeedUpgrade speedUpgrade; //Crafties public static ItemWax wax; public static ItemVial vial; public static ItemCrateUpgrade crateUpgrade; public static void load(FMLPreInitializationEvent event) { cheese = new ItemCheese(); ROCKCRESS = register(new ItemSeedFood(1, 0.3F, ModBlocks.CROP_ROCKCRESS, Blocks.FARMLAND).setUnlocalizedName("rockcress").setRegistryName("rockcress").setCreativeTab(PlentifulMisc.instance.creativeTab)); AtPAP2 = new ItemAtPAP2(); waxHoe = new ItemWaxHoe(); wax = new ItemWax(); vial = new ItemVial(); treatedGal = new ItemGaliumT(); fuelEffUpgrade = new ItemFuelEfficiencyUpgrade(); speedUpgrade = new ItemSpeedUpgrade(); crateUpgrade = new ItemCrateUpgrade(); ModelLoader.setCustomModelResourceLocation(ROCKCRESS, 0, new ModelResourceLocation(ROCKCRESS.getRegistryName(), "inventory")); } private static <T extends Item> T register(T item) { GameRegistry.register(item); if (item instanceof IItemModelProvider ) { ((IItemModelProvider )item).registerItemModel(item); } return item; } } Registration, I have no itemblock for my blocks.
-
Container disappears when created by item.
Doesn't seem like it did anything
-
Container disappears when created by item.
Which line? the hook one?
-
Container disappears when created by item.
Yeah here it is: package com.lambda.PlentifulMisc.block; import com.lambda.PlentifulMisc.block.tileentity.TileEntityCrate; import com.lambda.PlentifulMisc.client.gui.CrateGuiHandler; import com.lambda.PlentifulMisc.main.PlentifulMisc; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; //Note that in 1.10.*, extending BlockContainer can cause rendering problems if you don't extend getRenderType() // If you don't want to extend BlockContainer, make sure to add the tile entity manually, // using hasTileEntity() and createTileEntity(). See BlockContainer for a couple of other important methods you may // need to implement. public class BlockCrate extends BlockContainer { public BlockCrate() { super(Material.ROCK); this.setCreativeTab(PlentifulMisc.instance.creativeTab); // the block will appear on the Blocks tab. } /** * Create the Tile Entity for this block. * If your block doesn't extend BlockContainer, use createTileEntity(World worldIn, IBlockState state) instead * @param worldIn * @param meta * @return */ @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityCrate(); } // not needed if your block implements ITileEntityProvider (in this case implemented by BlockContainer), but it // doesn't hurt to include it anyway... @Override public boolean hasTileEntity(IBlockState state) { return true; } // Called when the block is right clicked // In this block it is used to open the blocks gui when right clicked by a player @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { // Uses the gui handler registered to your mod to open the gui for the given gui id // open on the server side only (not sure why you shouldn't open client side too... vanilla doesn't, so we better not either) if (worldIn.isRemote) return true; playerIn.openGui(PlentifulMisc.instance, CrateGuiHandler.getGuiID(), worldIn, pos.getX(), pos.getY(), pos.getZ()); return true; } // This is where you can do something when the block is broken. In this case drop the inventory's contents @Override public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { IInventory inventory = worldIn.getTileEntity(pos) instanceof IInventory ? (IInventory)worldIn.getTileEntity(pos) : null; if (inventory != null){ // For each slot in the inventory for (int i = 0; i < inventory.getSizeInventory(); i++){ // If the slot is not empty if (inventory.getStackInSlot(i) != null) { // Create a new entity item with the item stack in the slot EntityItem item = new EntityItem(worldIn, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, inventory.getStackInSlot(i)); // Apply some random motion to the item float multiplier = 0.1f; float motionX = worldIn.rand.nextFloat() - 0.5f; float motionY = worldIn.rand.nextFloat() - 0.5f; float motionZ = worldIn.rand.nextFloat() - 0.5f; item.motionX = motionX * multiplier; item.motionY = motionY * multiplier; item.motionZ = motionZ * multiplier; // Spawn the item in the world worldIn.spawnEntityInWorld(item); } } // Clear the inventory so nothing else (such as another mod) can do anything with the items inventory.clear(); } // Super MUST be called last because it removes the tile entity super.breakBlock(worldIn, pos, state); } //--------------------------------------------------------- // the block will render in the SOLID layer. See http://greyminecraftcoder.blogspot.co.at/2014/12/block-rendering-18.html for more information. @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.SOLID; } // render using a BakedModel (mbe30_inventory_basic.json --> mbe30_inventory_basic_model.json) // required because the default (super method) is INVISIBLE for BlockContainers. @Override public EnumBlockRenderType getRenderType(IBlockState iBlockState) { return EnumBlockRenderType.MODEL; } }
-
Liqiud .json?
Hey all! So I'm creating a fluid, however im stuck on the blockstate + model .json file, I cannot access minecraft's ones because 'eclipse isn't compatible'
-
Container disappears when created by item.
Okay, so same problem still exists, no texture, can access but disappears on relog.
-
Container disappears when created by item.
Oh... Didnt even see that there, used my hoe class as a reference to change blocks. must of forgot to remove that.
-
Creating a crafting handler the exports multiple items
Okay, So now the Tile is wanting a list, which I gave, however I'm getting a bunch of errors because its a list, instead of an itemstack. Edit: Here is the function that needs some tweaking: private boolean smeltItem(boolean performSmelt) { Integer firstSuitableInputSlot = null; Integer firstSuitableOutputSlot = null; List<OutputWrapper> result = null; for (int inputSlot = FIRST_INPUT_SLOT; inputSlot < FIRST_INPUT_SLOT + INPUT_SLOTS_COUNT; inputSlot++) { if (itemStacks[inputSlot] != null) { result = getSmeltingResultForItem(itemStacks[inputSlot]); if (result != null) { // find the first suitable output slot- either empty, or with identical item that has enough space for (int outputSlot = FIRST_OUTPUT_SLOT; outputSlot < FIRST_OUTPUT_SLOT + OUTPUT_SLOTS_COUNT; outputSlot++) { ItemStack outputStack = itemStacks[outputSlot]; if (outputStack == null) { firstSuitableInputSlot = inputSlot; firstSuitableOutputSlot = outputSlot; break; } if (outputStack.getItem() == result.getItem() && (!outputStack.getHasSubtypes() || outputStack.getMetadata() == outputStack.getMetadata()) && ItemStack.areItemStackTagsEqual(outputStack, result)) { int combinedSize = itemStacks[outputSlot].stackSize + result.stackSize; if (combinedSize <= getInventoryStackLimit() && combinedSize <= itemStacks[outputSlot].getMaxStackSize()) { firstSuitableInputSlot = inputSlot; firstSuitableOutputSlot = outputSlot; break; } } } if (firstSuitableInputSlot != null) break; } } } if (firstSuitableInputSlot == null) return false; if (!performSmelt) return true; // alter input and output itemStacks[firstSuitableInputSlot].stackSize--; if (itemStacks[firstSuitableInputSlot].stackSize <=0) itemStacks[firstSuitableInputSlot] = null; if (itemStacks[firstSuitableOutputSlot] == null) { itemStacks[firstSuitableOutputSlot] = result.copy(); // Use deep .copy() to avoid altering the recipe } else { itemStacks[firstSuitableOutputSlot].stackSize += result.stackSize; } markDirty(); return true; }
-
Creating a crafting handler the exports multiple items
So something like this? @Nullable public ItemStack getMultiResult(ItemStack stack) { for (Entry<ItemStack, ItemStack> entry : this.smeltingList.entrySet()) { if (this.compareItemStacks(stack, entry.getKey())) { multismeltList.get(stack); return stack; } } return null; } or this? @Nullable public List<OutputWrapper> getMultiResult(ItemStack stack) { for (Entry<ItemStack, ItemStack> entry : this.smeltingList.entrySet()) { if (this.compareItemStacks(stack, entry.getKey())) { List<OutputWrapper> list = new ArrayList<OutputWrapper>(); return list; } } return null; } or neither?
-
Container disappears when created by item.
Hey all! So I have an item, when on right click on a plank, turns it into a crate.. However, the server doesn't seem to update and will disappear with relog or right click, it also has no textures. Here is the item: package com.lambda.PlentifulMisc.item; import java.util.List; import com.lambda.PlentifulMisc.block.ModBlocks; import com.lambda.PlentifulMisc.main.PlentifulMisc; import net.minecraft.block.Block; import net.minecraft.block.BlockDirt; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ItemCrateUpgrade extends ItemBase implements IItemModelProvider { public ItemCrateUpgrade() { super("crateUpgrade"); registerItemModel(this); } @Override public void registerItemModel(Item item) { PlentifulMisc.proxy.registerItemRenderer(item, 0, "crateUpgrade"); } @Override public void addInformation(ItemStack stack, EntityPlayer player, List info, boolean par4) { info.add(com.mojang.realmsclient.gui.ChatFormatting.GREEN + "+ Turns a Plank Into a Crate"); info.add(com.mojang.realmsclient.gui.ChatFormatting.ITALIC + "Right Click on A Plank to Apply"); } public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (!playerIn.canPlayerEdit(pos.offset(facing), facing, stack)) { return EnumActionResult.FAIL; } else { int hook = net.minecraftforge.event.ForgeEventFactory.onHoeUse(stack, playerIn, worldIn, pos); if (hook != 0) return hook > 0 ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; IBlockState iblockstate = worldIn.getBlockState(pos); Block block = iblockstate.getBlock(); if (facing != EnumFacing.DOWN && worldIn.isAirBlock(pos.up())) { if (block == Blocks.PLANKS) { this.setBlock(stack, playerIn, worldIn, pos, ModBlocks.CRATE.getDefaultState()); return EnumActionResult.SUCCESS; } } return EnumActionResult.PASS; } } protected void setBlock(ItemStack stack, EntityPlayer player, World worldIn, BlockPos pos, IBlockState state) { worldIn.playSound(player, pos, SoundEvents.BLOCK_ANVIL_FALL, SoundCategory.BLOCKS, 1.0F, 1.0F); if (!worldIn.isRemote) { worldIn.setBlockState(pos, state, 11); stack.stackSize --; } } } So how would I notify the server of this container?
-
Registering Events and applying them.
Oh I was told that this event didnt exist! So how would I 'subscribe' to the function on an item?
-
Held Block Display
Actually no. How would I call this within the BaseBlock class?
-
Registering Events and applying them.
Hey! So I'm creating an event that adds advanced tooltips, however, I can't really figure out how to register or apply my event to items.. Here is the event: package com.lambda.PlentifulMisc.event; import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.eventhandler.Event; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.RenderGlobal; @SideOnly(Side.CLIENT) public class ItemInfoEvent extends Event { /* * The ItemStack that is having its tooltip */ public final ItemStack itemstack; /* * The player that owns the inventory with the item stack in */ public final EntityPlayer player; /* * The list of tooltips, Add information to this to add info to the tooltip (list.add()) */ public final List list; /* * Whether or not F3+H is active */ public final boolean extrainfo; /* * Whether or not the player is holding shift */ public final boolean shifting; public ItemInfoEvent(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) { this.itemstack = par1ItemStack; this.player = par2EntityPlayer; this.list = par3List; this.extrainfo = par4; this.shifting = GuiScreen.isShiftKeyDown(); } }
-
Creating a crafting handler the exports multiple items
Okay, So I got the hashCode function down, however, why multiply it by 37? This is what the function looks like now: @Override public int hashCode() { return 37*item.getItem().hashCode() + item.getMetadata(); } Finally, the multiGetResult function is still bugging me, I dont know if its right or wrong, but the item still wont smelt.. So should I return smeltmulti.get(stack); or?
-
Creating advanced (Shift + Hover) Tooltips
Hey all! So I want to implement tooltips that appear when you hover over with shift. Is there an inbuilt function or would I have to create a event.
-
Creating a crafting handler the exports multiple items
No, I do, the problem is trying to understand how Minecraft is dealing with how itemstacks are stored. Yes, I have not worked much with Hashmaps/Array storing. However, this is my opportunity to learn HOW these work. You can lock this post if you feel like 'I don't know enough experience' Anyways, So I have just found that there are 2 functions that control the recipes: public Map<ItemStack, List<OutputWrapper>> getMultiList() { return this.multismeltList; } So making the 2nd function changed my entry parameters to both itemstack. However, trying to return multi stacks is still confusing me. @Nullable public ItemStack getMultiResult(ItemStack stack) { for (Entry<ItemStack, ItemStack> entry : this.smeltingList.entrySet()) { if (this.compareItemStacks(stack, entry.getKey())) { multismeltList.get(stack); return stack; } } return null; } Was able to figure out meta data, however this did not change the fact the item won't smelt, my furnace has also been set to the correct recipceResult.
IPS spam blocked by CleanTalk.