Posted April 27, 20205 yr Hey all, I'd love to have a Creeper keep track of who ignited it (Flint & Steel), but to do that Im pretty sure I'd have to edit how Creepers work, right? Correct me if Im wrong here ofc, but if there aint any way, how would one exactly edit a mob's class? Edited April 27, 20205 yr by Fuffles
April 27, 20205 yr PlayerInteractEvent#EntityInteract with some clever usage of a capability on the creeper probably would work.
April 27, 20205 yr Author 4 hours ago, ChampionAsh5357 said: PlayerInteractEvent#EntityInteract with some clever usage of a capability on the creeper probably would work. Im attempting that but I can not save who did it. I need to have the 'igniter' during the entity death event. For some reason Im unable to add a NBT tag for this
April 27, 20205 yr 4 hours ago, Fuffles said: For some reason Im unable to add a NBT tag for this Would you happen to be able to show your code? This is a very general statement. You should only need to store the UUID of the player.
April 27, 20205 yr Author 7 hours ago, ChampionAsh5357 said: Would you happen to be able to show your code? This is a very general statement. You should only need to store the UUID of the player. Quote public static void onPlayerInteractEvent(PlayerInteractEvent.EntityInteract interactEvent) { Entity interactee = interactEvent.getTarget(); if (interactee instanceof CreeperEntity) { if (interactEvent.getItemStack().getItem() == Items.FLINT_AND_STEEL) { CompoundNBT nbts = interactee.writeWithoutTypeId(new CompoundNBT()); nbts.putString("id", interactee.getEntityString()); UUID interactor = PlayerEntity.getUUID(interactEvent.getPlayer().getGameProfile()); nbts.putUniqueId("ignitorUUID", interactor); ((CreeperEntity)interactee).readAdditional(nbts); } } } public static void onKillEvent(LivingDeathEvent deathEvent) { Entity srcEnt = deathEvent.getSource().getTrueSource(); if (srcEnt instanceof CreeperEntity) { //check if srcEnt has the tag with a value and then give an advancement to the 'ignitor'; } } Tried with multiple read/write fns but whenever I got the data per cmd I always got nothing Edited April 27, 20205 yr by Fuffles
April 27, 20205 yr 4 hours ago, Fuffles said: CompoundNBT nbts = interactee.writeWithoutTypeId(new CompoundNBT()); nbts.putString("id", interactee.getEntityString()); UUID interactor = PlayerEntity.getUUID(interactEvent.getPlayer().getGameProfile()); nbts.putUniqueId("ignitorUUID", interactor); ((CreeperEntity)interactee).readAdditional(nbts); This is not a capability, the nbt data is only useful when saving or loading a world in this case. What you've done is literally nothing since the data will never be read.
April 28, 20205 yr Author 11 hours ago, ChampionAsh5357 said: This is not a capability, the nbt data is only useful when saving or loading a world in this case. What you've done is literally nothing since the data will never be read. Then how could I store it somehow in the creeper entity?
April 28, 20205 yr Author hit a roadblock IgniterStorage code Quote [...] import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability.IStorage; public class IgniterStorage implements IStorage<IBasic> { @Override public INBT writeNBT(Capability<IBasic> capability, IBasic instance, Direction side) { CompoundNBT nbts = new CompoundNBT(); nbts.putUniqueId("igniter", instance.getUUID()); return nbts; } @Override public void readNBT(Capability<IBasic> capability, IBasic instance, Direction side, INBT nbt) { instance.setUUID(((CompoundNBT)nbt).getUniqueId("igniter")); } }
April 28, 20205 yr Author 10 minutes ago, diesieben07 said: A Class is not an instance of Callable. And if I may ask what do I replace it with exactly?
April 28, 20205 yr Author ... okay, I dont know what I expected as a response besides maybe something useful Edited April 28, 20205 yr by Fuffles
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.