Jump to content

sccreeper

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by sccreeper

  1. Got it to work with this code: if(e.player.inventory.hasItemStack(new ItemStack(RegistryHandler.HAZMAT_CHESTPLATE.get()))) { if(e.player.inventory.armorItemInSlot(2).getItem() == RegistryHandler.HAZMAT_CHESTPLATE.get()) { e.player.removeActivePotionEffect(Effects.POISON); e.player.removeActivePotionEffect(Effects.NAUSEA); LOGGER.log(Level.INFO, "I works"); return; } And yes I know I could check for both conditions with the && operator. This post here helped a bit didn't realise armorItemSlot had other methods.
  2. I am trying to make a mechanic where if a player is wearing a full hazmat suit they do not get poisoned. My current way of doing it is this: if((livingEntity.getItemStackFromSlot(EquipmentSlotType.HEAD) == new ItemStack(RegistryHandler.HAZMAT_HELMET.get())) && (livingEntity.getItemStackFromSlot(EquipmentSlotType.CHEST) == new ItemStack(RegistryHandler.HAZMAT_CHESTPLATE.get())) && (livingEntity.getItemStackFromSlot(EquipmentSlotType.LEGS) == new ItemStack(RegistryHandler.HAZMAT_LEGGINGS.get())) && (livingEntity.getItemStackFromSlot(EquipmentSlotType.FEET) == new ItemStack(RegistryHandler.HAZMAT_BOOTS.get()))) { return; } but 1) It isn't working 2) It looks very janky and I don't like it.
  3. I installed 64bit Java and it is working now. Had to do some stuff with runClient in IntelliJ to make sure it was using the 64bit Java install and not the 32bit one but other than that it is now working as intended.
  4. I am trying to allocate more than 1GB of memory to run client through gradle.properties but every time the Xmx arg exceeds 1GB it throws a error saying the JVM can't be initialised. My PC has 8GB of memory with 100mb hardware reserved (So 7.9GB available). I never had a problem with memory when I was working on Ubuntu. I just want to allocate more RAM to runClient without gradle throwing errors.
  5. How do a make a projectile entity, similar to arrows, in 1.15.2. It would be helpful if I knew how to fire it from a custom 'shooter' as well. If anybody is able to help or show me what to do that would be greatly appreciated. sccreeper.
  6. I have found the function to damage a item but am unable to figure out what all the arguments mean and what to put in some of them. My progress so far: event.getPlayer().getHeldItem(event.getHand()).damageItem(1, event.getPlayer(), ???? ); I am unsure what to put for the last argument. Any help will be greatly appreciated, sccreeper.
  7. I Imagine this would be a event subscriber of sorts, but I am unable to find any events in the Forge library which point to something along the lines of OnLivingEntityTick or OnEntityTick.
  8. It's fine, I have managed to get what I intended to work with PlayerInteractEvent instead.
  9. I can't get that to work, IntelliJ keeps on saying that it can't override the superclass method. Do you know how to fix this?
  10. I want to make a item, which when a entity is attacked with it, it gives that entity a potion effect. Any help would be greatly appreciated, Oscar
  11. I have now tried value=Dist.DEDICATED_SERVER and value=Dist.CLIENT and it is still not working, I have also moved the code to a new events package to clean up my file structure.
  12. I have read the documentation but what excactly would I have to put in my @Mod.EventBusSubscriber(modid = WeaponsMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) for it to be logical server side only. I have tried using Dist as a argument e.g @Mod.EventBusSubscriber(modid = WeaponsMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD,dist=) but am not sure what to pass for the dist argument. I have tried Dist.DEDICATED_SERVER but that does not make any sense to me as it seems it is referring to a dedicated server and it also results in a error in my IDE (IntelliJ) saying that it cannot resolve dist.
  13. Okay, but what would I need to add to my code to make it run on the logical server instead of on the client?
  14. How would I go about doing this on the server instead. Would it not execute in singleplayer if it were on the server.
  15. Here is my code so far, I have managed to make it give the potion effects to the entity (the poison effect does not do any damage). My problem is my custom damage sources are not working, they do not do any damage to the player with the item in their inventory. The identifier of the damage source is the same as the in game item, I'm not sure whether that is the problem. All this is inside my main mod class. public static final DamageSource NOVICHOK_DAMAGE = new DamageSource("novichok"); @SubscribeEvent public void onPlayerTick(TickEvent.PlayerTickEvent e) { if (!e.player.world.isRemote) return; if (e.player.inventory.hasItemStack(new ItemStack(RegistryHandler.NOVICHOK_RAW.get()))) { e.player.addPotionEffect(new EffectInstance(Effects.POISON, 1000, 5)); e.player.addPotionEffect(new EffectInstance(Effects.NAUSEA, 1000, 5)); if((e.player.getHealth()-0.05) < 0) { //e.player. e.player.attackEntityFrom(NOVICHOK_DAMAGE, 1.0F); } else { //e.player.playSound(); e.player.attackEntityFrom(NOVICHOK_DAMAGE, 1.0F); } //e.player.setHealth((float) (e.player.getHealth()-0.05)); } else { e.player.removeActivePotionEffect(Effects.POISON); e.player.removeActivePotionEffect(Effects.NAUSEA); } } Any help with this would be greatly appreciated.
×
×
  • Create New...

Important Information

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