Jump to content

xTekBlue

Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by xTekBlue

  1. Oh sorry, do you know a good forum that does before i remove this topic?
  2. Good Afternoon, I have been trying to create a launcher for about 3-5 days now using C#. I have been able to get everything done but the launching. I can authenticate the user with the new auth system and can even pull the information from the auth server. My trouble is when I start to work on "Launching the Client". I named the function "StartMinecraft" for simplicity. I literally copied the entire folder of .minecraft to my own custom folder ".AkumaMC" as a way of testing. I used a batch file to get the default launcher params when launching the client. When I launch/run this function I get no error and the client simply does not open. Does anyone know why this could be? Code: Pictures: UPDATE: I have found that changing the default ".minecraft" folder is causing the problem. Even though i specify that the gamedir is somewhere else, it is still having issues launching the game. Does anyon know a fix to this? Warning, there is a lot of Libs All variables are set up correctly. Quick Note: the path for "-Djava.library.path=", I launched the client, found the temp folder while the game was running and copied the files from the folder it called. I plan on downloading these from my own webserver to players ".AkumaMC" folders so that I will not have to download these files. (If there is a way to get these dll files, please let me know this too <3) Thanks for any help given. Cheers.
  3. Problem solved, i wasn't calling the method on client's. package xtekblue.mod.objects.blocks; import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; import xtekblue.mod.Main; import xtekblue.mod.init.ItemInit; public class SmoothObsidian extends BlockBase { public SmoothObsidian(String name, Material material) { super(name, material); setCreativeTab(Main.xtrablocks); setHardness(50.0F); setHarvestLevel("pickaxe", 3); setResistance(2000.0F); } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(worldIn.isRemote) { return this.DoDropsOB(worldIn, pos, state, playerIn, hand); }else { return this.DoDropsOB(worldIn, pos, state, playerIn, hand); } } private boolean DoDropsOB(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand) { if (player.getHeldItem(hand) != null) { Item item = player.getHeldItem(hand).getItem(); if (item != ItemInit.INGOT_SAW && item != ItemInit.ENCHANTED_SAW) { return false; }else if(item == ItemInit.INGOT_SAW && item.getDamage(player.getHeldItem(hand)) == player.getHeldItem(hand).getMaxDamage()) { player.inventory.deleteStack(player.getHeldItem(hand)); worldIn.destroyBlock(pos, false); player.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 9)); return true; }else if (item == ItemInit.INGOT_SAW && item.getDamage(player.getHeldItem(hand)) != player.getHeldItem(hand).getMaxDamage()) { player.getHeldItem(hand).setItemDamage(player.getHeldItem(hand).getItemDamage() + 1); worldIn.destroyBlock(pos, false); player.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 9)); return true; }else if (item == ItemInit.ENCHANTED_SAW) { worldIn.destroyBlock(pos, false); player.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 9)); return true; } } return true; } } Working code ^^^ Last thing, is there a method i'm missing to allow a item to harvest a block regardless of level or even whether its a tool period? I can not find it.
  4. NEW CODE FOR METHOD private boolean DoDropsOB(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand) { if (player.getHeldItem(hand) != null) { Item item = player.getHeldItem(hand).getItem(); if (item != ItemInit.INGOT_SAW && item != ItemInit.ENCHANTED_SAW) { return false; }else if(item == ItemInit.INGOT_SAW && item.getDamage(player.getHeldItem(hand)) == player.getHeldItem(hand).getMaxDamage()) { player.inventory.deleteStack(player.getHeldItem(hand)); worldIn.destroyBlock(pos, false); player.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 9)); return true; }else if (item == ItemInit.INGOT_SAW && item.getDamage(player.getHeldItem(hand)) != player.getHeldItem(hand).getMaxDamage()) { player.getHeldItem(hand).setItemDamage(player.getHeldItem(hand).getItemDamage() + 1); worldIn.destroyBlock(pos, false); player.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 9)); return true; }else if (item == ItemInit.ENCHANTED_SAW) { worldIn.destroyBlock(pos, false); player.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 9)); return true; } } return true; } The code below still does not seem to work, like it reverts back to normal. worldIn.destroyBlock(pos, false); player.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 9));
  5. Wow, that actually helped a lot! Thanks. so now i can tell that private boolean DoDropsOB(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand) { if(player.getHeldItem(hand) == new ItemStack(ItemInit.INGOT_SAW, 1, OreDictionary.WILDCARD_VALUE)) { worldIn.destroyBlock(pos, false); player.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 2)); return true; }else { return true; } } this method is being called but the "if" statement is being called regardless of having a "INGOT_SAW" in my hand or not, meaning any item will call true on this "if" statement. Any reason why. EDIT: also when i changed the code to private boolean DoDropsOB(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand) { worldIn.destroyBlock(pos, false); player.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 2)); return true; } this, it removed the block, gave me the itemstack but replaced the block. no idea why on that one either. EDIT #2: The itemstack that is being added "OBSIDIAN_INGOT" is also not being put in the inventory, ill be using a video to demonstrate below
  6. How do you know when that breakpoint is hit? If i know this then debugging will be easier to understand.
  7. I mean i get the debugger its just i don't understand where i need to place break points and watch points as such. I also do not know how to read the debugger correctly. The link is fine and will take me sometime to go over it but a video would be clearer than a few screenshots with limited knowledge/text.
  8. Still seems to not work, no idea why its not. i do not understand the debugger at all so i'm going to post it on the github and see if someone can debug it properly or if someones willing to show me a video of how to use it thoroughly then that will also work. https://github.com/EzGunzBlazzinn/XtraItems
  9. debugger shows nothing besides bad checks on chunk loading [22:25:49] [Server thread/WARN] [FML]: XtraItems loaded a new chunk [-38, 18] in dimension 0 (overworld) while populating chunk [-37, 18], causing cascading worldgen lag. [22:25:49] [Server thread/WARN] [FML]: Please report this to the mod's issue tracker. This log can be disabled in the Forge config. EXAMPLE ^^^ I use eclipse btw
  10. The crash had to do with 2 setRegistryName() methods on the same block going to different paths, thats fixed and was not big of a deal. But currently the onBlockActivated is not working how id like it to be and i dont understand why, any idea?
  11. package xtekblue.mod.objects.blocks; import net.minecraft.block.BlockObsidian; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; import xtekblue.mod.init.BlockInit; import xtekblue.mod.init.ItemInit; public class OBA extends BlockObsidian { public OBA(String name){ setUnlocalizedName(name); setRegistryName("minecraft", name); setHardness(50.0F); setResistance(2000.0F); setSoundType(SoundType.STONE); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(playerIn.getHeldItemMainhand() != (new ItemStack(ItemInit.INGOT_SAW, 1, OreDictionary.WILDCARD_VALUE))) { return false; }else if(playerIn.getHeldItemMainhand() != (new ItemStack(ItemInit.ENCHANTED_SAW, 1))) { return false; }else { return this.DoDropsOB(worldIn, pos, state, playerIn); } } private boolean DoDropsOB(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) { if(player.isCreative() && player.getHeldItemMainhand() == new ItemStack(ItemInit.INGOT_SAW, 1, OreDictionary.WILDCARD_VALUE)) { worldIn.destroyBlock(pos, false); player.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 2)); return true; }else if(player.isCreative() && player.getHeldItemMainhand() == new ItemStack(ItemInit.ENCHANTED_SAW, 1)) { worldIn.destroyBlock(pos, false); player.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 2)); return true; }else if(!player.isCreative() && player.getHeldItemMainhand() == new ItemStack(ItemInit.INGOT_SAW, 1, OreDictionary.WILDCARD_VALUE)) { worldIn.destroyBlock(pos, false); if(player.getHeldItemMainhand().getItemDamage() == player.getHeldItemMainhand().getMaxDamage()) { player.inventory.deleteStack(player.getHeldItemMainhand()); }else { player.getHeldItemMainhand().setItemDamage(player.getHeldItemMainhand().getItemDamage() + 1); } player.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 2)); return true; }else if(!player.isCreative() && player.getHeldItemMainhand() == new ItemStack(ItemInit.ENCHANTED_SAW, 1)) { worldIn.destroyBlock(pos, false); player.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 2)); return true; }else { return false; } } } New code and still have no idea why this is not working.
  12. I said that because setRegistryName() i had twice which caused a crash. What is a the boolean onBlockActivated return, true meaning what and false meaning what also when the block is right clicked does it do everything in the method?
  13. @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(playerIn.getHeldItem(hand) == new ItemStack(ItemInit.ENCHANTED_SAW)) { worldIn.destroyBlock(pos, false); playerIn.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 2)); return true; }else if(playerIn.getHeldItem(hand) == new ItemStack(ItemInit.INGOT_SAW, 1, OreDictionary.WILDCARD_VALUE)) { if(playerIn.getHeldItem(hand).getMaxDamage() == playerIn.getHeldItem(hand).getItemDamage()) { playerIn.inventory.deleteStack(playerIn.getHeldItem(hand)); worldIn.destroyBlock(pos, false); playerIn.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 2)); return true; }else { playerIn.getHeldItem(hand).setItemDamage(playerIn.getHeldItem(hand).getItemDamage() + 1); worldIn.destroyBlock(pos, false); playerIn.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 2)); return true; } }else return false; } Also does this not work, that could be the reason i believe its not working, i want the obsidian to break and drop two "Obsidian_ingots" when right clicked with a "ingot_saw", also damage the ingot saw when right clicking with it.
  14. would "setRegistryName("minecraft", name);" not work?
  15. package xtekblue.mod.objects.blocks; import net.minecraft.block.BlockObsidian; import net.minecraft.block.SoundType; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; import xtekblue.mod.init.ItemInit; public class OBA extends BlockObsidian { public OBA(String name){ setUnlocalizedName(name); setRegistryName(name); setHardness(50.0F); setResistance(2000.0F); setSoundType(SoundType.STONE); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(playerIn.getHeldItem(hand) == new ItemStack(ItemInit.ENCHANTED_SAW)) { worldIn.destroyBlock(pos, false); playerIn.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 2)); return true; }else if(playerIn.getHeldItem(hand) == new ItemStack(ItemInit.INGOT_SAW, 1, OreDictionary.WILDCARD_VALUE)) { if(playerIn.getHeldItem(hand).getMaxDamage() == playerIn.getHeldItem(hand).getItemDamage()) { playerIn.inventory.deleteStack(playerIn.getHeldItem(hand)); worldIn.destroyBlock(pos, false); playerIn.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 2)); return true; }else { playerIn.getHeldItem(hand).setItemDamage(playerIn.getHeldItem(hand).getItemDamage() + 1); worldIn.destroyBlock(pos, false); playerIn.addItemStackToInventory(new ItemStack(ItemInit.OBSIDIAN_INGOT, 2)); return true; } }else return false; } } This is my custom class that takes from obsidian and adds onBlockActivated() to the class. package xtekblue.mod.init; import java.util.ArrayList; import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.BlockDirt; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import xtekblue.mod.objects.blocks.BlockBase; import xtekblue.mod.objects.blocks.BlockMud; import xtekblue.mod.objects.blocks.OBA; import xtekblue.mod.objects.blocks.OreBase; import xtekblue.mod.objects.blocks.SmoothObsidian; import xtekblue.mod.objects.blocks.RGBlock; public class BlockInit { public static final List<Block> BLOCKS = new ArrayList<Block>(); //Basic Blocks public static final Block SMOOTH_OBSIDIAN = new SmoothObsidian("smooth_obsidian", Material.ROCK); public static final Block MUD_BRICK = new BlockMud("mud_brick", Material.CLAY, SoundType.STONE); public static final Block REDSTONE_GLOWSTONE = new RGBlock("redstone_glowstone", false); public static final Block REDSTONE_GLOWSTONE_LIT = new RGBlock("redstone_glowstone_lit", true); public static final Block OBSIDIAN = new OBA("obsidian"); //Ore Gen Blocks public static final Block ORE_OVERWORLD = new OreBase("ore_overworld", "overworld"); public static final Block MUD_BLOCK = new BlockMud("mud_block", Material.CLAY, SoundType.GROUND); //public static final Block BLOCK_REDSTONE_GLOWSTONE = new BlockRG("block_redstone_glowstone", false).setCreativeTab(CreativeTabs.REDSTONE); //public static final Block BLOCK_REDSTONE_GLOWSTONE_LIT = new BlockRG("block_redstone_glowstone_lit", true); //public static final Block TROPHY = new BlockTrophy("trophy"); //public static final Block BLOCK_REDSTONE_GLOWSTONE = new BlockBase("block_redstone_glowstone", Material.GLASS); //public static final Block BLOCK_REDSTONE_GLOWSTONE_LIT = new BlockRGLit("block_redstone_glowstone_lit"); } As you can see i have OBSIDIAN registered under that new class i created. My handler should run it like normal but it still seems to do nothing. Im sure im doing something wrong i just cant figure it out still. This is my registry handler. package xtekblue.mod.util.handlers; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.oredict.OreDictionary; import xtekblue.mod.init.BlockInit; import xtekblue.mod.init.ItemInit; import xtekblue.mod.util.IHasModel; import xtekblue.mod.world.gen.WorldGenCustomOres; @EventBusSubscriber public class RegistryHandler { @SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(ItemInit.ITEMS.toArray(new Item[0])); } @SubscribeEvent public static void onBlockRegister(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(BlockInit.BLOCKS.toArray(new Block[0])); } @SubscribeEvent public static void onModelRegister(ModelRegistryEvent event) { for(Item item : ItemInit.ITEMS) { if(item instanceof IHasModel) { ((IHasModel)item).registerModels(); } } for(Block block : BlockInit.BLOCKS) { if(block instanceof IHasModel) { ((IHasModel)block).registerModels(); } } } public static void initRegisteries() { } public static void recipeRegistries() { GameRegistry.addShapelessRecipe(new ResourceLocation("xi:obsidian_ingot"), new ResourceLocation("xi:obsidian_ingot"), new ItemStack(ItemInit.OBSIDIAN_INGOT, 2), new Ingredient[]{Ingredient.fromStacks(new ItemStack(ItemInit.INGOT_SAW, 1, OreDictionary.WILDCARD_VALUE)), Ingredient.fromStacks(new ItemStack(Blocks.OBSIDIAN, 1))}); GameRegistry.addShapelessRecipe(new ResourceLocation("xi:obsidian_ingot2"), new ResourceLocation("xi:obsidian_ingot2"), new ItemStack(ItemInit.OBSIDIAN_INGOT, 2), new Ingredient[]{Ingredient.fromStacks(new ItemStack(ItemInit.ENCHANTED_SAW, 1)), Ingredient.fromStacks(new ItemStack(Blocks.OBSIDIAN, 1))}); GameRegistry.addShapelessRecipe(new ResourceLocation("xi:obsidian_ingot3"), new ResourceLocation("xi:obsidian_ingot3"), new ItemStack(ItemInit.OBSIDIAN_INGOT, 9), new Ingredient[]{Ingredient.fromStacks(new ItemStack(BlockInit.SMOOTH_OBSIDIAN, 1))}); } public static void otherRegistries() { GameRegistry.registerWorldGenerator(new WorldGenCustomOres(), 0); } }
  16. You may have seen me on hear often, i am fairly new to Java and i have been working on a test mod with Minecraft to help self teach me like i have done in the past with other languages. I am trying to add a method to the Obsidian block but i have no idea where to start, i have created a class that has the method inside with a Override and it extends "BlockObsidian". The class on its own obviously does nothing but i don't know either where to run the code or what i need to do to replace the vanilla Obsidian.
  17. Im silly, i should have saw that. Thanks
  18. Bug Demonstration Code of Ore package xtekblue.mod.objects.blocks; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import xtekblue.mod.Main; import xtekblue.mod.init.BlockInit; import xtekblue.mod.init.ItemInit; import xtekblue.mod.objects.blocks.item.ItemBlockVariants; import xtekblue.mod.util.IHasModel; import xtekblue.mod.util.handlers.EnumHandler; import xtekblue.mod.util.handlers.EnumHandler.EnumType; import xtekblue.mod.util.interfaces.IMetaName; public class OreBase extends Block implements IHasModel, IMetaName { public static final PropertyEnum<EnumHandler.EnumType> VARIANT = PropertyEnum.<EnumHandler.EnumType>create("variant", EnumHandler.EnumType.class); private String name, dimension; public OreBase(String name, String dimension) { super(Material.ROCK); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(Main.xtrablocks); setHardness(3); setHarvestLevel("pickaxe", 2); setResistance(15); setDefaultState(this.blockState.getBaseState().withProperty(VARIANT, EnumType.RUBY)); this.name = name; this.dimension = dimension; BlockInit.BLOCKS.add(this); ItemInit.ITEMS.add(new ItemBlockVariants(this).setRegistryName(this.getRegistryName())); } @Override public void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount) { super.dropXpOnBlockBreak(worldIn, pos, 10); } @Override protected ItemStack getSilkTouchDrop(IBlockState state) { return super.getSilkTouchDrop(state); } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { if(getMetaFromState(state) == 0) { return ItemInit.RUBY_GEM; }else if(getMetaFromState(state) == 1){ return ItemInit.SAPPHIRE_GEM; }else { return ItemInit.RUBY_GEM; } } @Override public int quantityDropped(Random random) { return random.nextInt(1) + 1; } @Override public int damageDropped(IBlockState state) { return ((EnumHandler.EnumType)state.getValue(VARIANT)).getMeta(); } @Override public int getMetaFromState(IBlockState state) { return ((EnumHandler.EnumType)state.getValue(VARIANT)).getMeta(); } @Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(VARIANT, EnumHandler.EnumType.byMetadata(meta)); } /*@Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(Item.getItemFromBlock(this), 1, getMetaFromState(world.getBlockState(pos))); }*/ @Override public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) { for(EnumHandler.EnumType variant : EnumHandler.EnumType.values()) { items.add(new ItemStack(this, 1, variant.getMeta())); } } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {VARIANT}); } @Override public String getSpecialName(ItemStack stack) { return EnumHandler.EnumType.values()[stack.getItemDamage()].getName(); } @Override public void registerModels() { for(int i = 0; i < EnumHandler.EnumType.values().length; i++) { Main.proxy.registerVariantRenderer(Item.getItemFromBlock(this), i, "ore_" + this.dimension + "_" + EnumHandler.EnumType.values()[i].getName(), "inventory"); } } } Code of Gems package xtekblue.mod.objects.items; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Item.ToolMaterial; import xtekblue.mod.Main; import xtekblue.mod.init.ItemInit; import xtekblue.mod.tabs.XtraItemsTab; import xtekblue.mod.util.IHasModel; public class ItemBase extends Item implements IHasModel { public ItemBase(String name) { setUnlocalizedName(name); setRegistryName(name); setCreativeTab(Main.xtraitems); ItemInit.ITEMS.add(this); } @Override public void registerModels() { Main.proxy.registerItemRenderer(this, 0, "inventory"); } } Sapphire Model JSON { "parent": "item/generated", "textures": { "layer0": "xi:items/sapphire_gem" } } Additional things to say I also do not believe the EXP is dropping either, unless the amount is too low.
  19. Okay, thanks. You two helped a lot. Mod is turning out great
  20. EDIT I'm just gonna post my crash report here and see if someone can help me solve it. This crash occurs when i use a tool, "SAW" with a durability of "0" in a crafting table to craft another item. It should just remove the item from the crafting table (Like as if it broke) but instead it just crashes. CRASH REPORT ---- Minecraft Crash Report ---- // Hi. I'm Minecraft, and I'm a crashaholic. Time: 4/22/18 5:33 PM Description: Updating screen events java.lang.NullPointerException: Updating screen events at net.minecraftforge.common.ForgeHooks.getContainerItem(ForgeHooks.java:1013) at net.minecraft.item.crafting.ShapelessRecipes.getRemainingItems(ShapelessRecipes.java:57) at net.minecraft.item.crafting.CraftingManager.getRemainingItems(CraftingManager.java:231) at net.minecraft.inventory.SlotCrafting.onTake(SlotCrafting.java:89) at net.minecraft.inventory.Container.slotClick(Container.java:328) at net.minecraft.client.multiplayer.PlayerControllerMP.windowClick(PlayerControllerMP.java:610) at net.minecraft.client.gui.inventory.GuiContainer.handleMouseClick(GuiContainer.java:693) at net.minecraft.client.gui.inventory.GuiCrafting.handleMouseClick(GuiCrafting.java:166) at net.minecraft.client.gui.inventory.GuiContainer.mouseClicked(GuiContainer.java:430) at net.minecraft.client.gui.inventory.GuiCrafting.mouseClicked(GuiCrafting.java:124) at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:611) at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:576) at net.minecraft.client.Minecraft.runTick(Minecraft.java:1884) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1186) at net.minecraft.client.Minecraft.run(Minecraft.java:441) at net.minecraft.client.main.Main.main(Main.java:118) 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 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:25) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at net.minecraftforge.common.ForgeHooks.getContainerItem(ForgeHooks.java:1013) at net.minecraft.item.crafting.ShapelessRecipes.getRemainingItems(ShapelessRecipes.java:57) at net.minecraft.item.crafting.CraftingManager.getRemainingItems(CraftingManager.java:231) at net.minecraft.inventory.SlotCrafting.onTake(SlotCrafting.java:89) at net.minecraft.inventory.Container.slotClick(Container.java:328) at net.minecraft.client.multiplayer.PlayerControllerMP.windowClick(PlayerControllerMP.java:610) at net.minecraft.client.gui.inventory.GuiContainer.handleMouseClick(GuiContainer.java:693) at net.minecraft.client.gui.inventory.GuiCrafting.handleMouseClick(GuiCrafting.java:166) at net.minecraft.client.gui.inventory.GuiContainer.mouseClicked(GuiContainer.java:430) at net.minecraft.client.gui.inventory.GuiCrafting.mouseClicked(GuiCrafting.java:124) at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:611) at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:576) -- Affected screen -- Details: Screen name: net.minecraft.client.gui.inventory.GuiCrafting -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityPlayerSP['Player164'/79, l='MpServer', x=496.65, y=4.00, z=-87.31]] Chunk stats: MultiplayerChunkCache: 552, 552 Level seed: 0 Level generator: ID 01 - flat, ver 0. Features enabled: false Level generator options: Level spawn location: World: (495,4,-96), Chunk: (at 15,0,0 in 30,-6; contains blocks 480,0,-96 to 495,255,-81), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1) Level time: 224277 game time, 224277 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Forced entities: 37 total; [EntityHorse['Horse'/5, l='MpServer', x=426.67, y=4.00, z=-160.83], EntityHorse['Horse'/9, l='MpServer', x=443.89, y=4.00, z=-165.92], EntitySheep['Sheep'/10, l='MpServer', x=434.79, y=4.00, z=-164.24], EntityHorse['Horse'/12, l='MpServer', x=436.16, y=4.00, z=-159.88], EntitySheep['Sheep'/13, l='MpServer', x=434.70, y=4.00, z=-141.83], EntityPig['Pig'/14, l='MpServer', x=436.81, y=4.00, z=-106.77], EntityPig['Pig'/15, l='MpServer', x=444.50, y=4.00, z=-83.49], EntityHorse['Horse'/19, l='MpServer', x=461.12, y=4.00, z=-150.88], EntityPig['Pig'/20, l='MpServer', x=453.38, y=4.00, z=-102.71], EntityPig['Pig'/21, l='MpServer', x=462.46, y=4.00, z=-94.67], EntityChicken['Chicken'/22, l='MpServer', x=452.86, y=4.00, z=-67.28], EntityItem['item.item.egg'/23, l='MpServer', x=460.91, y=4.00, z=-62.86], EntityPlayerSP['Player164'/79, l='MpServer', x=496.65, y=4.00, z=-87.31], EntityChicken['Chicken'/24, l='MpServer', x=450.88, y=4.00, z=-29.36], EntityChicken['Chicken'/25, l='MpServer', x=450.66, y=4.00, z=-32.18], EntityItem['item.item.egg'/26, l='MpServer', x=451.36, y=4.00, z=-29.03], EntityPig['Pig'/27, l='MpServer', x=456.71, y=4.00, z=-12.75], EntityChicken['Chicken'/28, l='MpServer', x=448.24, y=4.00, z=-8.53], EntitySheep['Sheep'/29, l='MpServer', x=465.54, y=4.00, z=-160.71], EntitySheep['Sheep'/30, l='MpServer', x=478.43, y=4.00, z=-163.80], EntityCow['Cow'/31, l='MpServer', x=464.20, y=4.00, z=-65.44], EntityPig['Pig'/32, l='MpServer', x=471.39, y=4.00, z=-65.28], EntityChicken['Chicken'/33, l='MpServer', x=469.55, y=4.00, z=-51.15], EntityItem['item.item.egg'/34, l='MpServer', x=470.46, y=4.00, z=-50.29], EntityPig['Pig'/35, l='MpServer', x=477.69, y=4.00, z=-43.74], EntityChicken['Chicken'/36, l='MpServer', x=474.61, y=4.00, z=-31.22], EntityItem['item.item.egg'/37, l='MpServer', x=468.59, y=4.00, z=-29.29], EntityItem['item.item.egg'/38, l='MpServer', x=473.77, y=4.00, z=-30.32], EntityChicken['Chicken'/44, l='MpServer', x=486.79, y=4.00, z=-47.13], EntityItem['item.item.egg'/45, l='MpServer', x=486.57, y=4.00, z=-47.66], EntitySheep['Sheep'/46, l='MpServer', x=506.75, y=4.00, z=-39.23], EntitySheep['Sheep'/47, l='MpServer', x=510.77, y=4.00, z=-25.84], EntityCow['Cow'/48, l='MpServer', x=517.23, y=4.00, z=-121.53], EntityHorse['Horse'/49, l='MpServer', x=518.97, y=4.00, z=-33.91], EntitySheep['Sheep'/50, l='MpServer', x=514.91, y=4.00, z=-28.99], EntityCow['Cow'/53, l='MpServer', x=534.25, y=4.00, z=-77.84], EntityChicken['Chicken'/58, l='MpServer', x=570.62, y=4.00, z=-26.90]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:461) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2885) at net.minecraft.client.Minecraft.run(Minecraft.java:462) at net.minecraft.client.main.Main.main(Main.java:118) 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 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) at GradleStart.main(GradleStart.java:25) -- System Details -- Details: Minecraft Version: 1.12.2 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_162, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 1808982584 bytes (1725 MB) / 2112618496 bytes (2014 MB) up to 3186360320 bytes (3038 MB) JVM Flags: 3 total; -Xincgc -Xmx3072M -Xms2048M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP 9.42 Powered by Forge 14.23.3.2655 5 mods loaded, 5 mods active States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored | State | ID | Version | Source | Signature | |:--------- |:--------- |:------------ |:-------------------------------- |:--------- | | UCHIJAAAA | minecraft | 1.12.2 | minecraft.jar | None | | UCHIJAAAA | mcp | 9.42 | minecraft.jar | None | | UCHIJAAAA | FML | 8.0.99.99 | forgeSrc-1.12.2-14.23.3.2655.jar | None | | UCHIJAAAA | forge | 14.23.3.2655 | forgeSrc-1.12.2-14.23.3.2655.jar | None | | UCHIJAAAA | xi | 1.0.0 | bin | None | Loaded coremods (and transformers): GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 388.13' Renderer: 'GeForce GT 730/PCIe/SSE2' Launched Version: 1.12.2 LWJGL: 2.9.4 OpenGL: GeForce GT 730/PCIe/SSE2 GL version 4.6.0 NVIDIA 388.13, NVIDIA Corporation GL Caps: Using GL 1.3 multitexturing. Using GL 1.3 texture combiners. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Shaders are available because OpenGL 2.1 is supported. VBOs are available because OpenGL 1.5 is supported. Using VBOs: Yes Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: Current Language: English (US) Profiler Position: N/A (disabled) CPU: 4x AMD FX(tm)-4300 Quad-Core Processor SAW CLASS package xtekblue.mod.objects.items; import java.util.Set; import com.google.common.collect.Sets; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemShears; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xtekblue.mod.Main; import xtekblue.mod.init.ItemInit; import xtekblue.mod.util.IHasModel; public class SawBase extends ItemBase { private ItemStack ITEMSAW = new ItemStack(ItemInit.INGOT_SAW); public SawBase(String name) { super(name); setMaxDamage(4); setCreativeTab(CreativeTabs.TOOLS); setContainerItem(this); } @Override public boolean isDamageable(){ return true; } @Override public boolean hasContainerItem(ItemStack itemStack) { return true; } @Override public ItemStack getContainerItem(ItemStack itemStack) { if(itemStack.getMaxDamage() == itemStack.getItemDamage()) { return (ItemStack) null; } else { ItemStack newItemStack = itemStack.copy(); newItemStack.setItemDamage(itemStack.getItemDamage() + 1); return newItemStack; } } } REGISTRY FUNCTION public static void otherRegistries() { GameRegistry.addShapelessRecipe(new ResourceLocation("xi:obsidian_ingot"), new ResourceLocation("xi:obsidian_ingot"), new ItemStack(ItemInit.OBSIDIAN_INGOT, 2), new Ingredient[]{Ingredient.fromStacks(new ItemStack(ItemInit.INGOT_SAW, 1, OreDictionary.WILDCARD_VALUE)), Ingredient.fromStacks(new ItemStack(Blocks.OBSIDIAN, 1))}); }
  21. Thank you for all the insight you have gave me both Draco and BurpingDog. I just used GameRegistry.addShapelessRecipe(new ResourceLocation("xi:obsidian_ingot"), new ResourceLocation("xi:obsidian_ingot"), new ItemStack(ItemInit.OBSIDIAN_INGOT, 2), new Ingredient[]{Ingredient.fromStacks(new ItemStack(ItemInit.INGOT_SAW, 1, OreDictionary.WILDCARD_VALUE)), Ingredient.fromStacks(new ItemStack(Blocks.OBSIDIAN, 1))}); with resourcelocations that i have seen in a video i watched about GameRegistry xD. I'm sure this is not what u should put as the resourcelocations but eh, it works. now i just have to destroy the item when it has 0 durability and u craft once more.
  22. The problem right now is i cant add a recipe with a item using "OreDictionary.WILDCARD_VALUE" as the damage. The current "GameRegistry.addShapelessRecipe" does not work or i don't understand it at all. It calls for 2 ResourceLocations "Name" and "Group" and i have no idea where those are or what they are.
  23. Okay, i did what u said i believe but in a different way. This makes it work perfectly. But the recipe calls for a full durability item, how do i get around this? package xtekblue.mod.objects.items; import java.util.Set; import com.google.common.collect.Sets; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemShears; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import xtekblue.mod.Main; import xtekblue.mod.init.ItemInit; import xtekblue.mod.util.IHasModel; public class SawBase extends ItemBase { private ItemStack ITEMSAW = new ItemStack(ItemInit.INGOT_SAW); public SawBase(String name) { super(name); setMaxDamage(5); setCreativeTab(CreativeTabs.TOOLS); setContainerItem(this); } @Override public boolean isDamageable(){ return true; } @Override public boolean hasContainerItem(ItemStack itemStack) { return true; } @Override public ItemStack getContainerItem(ItemStack itemStack) { if(itemStack.getMaxDamage() == itemStack.getItemDamage()) { return (ItemStack) null; } else { ItemStack newItemStack = itemStack.copy(); newItemStack.setItemDamage(itemStack.getItemDamage() + 1); return newItemStack; } } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.