Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Big_Bad_E

  1. 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.
  2. I removed it for the git push to make it more clean. It also closes the GUI which is a pretty obvious test statement.
  3. 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.
  4. That was it, I didn't realize datamanager was called multiple times. Thanks for that, now it is all working.
  5. 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.
  6. Thanks for telling me about registerData, that fixed all my problems!
  7. 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:
  8. THATS WHAT DATAMANAGER DOES! Ohh... I'm so stupid. Thanks for telling me that.
  9. 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
  10. 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.
  11. 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).
  12. 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.
  13. 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.
  14. 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.
  15. I am trying to make an entity that is basically a horse, and I want the riding player to be able to jump. Currently I implemented IJumpingMount, and copied the Horse code (modified a bit). Current travel method: @Override public void travel(Vec3d movement) { if (this.isBeingRidden() && !isSitting()) { LivingEntity livingentity = (LivingEntity) this.getPassengers().get(0); this.rotationYaw = livingentity.rotationYaw; this.prevRotationYaw = this.rotationYaw; this.rotationPitch = livingentity.rotationPitch * 0.5F; this.setRotation(this.rotationYaw, this.rotationPitch); this.renderYawOffset = this.rotationYaw; this.rotationYawHead = this.renderYawOffset; float f = livingentity.moveStrafing * 0.5F; float f1 = livingentity.moveForward; if (f1 <= 0.0F) { f1 *= 0.25F; } if (this.jumpPower > 0 && !this.isJumping && onGround) { double d0 = 0.85f * (double) this.jumpPower; double d1; if (this.isPotionActive(Effects.JUMP_BOOST)) { d1 = d0 + (double) ((float) (this.getActivePotionEffect(Effects.JUMP_BOOST).getAmplifier() + 1) * 0.1F); } else { d1 = d0; } Vec3d vec3d = this.getMotion(); this.setMotion(vec3d.x, d1, vec3d.z); this.setJumping(true); this.isAirBorne = true; if (f1 > 0.0F) { float f2 = MathHelper.sin(this.rotationYaw * ((float) Math.PI / 180F)); float f3 = MathHelper.cos(this.rotationYaw * ((float) Math.PI / 180F)); this.setMotion(this.getMotion().add(-0.4F * f2 * this.jumpPower, 0.0D, (0.4F * f3 * this.jumpPower))); this.playSound(SoundEvents.ENTITY_HORSE_JUMP, 0.4F, 1.0F); } this.jumpPower = 0.0F; } this.jumpMovementFactor = this.getAIMoveSpeed() * 0.1F; if (this.canPassengerSteer()) { this.setAIMoveSpeed((float) this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getValue()); super.travel(new Vec3d(f, movement.y, f1)); } else if (livingentity instanceof PlayerEntity) { this.setMotion(Vec3d.ZERO); } if (this.onGround) { this.jumpPower = 0.0F; this.setJumping(false); } this.prevLimbSwingAmount = this.limbSwingAmount; double d2 = this.posX - this.prevPosX; double d3 = this.posZ - this.prevPosZ; float f4 = MathHelper.sqrt(d2 * d2 + d3 * d3) * 4.0F; if (f4 > 1.0F) { f4 = 1.0F; } this.limbSwingAmount += (f4 - this.limbSwingAmount) * 0.4F; this.limbSwing += this.limbSwingAmount; } else { this.jumpMovementFactor = 0.02F; super.travel(movement); } } I know the y motion is set to .85, but the animal is not jumping. They can move around correctly when I press WSAD, but not jump.
  16. Yep, using EVENT_BUS.register() worked. Thanks! Edit: It just didn't call the event. What do I use? I tried @Mod.EventBusSubscriber but no luck. Nevermind, I used @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
  17. It is being cast to a block by Forge, and it is in the block registry somehow? Error line: for(Block block : Registry.BLOCK) { block.getStateContainer().getValidStates().forEach((p_217837_1_) -> { this.func_217843_a(BlockModelShapes.getModelLocation(p_217837_1_)); }); } (From ModelBakery.java) I register an item in the mod too, but no blocks at all.
  18. I am trying to port an old 1.7.10 mod, and realizing how out of date it is, I decided a rewrite would be much better. I am trying to make an entity, for now it has a few simple NBT functions, and a simple method, but nothing else. Whenever I start MC, the game crashes during startup. Registry: @ObjectHolder("battlepets") public class EntityRegistry { public static EntityType<AnimalEntity> PETENTITY; @SubscribeEvent public static void onEntityRegister(RegistryEvent.Register<EntityType<?>> event) { PETENTITY = (EntityType<AnimalEntity>) EntityType.Builder.create(new PetEntityFactory(), EntityClassification.CREATURE).build("pet").setRegistryName("battlepets", "pet"); event.getRegistry().register(PETENTITY); } } Factory: public class PetEntityFactory implements EntityType.IFactory<Entity> { @Override public Entity create(EntityType type, World world) { return new PetEntity(world, PetType.DOG, null); } } Entity (probably not needed): Error:
  19. No no no, definitely not. It was the lack of a Java JDK.
  20. I set it to main FIGURED IT OUT! Intellij decided to set my JDK to none instead of JDK 1.8 for some reason.
  21. When I run genIntellijRuns I get this error: java.lang.NullPointerException at net.minecraftforge.gradle.common.Constants.addXml(Constants.java:297) at net.minecraftforge.gradle.user.UserBasePlugin.injectIntellijRuns(UserBasePlugin.java:1305) at net.minecraftforge.gradle.user.UserBasePlugin$14.execute(UserBasePlugin.java:1213) at net.minecraftforge.gradle.user.UserBasePlugin$14.execute(UserBasePlugin.java:1176) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:621) So I saw a report on the GitHub saying delete .idea files and run gradlew idea genIntellijRuns. Same error, but a client/server configuration are created. It worked for a 1.8.9 project, and I get the run config in this 1.12.2 project, but when I run it I get this error: Error: Could not find or load main class GradleStart gradlew runClient works once but it stops (I am trying to run ThermalDynamics with the files from their github) with an error that there are two jei jars. If I run it again no window opens and I get the "task success" message. If I run genIntellijRuns and idea genIntellijRuns it says task successful without the error. I tried deleting the .gradle and reruning setupDecompWorkspace and genIntellijRuns, this time it made the StartGradle file but Intellij doesn't find it.
  22. Duh, I wasn't thinking about this! Thanks!
  • Create New...

Important Information

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