Jump to content

Simon_kungen

Members
  • Posts

    151
  • Joined

  • Last visited

Everything posted by Simon_kungen

  1. Ok, made it add the item block to the items list. But I'm still getting the error "Can't use a null-name for the registry": RegistrationHandler.java IntercraftBlocks.java If I register it as a regular item and not as an ItemBlock it complains about me having two objects with the same name.
  2. RegistrationHandler.java IntercraftBlocks.java
  3. Hi How do I register ItemBlocks? I can register the actual block without problems but the item variant throws the error:
  4. Hi I made a topic talking about having a generic item model. I learnt it would be pretty hard to do that so I have met it half-way: Each new item material has its own model file, but the content inside it is identical to one another. I'm making a new post due to the old one became cold and nothing happened and my question has changed somewhat. So here goes: The full idea was to have one superclass which will make an ingot (+ nugget), dust (+ tiny) and plate item when extended: Code: I have been trying for a while to have the item change colour like how Minecraft colour their potion flasks' content. The code I wrote now I expected it would at least change the tint of the item to green, but to no avail: Something I wonder too is how Ore Dictionary now works. The idea was to add the prefix of the item and the type: "ingotCopper", "dustUranium", etc.
  5. Alright, I got it registered without errors. I do still have some question though: If I for example want to apply this to every player, how would I do that? I want one function to happen every tick for each player and then if they have a radioactive item in their inventory should increase it. Uranium.java Interfaces:
  6. Alright, capabilities seem like they are the way to go, but I don't have the faintest idea of how to go about it. Radiation.java The docs don't make it particularly clear how to do it. The code now obviously don't really do anything except for holding a value, but how do I have it applied to the player for example and what does the register part come into all of it? I did watch a video about it from 2017 for version 1.10/ and 11 but I didn't really do anything except for copy-pasting his code and can only assume I did something wrong when it didn't compile. And it doesn't help that Mojang re-structured everything after 1.13. I'm not asking you to do it for me, but explain what it really does. I know capabilities are what most energy systems are such as RedstoneFlux (RF) and TESLA.
  7. Alright, I managed to figure this out. It appeared that I had missed a "{" in the pack.mcmeta file. Strange that it didn't warn me about it. So, umm, issue closed?
  8. Ok. Cool. But the problem is still there with it still not changing the colour. I am expecting it to change the tint to green in this case:
  9. I had the override annotation, but nothing happened with or without it.
  10. Hi I want a "Radiation" mechanic to the game whenever you are exposed to either radioactive materials such as Uranium 235 or close proximity to a radioactive block. I made a Potion Effect called "Radiation Sickness" which changes the player's max health but also prevents natural health regeneration from food. I got the initial effect working and can change the player's max health, but preventing natural regeneration has proved trickier: PotionRadiationSickness.java I do not understand how "setIconIndex()" works either. Setting the different values in the function changes it to vanilla potion effect icons but I have no idea how to add my resource icon to the index. And because this is a negative effect and can potentially kill you it would be good if I can set a custom death message sent to the server. Obviously, this effect is not called "Radiation" but "Radiation Sickness" which going on real life happens when someone is exposed to a high dose of radiation during a short time. You either will feel really bad for a while or, well, you die. My idea was to add a tag called "radiation_exposure" to the player which starts and 0 and if exposed to something radioactive will increase the value. Over time it will slowly vanish, but if it goes beyond a certain threshold will apply Radiation Sickness to the player which will increase in amplifier depending on how long the radiation_exposure value is over the threshold. With this logic, a large number to the value will kill the player if continued exposure or being exposed to a highly radioactive object. I don't know if this is the right approach, but here is a beginning of a class: Radiation.java
  11. Well, that's reassuring... who could I ask in that case? LexManos? And what beginner mistakes have I fallen to? Is it code structure or something else?
  12. Umm, none. Doing it myself with a friend. I just accidentally found all this glitchy-ness when I ran it. He has it the same on his end.
  13. The main thing I wanted to keep common among these items is the texture, I have made separate item models for each new element but all using the main item texture. So the problem I had last time was to use the IItemColor interface which persists still. This is the class right now with how I think you use it: public class ElementBase extends Item implements IItemColor { protected int tint; public ElementBase(String name, String oredict, int tint) { super(new Item.Properties().group(ItemGroup.REDSTONE)); this.tint = tint; setRegistryName(name+"_ingot"); } public int getColor(@Nonnull ItemStack itemStack, int tint) { return return Color.GREEN.getRGB(); } } But I wouldn't ask if I didn't need help. This Github page is what I use in the code but I at least thought this amount of code would do something.
  14. Hmm, ok. Might have to ask around in that case. And thanks for the tip.
  15. Ok, removed @Mod.EventBusSubscriber(modid = Reference.MODID,bus = Mod.EventBusSubscriber.Bus.MOD) from the code. This mod for 1.13.2 doesn't use CommonProxy and ClientProxy classes anymore. But how would I apply multiple items with a single model file?
  16. Hi I asked this question before for 1.12.2 but didn't really understand the answer, and in 1.13.2 I can't get the same thing I managed to do myself in my other 1.12.2 mod. I made a Base class for adding a material item (copper, tin, silver, etc) used for crafting and stuff. Due to the similarities of the items, I feel like there should be a generic way of going from the same model file and then tint it in a different colour similar to how Minecraft can dye Leather Armour. In my 1.12.2 code, I managed to have my items from a list be applied with the same model file but couldn't figure out the colour handler: Here is the code for my base class: The commented out line of code in the base class is an attempt to set it a fixed model file and eventually apply the tint to the texture for that item from the "tint" variable. Usage:
  17. debug.log.tar.gz Here is a link to the repo and the debug.log.tar.gz file.
  18. Alright, umm, this happened. Me and a friend were starting on a mod for 1.13.2. We had just learned how to register items and were about to start to add more complex items. When I saw some lava in a cave which was, umm, water? It didn't flow far at all which gave it away, but then I jumped into it and it became even weirder. The lava was still burning as usual but the fluid physics were gone. I could not float in it and moved through it with no resistance. Other entities behaved the same. Water behaved the same. Here is a video about the weirdness: Trees was something I noticed a bit later. Oak, birch and spruce had some of their logs replaced with leaves, but all tree type's leaves despawned regardless if they were close to a log or not: latest.log
  19. Ok, thanks How would I go about making a packet to send an ItemStack and EntityPlayer to the server? And listen to them. I just read through the Forge Doc about networking and SimpleImpl. Or can I only send Int?
  20. Hi I am making a mod that adds a Bauble that enables a Keybinding to fire a rocket in use with an Elytra to avoid having Fireworks in the hot bar. The item works as expected, but the rocket never stops propelling you forwards. My best guess going on Mojang's code is that it automatically applies a "LifeTime" to the Entity separate from the spawning code. And due to my code not adding it doesn't kill it. My Code (KeyInputHandler.java): @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { if (rocketPouch.KeybindTHRUST.isPressed()) { EntityPlayer player = Minecraft.getMinecraft().player; WorldClient world = Minecraft.getMinecraft().world; if (player.isElytraFlying()) { if (BaublesApi.isBaubleEquipped(player,THRUSTERS) != -1) { ItemStack itemStack = findRockets(player); if (itemStack.equals(ItemStack.EMPTY)) { player.sendMessage(new TextComponentString("§4No Rockets")); return; } if (!player.isCreative()) itemStack.shrink(1); EntityFireworkRocket fireworkRocket = new EntityFireworkRocket(world, itemStack, player); int duration = itemStack.getTagCompound().getCompoundTag("Fireworks").getByte("Flight"); NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("LifeTime",duration); fireworkRocket.readEntityFromNBT(nbt); world.spawnEntity(fireworkRocket); player.playSound(SoundEvents.ENTITY_FIREWORK_LAUNCH, 3.0F, 1.0F); System.out.println(fireworkRocket.getTags()); } else { player.sendMessage(new TextComponentString("§4You need Thrusters to launch")); } } } } Mojang (EntityFireworkRocket.java): public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { if (playerIn.isElytraFlying()) { ItemStack itemstack = playerIn.getHeldItem(handIn); if (!worldIn.isRemote) { EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(worldIn, itemstack, playerIn); worldIn.spawnEntity(entityfireworkrocket); if (!playerIn.capabilities.isCreativeMode) { itemstack.shrink(1); } } return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn)); } else { return new ActionResult<ItemStack>(EnumActionResult.PASS, playerIn.getHeldItem(handIn)); } } I tried to add NBT to the Rocket, but to no avail. I could really need some help with this.
  21. @SubscribeEvent public void itemColorHandlers(ColorHandlerEvent.Item event) { ItemColors colors = event.getItemColors(); } Ok, I added that. Not sure what you meant with register IItemColor to the ItemColors instance. I have my ingot items as metadata to avoid duplicate classes. This is how I have the ingots set up: EnumIngotHandler: public class EnumIngotHandler { public static enum IngotTypes implements IStringSerializable { URANIUM("uranium_ingot",0,"green"), NICKEL("nickel_ingot",1,"yellow"), CHROME("chrome_ingot",2,"green"), SILVER("silver_ingot",3,"green"); private int ID; private String name; private String color; private IngotTypes(String name, int ID, String color) { this.ID = ID; this.name = name; this.color = color; } @Override public String getName() { return this.name; } public int getID() { return ID; } public String getColor() { return color; } @Override public String toString() { return getName(); } } }
×
×
  • Create New...

Important Information

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