-
[1.14.2] [SOLVED] Button.IPressable not called
Yep Screen#addButton did it. Thanks!
-
[1.14.2] [SOLVED] Button.IPressable not called
No... that’s not how it works. removing a print statement didn’t fix my problem. I will change the method, I’ve been looking at old code that worked without thinking of changes like this.
-
[1.14.2] [SOLVED] Button.IPressable not called
I removed it for the git push to make it more clean. It also closes the GUI which is a pretty obvious test statement.
-
[1.14.2] [SOLVED] Button.IPressable not called
I have a pretty simple GUI, where I add two buttons. Both are added but neither button's IPressable is called when I click the button. The button highlights on hover. Button initialization: buttons.clear(); buttons.add(new Button(guiLeft + 8, guiTop + 39, 48, 20, new TranslationTextComponent("gui.battlepets.pet.skills").getFormattedText(), (button) -> { mc.player.closeScreen(); })); Screen class: https://github.com/BigBadE/BattlePets/blob/master/src/main/java/bigbade/battlepets/client/gui/PetScreen.java I put a print on top of the button press callback, yet nothing is printed.
-
[1.14.2] Spawn entity with data?
That was it, I didn't realize datamanager was called multiple times. Thanks for that, now it is all working.
-
[1.14.2] Spawn entity with data?
Nevermind, data still isn't sync'd. I set the collar color on the server, but the collar color is never sync'd to the client. GitHub: https://github.com/BigBadE/BattlePets How I register the collar color to the datamanager: @Override public void registerData() { super.registerData(); collar = EntityDataManager.createKey(PetEntity.class, DataSerializers.VARINT) dataManager.register(collar, DyeColor.RED.getId()); } I then set it to a different color in the interact (server-side) (I change it to 3) and confirm that it is set server-side (it is), but in my entity renderer (client side) it is still set to red (14). The same thing happens with all other data sent over.
-
[1.14.2] Spawn entity with data?
Thanks for telling me about registerData, that fixed all my problems!
-
[1.14.2] Spawn entity with data?
Okay, so I started using DataManager. Problem is, when the server registers the datamanager values, the datamanagers values aren't sync'd to the client, so the client tries to get values from default datamanagers values (Do I register them client side?) instead of the correct ones set. I tried setting every datamanager to dirty but that changed nothing. I tried to use the Packet SEntityMetadataPacket, but got this error:
-
[1.14.2] Spawn entity with data?
THATS WHAT DATAMANAGER DOES! Ohh... I'm so stupid. Thanks for telling me that.
-
[1.14.2] Spawn entity with data?
Nevermind, it seems that somehow two instances are being created, one on Client one on Server. problem is the Client one doesn't have the data the Server one does. The only solution I can think of is somehow canceling the spawn of the client one, sending a packet over with all the data, and spawning it client side with that. IDK if that works though, or if there is an easier solution. I'm pretty sure the entity is summoned client side on this line: net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); I know the client side entity is spawned with AnimalEntity#init
-
[1.14.2] Spawn entity with data?
You're right, it turns out I forgot to check the side with the first method, cause all the values were set to the default fail safe values.
-
[1.14.2] Spawn entity with data?
It is being called on the server, I use if(!world.isRemote) The entity is being spawned from Item#hitEntity(ItemStack, LivingEntity, LivingEntity). https://github.com/BigBadE/BattlePets/blob/master/src/main/java/bigbade/battlepets/items/ConverterItem.java (Just remembered GitHub exists).
-
[1.14.2] Spawn entity with data?
I am trying to have an item, when right clicked on an entity, spawn my custom entity. Problem is, I need to pass the UUID of the player and the type of entity clicked for rendering/AI. What I tried: MyEntity entity = new MyEntity(); entity.setType(type) entity.setOwner(owner) entity.setPosition(position) world.addEntity(entity) Problem is, that entity is replaced with another one server-side which has no data. Next I tried: CompoundNBT nbt = new CompoundNBT(); nbt.putInt("type", type.ordinal()); nbt.putUniqueId("owner", player.getGameProfile().getId()); if (tameable != null) nbt.putBoolean("sitting", tameable.isSitting()); ITextComponent name = null; if (target.getCustomName() != null) name = target.getCustomName(); PetEntity pet = EntityRegistry.PETENTITY.spawn(target.getEntityWorld(), nbt, null, player, target.getPosition(), SpawnReason.EVENT, false, false); target.remove(); target.getEntityWorld().addEntity(pet); Then I read the NBT data by overriding AnimalEntity#readAdditional(NBTCompound), but that is never called.
-
BlockPos class not found
Try running it without mods, if that works, remove half the mods, if it works put those in another folder and repeat with the other half. Repeat till you find the crashing mod.
-
[1.14.4] Can't make entity jump.
I tried setting d0 to 0 outside of the if, and using super.travel(new Vec3d(f, movement.y+d0, f1)); but still no y movement.
IPS spam blocked by CleanTalk.