Jump to content

DavidQF555

Members
  • Posts

    102
  • Joined

  • Last visited

Everything posted by DavidQF555

  1. I am rendering an entity in 1.16.2, but the texture is getting FileNotFoundExceptions. I added loot tables and lang files but they didn't work either, so I think my resource folder is just not getting recognized. I made sure everything in my java code is correct, such as modid, but I'm not too sure about build.gradle and the other non-java files. Here is my build.gradle: buildscript { repositories { maven { url = 'https://files.minecraftforge.net/maven' } jcenter() mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true } } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' version = '1.16.2-0.9.0.0' group = 'com.david.minecraft.testmod' archivesBaseName = 'testmod' sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { mappings channel: 'snapshot', version: '20200514-1.16' runs { client { workingDirectory project.file('run') property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' property 'forge.logging.console.level', 'debug' mods { testmod { source sourceSets.main } } } server { workingDirectory project.file('run') property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' property 'forge.logging.console.level', 'debug' mods { testmod { source sourceSets.main } } } data { workingDirectory project.file('run') property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' property 'forge.logging.console.level', 'debug' args '--mod', 'testmod', '--all', '--output', file('src/generated/resources/') mods { testmod { source sourceSets.main } } } } } dependencies { minecraft 'net.minecraftforge:forge:1.16.2-33.0.3' } jar { manifest { attributes([ "Specification-Title" : "testmod", "Specification-Vendor" : "david", "Specification-Version" : "1", "Implementation-Title" : project.name, "Implementation-Version" : "${version}", "Implementation-Vendor" : "david", "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } jar.finalizedBy('reobfJar') publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file:///${project.projectDir}/mcmodsrepo" } } } What have I done wrong?
  2. I was able to use data parameters to sync client and server data
  3. How would I retrieve the server side version of Personality for rendering then? Or how would I make it so that I only retrieve the server side version?
  4. I'm confused as to the order that the constructor runs. I set a default value in the constructor and had it randomized to the actual value in the onInitalSpawn method. It keeps on changing back to the default value though. public CustomEntity(World worldIn, int level) { super(RegistryHandler.CUSTOM_ENTITY.get(), worldIn); this.level = level; personality = Personality.NEUTRAL; System.out.println("constructor"); } public ILivingEntityData onInitialSpawn(IWorld worldIn, DifficultyInstance difficultyIn, SpawnReason reason, ILivingEntityData spawnDataIn, CompoundNBT dataTag) { Personality[] personalities = Personality.values(); personality = personalities[(int) (Math.random() * personalities.length)]; } I checked the personality value by printing in livingTick() and also because the entity is rendered with a texture based on personality. In livingTick(), the personality constantly switches between NEUTRAL and another value. The rendered texture is always just the default one.
  5. @Override public void readAdditional(@Nonnull CompoundNBT nbt) { super.readAdditional(nbt); System.out.println("run"); if (nbt.contains("testmod.customentity")) { System.out.println("has nbt"); CompoundNBT reg = (CompoundNBT) nbt.get("testmod.customentity"); personality = Personality.get(reg.getString("personality")); level = nbt.getInt("level"); } } @Override public void writeAdditional(@Nonnull CompoundNBT nbt) { super.writeAdditional(nbt); CompoundNBT reg = new CompoundNBT(); reg.putString("personality", personality.name()); reg.putInt("level", level); nbt.put("testmod.customentity", reg); } It seems like some of my fields were just left as null because the nbt apparently doesn't have "testmod.customentity". Did I do something wrong? "has nbt" does not appear, but "run" does.
  6. for reading and writing NBT for entities, do you use the read/write additional methods?
  7. Someone told me that the constructor runs every time an entity spawns, so I should use onInitialSpawn for 1 time events. So if I did list = new ArrayList<>() in the construtor, wouldn't it just reset every time an entity spawns? Is that not how the constructor runs?
  8. I was told that the onInitialSpawn() method was for one time initializing for things like armor, but I also thought that was a good place to initialize many lists and maps that are my own fields for my own custom entity. However, I'm getting loads of nullpointerexceptions because apparently it initializes the fields after ticks and goals are run. I don't want to put it in the constructor because then the lists will be constantly cleared. Is there a way to initialize them once before the ticks and goals run? I really don't want to put null checkers in every tick method.
  9. public class ProjRenderer extends EntityRenderer<ProjEntity> implements IEntityRenderer<ProjEntity, ProjModel<ProjEntity>> { protected static final ResourceLocation TEXTURE = new ResourceLocation(Test.MOD_ID, "textures/entity/proj_entity.png"); public static final ProjModel<ProjEntity> MODEL = new ProjModel<>(); public ProjRenderer(EntityRendererManager renderManagerIn) { super(renderManagerIn); } @Nonnull @Override public ProjModel<ProjEntity> getEntityModel() { return MODEL; } @Nonnull @Override public ResourceLocation getEntityTexture(@Nonnull ProjEntity entity) { return TEXTURE; } } public class ProjModel<T extends ProjEntity> extends EntityModel<T> { private final ModelRenderer proj; public ShinsuModel() { textureWidth = 64; textureHeight = 64; proj = new ModelRenderer(this); proj.setRotationPoint(0.0F, 16.0F, 0.0F); proj.setTextureOffset(0, 0).addBox(-8.0F, -8.0F, -8.0F, 16.0F, 16.0F, 16.0F, 0.0F, false); } @Override public void setRotationAngles(@Nonnull T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { proj.rotateAngleX = headPitch * ((float) Math.PI / 180f); proj.rotateAngleY = netHeadYaw * ((float) Math.PI / 180f); } @Override public void render(@Nonnull MatrixStack matrixStackIn, @Nonnull IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) { proj.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn); } } @SubscribeEvent public static void onClientSetup(FMLClientSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(RegistryHandler.PROJ_ENTITY.get(), ProjRenderer::new); } ProjEntity is an instance of DamagingProjectileEntity. For some reason it just appears as an invisible hitbox that is on fire. I'm sure the texture is 64x64 and is at the correct location. What is wrong?
  10. I figured out that the AI Speed in CustomEntity is changing to speed multiplier * attribute, but the speed in moveController was staying to exactly the speed multiplier, but the actual speed moving doesn't change
  11. private class FollowOwnerGoal extends Goal { private static final double DISTANCE = 5; private FollowOwnerGoal() { setMutexFlags(EnumSet.of(Goal.Flag.MOVE)); } @Override public boolean shouldExecute() { Entity owner = getOwner(); if (owner == null) { return false; } else if (owner.isSpectator()) { return false; } else return !(getDistanceSq(owner) < DISTANCE * DISTANCE); } /** * Returns whether an in-progress EntityAIBase should continue executing */ public boolean shouldContinueExecuting() { if (getNavigator().noPath() || getOwner() == null) { return false; } else { return !(getDistanceSq(getOwner()) <= DISTANCE * DISTANCE); } } /** * Reset the task's internal state. Called when this task is interrupted by another one */ public void resetTask() { getNavigator().clearPath(); LOGGER.info("Reset"); } /** * Keep ticking a continuous task that has already been started */ public void tick() { if(getOwner() != null) { getLookController().setLookPositionWithEntity(getOwner(), 10.0F, getVerticalFaceSpeed()); if (!getLeashed() && !isPassenger()) { LOGGER.info("controller: " + moveController.getSpeed() + " AI: " + getAIMoveSpeed()); getNavigator().tryMoveToEntityLiving(getOwner(), 100); } } } } I've basically copied the Tameable version now. Is it normal for the "reset" to be called every 5 ticks? The other logger message is completely normal
  12. It doesn't really matter though. It currently only has 1 goal and that goal really only needs to run the starting code
  13. private class FollowOwnerGoal extends Goal { private static final int DISTANCE = 5; private FollowOwnerGoal() { setMutexFlags(EnumSet.of(Goal.Flag.MOVE)); } @Override public boolean shouldExecute() { return getNavigator().noPath() && getOwner() != null && getDistanceSq(getOwner()) > DISTANCE * DISTANCE; } @Override public boolean shouldContinueExecuting() { return false; } @Override public void startExecuting() { super.startExecuting(); getNavigator().tryMoveToXYZ(getOwner().getPosX(), getOwner().getPosYEye(), getOwner().getPosZ(), 100); } } I really simplified mine. Your code has a lot more factors, but I just need it to move, so this should work, but it doesn't consider the speed at all
  14. I checked it, it basically does the same thing except check more conditions like whether sitting or not. I updated my code to: private class FollowOwnerGoal extends Goal { private static final int DISTANCE = 5; private static final int COOLDOWN = 200; private int cooldown; private FollowOwnerGoal() { setMutexFlags(EnumSet.of(Goal.Flag.MOVE)); cooldown = 0; } @Override public boolean shouldExecute() { return getOwner() != null && getDistanceSq(getOwner()) > DISTANCE * DISTANCE; } @Override public boolean shouldContinueExecuting() { return shouldExecute() && !getNavigator().noPath(); } @Override public void resetTask() { cooldown = 0; getNavigator().clearPath(); } @Override public void tick() { cooldown = Math.max(0, cooldown - 1); if(cooldown == 0) { getNavigator().tryMoveToXYZ(getOwner().getPosX(), getOwner().getPosYEye(), getOwner().getPosZ(), 100.0D); cooldown = COOLDOWN; } } } To attempt to replicate the Tameable one, but it still has the same effect. I think it has something to do with either switching to FlyingMovementController or FlyingPathNavigator, but I cannot figure out what the problem is.
  15. Let me just post the code of all the classes that have some relevance: ublic class CustomEntity extends FlyingEntity { private LivingEntity owner; public CustomEntity(EntityType<? extends FlyingEntity> type, World worldIn, LivingEntity owner) { super(type, worldIn); moveController = new FlyingMovementController(this, 60, true); this.owner = owner; } public LivingEntity getOwner(){ return owner; } public static AttributeModifierMap.MutableAttribute setAttributes(){ return MobEntity.func_233666_p_() .func_233815_a_(Attributes.field_233822_e_, (double) 5.0f) .func_233815_a_(Attributes.field_233821_d_, (double) 5.0f) .func_233815_a_(Attributes.field_233818_a_, 10); } @Override public void registerGoals() { super.registerGoals(); goalSelector.addGoal(0, new FollowOwnerGoal()); goalSelector.addGoal(1, new LookAtGoal(this, PlayerEntity.class, 5)); } @Override protected PathNavigator createNavigator(World worldIn) { return new FlyingPathNavigator(this, worldIn); } private class FollowOwnerGoal extends Goal { private static final int DISTANCE = 5; private FollowOwnerGoal() { setMutexFlags(EnumSet.of(Goal.Flag.MOVE)); } @Override public boolean shouldExecute() { return getOwner() != null && getDistanceSq(getOwner()) > DISTANCE * DISTANCE; } @Override public boolean shouldContinueExecuting() { return shouldExecute() && !getNavigator().noPath(); } @Override public void tick() { getNavigator().tryMoveToXYZ(getOwner().getPosX(), getOwner().getPosYEye(), getOwner().getPosZ(), 1); } } } @SuppressWarnings("deprecation") @Mod("testmod") public class TestMod { public static final String MOD_ID = "testmod"; public static final ItemGroup TAB = new ItemGroup("testmod") { @Override public ItemStack createIcon() { return new ItemStack(RegistryHandler.RUBY.get()); } }; public TestMod() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); RegistryHandler.init(); MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { DeferredWorkQueue.runLater(() -> { GlobalEntityTypeAttributes.put(RegistryHandler.CUSTOM_ENTITY.get(), CustomEntity.setAttributes().func_233813_a_()); }); } private void doClientStuff(final FMLClientSetupEvent event) {} } public class RegistryHandler { public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, TestMod.MOD_ID); public static final RegistryObject<EntityType<CustomEntity>> CUSTOM_ENTITY = ENTITY_TYPES.register("custom_entity", () -> EntityType.Builder.create(new CustomFactory(), EntityClassification.AMBIENT).size(0.9f, 0.9f).build(new ResourceLocation(TestMod.MOD_ID, "custom_entity").toString())); public static void init() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); ENTITY_TYPES.register(bus); } public class CustomFactory implements EntityType.IFactory<CustomEntity> { @Override public CustomEntity create(EntityType<CustomEntity> type, World world) { return new CustomEntity(type, world, null); } } public class CustomItem extends BasicItem { @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { Vector3d spawn = playerIn.getEyePosition(1).add(playerIn.getLookVec().mul(2, 2, 2)); CustomEntity light = new CustomEntity(RegistryHandler.CUSTOM_ENTITY.get(), worldIn, playerIn); if(light.canSpawn(worldIn, SpawnReason.MOB_SUMMONED)) { light.setPosition(spawn.x, spawn.y, spawn.z); worldIn.addEntity(light); ItemStack item = playerIn.getHeldItem(handIn); item.setCount(item.getCount() - 1); playerIn.setHeldItem(handIn, item); } return ActionResult.resultPass(playerIn.getHeldItem(handIn)); } }
  16. The setAttributes method is in the code I sent, in the Main class. I know it works because FlyingPathNavigator does not even work without a flying speed. Also, its health is actually 10.
  17. I changed it to 2.0D and nothing has really changed. Using livingTick() to print out speed, it constantly switches between the number I set in the tryMoveToXYZ() and 0. It just ignores my attribute, and the speed printed is also not really applied to how fast the actual entity is. I put in 100.0D and nothing changed.
  18. public class CustomEntity extends FlyingEntity { public CustomEntity(EntityType<? extends FlyingEntity> type, World worldIn) { super(type, worldIn); moveController = new FlyingMovementController(this, 60, true); } public static AttributeModifierMap.MutableAttribute setAttributes(){ return MobEntity.func_233666_p_() .func_233815_a_(Attributes.field_233822_e_, (double) 5.0f) .func_233815_a_(Attributes.field_233821_d_, (double) 5.0f) .func_233815_a_(Attributes.field_233818_a_, 10); } @Override public void registerGoals() { super.registerGoals(); goalSelector.addGoal(0, new FollowOwnerGoal()); goalSelector.addGoal(1, new LookAtGoal(this, PlayerEntity.class, 5)); } @Override protected PathNavigator createNavigator(World worldIn) { return new FlyingPathNavigator(this, worldIn); } private class FollowOwnerGoal extends Goal { private static final int DISTANCE = 5; private FollowOwnerGoal() { setMutexFlags(EnumSet.of(Goal.Flag.MOVE)); } @Override public boolean shouldExecute() { return getOwner() != null && getDistanceSq(getOwner()) > DISTANCE * DISTANCE; } @Override public boolean shouldContinueExecuting() { return shouldExecute() && !getNavigator().noPath(); } @Override public void tick() { getNavigator().tryMoveToXYZ(getOwner().getPosX(), getOwner().getPosYEye(), getOwner().getPosZ(), 1); } } } private void setup(final FMLCommonSetupEvent event) { DeferredWorkQueue.runLater(() -> { GlobalEntityTypeAttributes.put(RegistryHandler.CUSTOM_ENTITY.get(), CustomEntity.setAttributes().func_233813_a_()); }); } This should be all the relevant code. Basically, no matter what the speed attribute of my entity is, it is always insanely slow. I thought it might have to do with the FlyingPathNavigator and MovementController's just not using the right speed, but I also changed the generic movement speed attribute and nothing changed. I feel like I probably needed to override another method or something. What have I done wrong?
  19. I was able to solve it, for some reason I just solve these problems like an hour after posting
  20. I looked at someone else's code, and was able to kind of figure it out, but I'm getting IndexOutOfBound Exceptions. public static class Factory implements IContainerFactory<CustomContainer> { @Override public CustomContainer create(int windowId, PlayerInventory playerInv, PacketBuffer extraData) { return new CustomContainer(windowId, getEntityFromBuf(extraData)); } private CustomEntity getEntityFromBuf(PacketBuffer buf) { if (buf == null) { return null; } return DistExecutor.unsafeCallWhenOn(Dist.CLIENT, () -> () -> { Entity entity = Minecraft.getInstance().world.getEntityByID(buf.readVarInt()); if (entity instanceof CustomEntity) { return (CustomEntity) entity; } return null; }); } } In case this is needed: public CustomContainer(int id, CustomEntity en) { super(RegistryHandler.Custom_CONTAINER.get(), id); this.en = en; } And this is the stack trace [m[1;31m[20:13:06] [Render thread/FATAL] [minecraft/ThreadTaskExecutor]: Error executing task on Client java.lang.RuntimeException: java.lang.IndexOutOfBoundsException at net.minecraftforge.fml.DistExecutor.unsafeCallWhenOn(DistExecutor.java:76) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at com.david.test.entities.CustomEntity$CustomContainer$Factory.getEntityFromBuf(CustomEntity.java:212) ~[main/:?] {re:classloading} at com.david.test.entities.CustomEntity$CustomContainer$Factory.create(CustomEntity.java:205) ~[main/:?] {re:classloading} at com.david.test.entities.CustomEntity$CustomContainer$Factory.create(CustomEntity.java:1) ~[main/:?] {re:classloading} at net.minecraft.inventory.container.ContainerType.create(ContainerType.java:53) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraftforge.fml.network.FMLPlayMessages$OpenContainer.lambda$handle$0(FMLPlayMessages.java:285) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at java.util.Optional.ifPresent(Optional.java:183) ~[?:?] {} at net.minecraftforge.fml.network.FMLPlayMessages$OpenContainer.lambda$handle$1(FMLPlayMessages.java:284) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.network.NetworkEvent$Context.enqueueWork(NetworkEvent.java:215) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.network.FMLPlayMessages$OpenContainer.handle(FMLPlayMessages.java:282) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.network.simple.IndexedMessageCodec.lambda$tryDecode$3(IndexedMessageCodec.java:128) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at java.util.Optional.ifPresent(Optional.java:183) ~[?:?] {} at net.minecraftforge.fml.network.simple.IndexedMessageCodec.tryDecode(IndexedMessageCodec.java:128) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.network.simple.IndexedMessageCodec.consume(IndexedMessageCodec.java:162) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.network.simple.SimpleChannel.networkEventListener(SimpleChannel.java:80) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) ~[eventbus-2.2.0-service.jar:?] {} at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) ~[eventbus-2.2.0-service.jar:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.2.0-service.jar:?] {} at net.minecraftforge.fml.network.NetworkInstance.dispatch(NetworkInstance.java:84) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at net.minecraftforge.fml.network.NetworkHooks.lambda$onCustomPayload$1(NetworkHooks.java:73) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at java.util.Optional.map(Optional.java:265) ~[?:?] {} at net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(NetworkHooks.java:73) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at net.minecraft.client.network.play.ClientPlayNetHandler.handleCustomPayload(ClientPlayNetHandler.java:2076) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.network.play.server.SCustomPayloadPlayPacket.processPacket(SCustomPayloadPlayPacket.java:68) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at net.minecraft.network.play.server.SCustomPayloadPlayPacket.processPacket(SCustomPayloadPlayPacket.java:11) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:139) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:109) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.ThreadTaskExecutor.drainTasks(ThreadTaskExecutor.java:97) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:959) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:587) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {} at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.1.2.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.1.2.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.1.2.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.1.2.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.1.2.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {} Caused by: java.lang.IndexOutOfBoundsException at io.netty.buffer.EmptyByteBuf.readByte(EmptyByteBuf.java:531) ~[netty-all-4.1.25.Final.jar:4.1.25.Final] {} at net.minecraft.network.PacketBuffer.readByte(PacketBuffer.java:790) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at net.minecraft.network.PacketBuffer.readVarInt(PacketBuffer.java:213) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} at com.david.test.entities.CustomEntity$CustomContainer$Factory.lambda$1(CustomEntity.java:213) ~[main/:?] {re:classloading} at net.minecraftforge.fml.DistExecutor.unsafeCallWhenOn(DistExecutor.java:72) ~[forge-1.16.1-32.0.75_mapped_snapshot_20200514-1.16-recomp.jar:?] {re:classloading} ... 43 more I'm assuming its a problem with the method getting the CustomEntity from a PacketBuffer, but I have no idea what the problem is.
  21. Yeah, I figured it out. Just need to register my container and I'm done
  22. Ah turns out that the inventory problem is just because I made it so you had to be sneaking, which is not allowed. I the Inventory class does not override openInventory(), and the openInventory() method is just empty. How would I actually open an inventory?
  23. I'm making an entity that I am trying to make rideable, but I haven't been able to ride it. I overrode the applyPlayerInteraction method for my entity and added: player.sendMessage(new StringTextComponent("ride"), player.getUniqueID()); player.startRiding(this); but the message gets sent and you don't ride the entity. What have I done wrong? Same with player.sendMessage(new StringTextComponent("open"), player.getUniqueID()); getInventory().openInventory(player); in the same method
  24. Solved, you have to change the moveController to FlyingMovementController
  25. I am creating a flying Custom Entity whom will follow an owner, but it doesn't seem to want to move up ever. This is the entity class and goal class: public class CustomEntity extends FlyingEntity { private LivingEntity owner; public CustomEntity(EntityType<? extends FlyingEntity> type, World worldIn, LivingEntity owner) { super(type, worldIn); this.owner = owner; this.navigator = new FlyingPathNavigator(this, worldIn); } @Override public void registerGoals() { super.registerGoals(); goalSelector.addGoal(0, new FollowOwnerGoal()); } private class FollowOwnerGoal extends Goal { private static final int DISTANCE = 5; public FollowOwnerGoal() { this.setMutexFlags(EnumSet.of(Goal.Flag.MOVE)); } @Override public boolean shouldExecute() { return CustomEntity.this.owner != null && CustomEntity.this.getDistanceSq(CustomEntity.this.owner) > DISTANCE * DISTANCE; } @Override public boolean shouldContinueExecuting() { return !CustomEntity.this.getNavigator().noPath() && CustomEntity.this.getDistanceSq(CustomEntity.this.owner) > DISTANCE * DISTANCE; } @Override public void resetTask() { CustomEntity.this.getNavigator().clearPath(); } @Override public void tick() { super.tick(); LivingEntity owner = CustomEntity.this.owner; CustomEntity.this.getNavigator().tryMoveToEntityLiving(owner, 5); } } } I thought that just making the navigator a FlyingPathNavigator would work, but it doesn't move upward for navigation. Is there a way to solve this or do I need to write a navigator myself?
×
×
  • Create New...

Important Information

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