Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

henzo800's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. Thanks for your quick reply spiritfilled. However, I'm still not sure how to load an OBJ model. My entity seems to be rendering Minecraft's included models just fine but I want to load an OBJ and MTL stored in the resources. Is there some way to convert an OBJ to parts. Although shouldn't I use the loader outlined in the forge doc's. Here is my renderer and model so far. public class CarEntityRender extends MobRenderer<CarEntity, CarModel> { public CarEntityRender(EntityRendererManager renderManagerIn) { super(renderManagerIn, new CarModel(), 1.0F); } @Override public ResourceLocation getTextureLocation(CarEntity p_110775_1_) { return new ResourceLocation(STAR.MODID, "textures/entity/red_rack.png"); } } public class CarModel extends EntityModel<CarEntity>{ @Override public void setupAnim(CarEntity p_225597_1_, float p_225597_2_, float p_225597_3_, float p_225597_4_, float p_225597_5_, float p_225597_6_) { } @Override public void renderToBuffer(MatrixStack p_225598_1_, IVertexBuilder p_225598_2_, int p_225598_3_, int p_225598_4_, float p_225598_5_, float p_225598_6_, float p_225598_7_, float p_225598_8_) { } } Any help would be appreciated.
  2. Hi all, I am trying to create a custom model for my entity. I am trying to load an obj model. I know I need to use the OBJLoader class during model registration but I cant seem to find a consistent way to do this as it seems to vary between entity types. So far I have a class extending the EntityModel and my entity as a generic. I assume this can then be put into a mob renderer but, again I'm not sure and I just seem to be getting lots of errors. I'm using the latest stable release 36.1.0. Any help would be greatly appreciated.
  3. Too easy, here's the the code if anyone needs it. @Override public IPacket<?> getAddEntityPacket() { return NetworkHooks.getEntitySpawningPacket(this); } EDIT: Fixed as per diesieben07's reply
  4. Hi, I'm trying to create an entity based of a minecart but the entity appears to be invisible and unable to be interacted with. I'm not seeing any errors in the debug log. I have included my entity and renderer. I have not added any attributes to this entity as I don't think there is any way to add them to minecarts. I added a message during ticks that appears when its alive but the minecart itself does not. public class TrainEntity extends AbstractMinecartEntity { public TrainEntity(EntityType<?> p_i50126_1_, World p_i50126_2_) { super(p_i50126_1_, p_i50126_2_); } public TrainEntity(World p_i1723_1_, double p_i1723_2_, double p_i1723_4_, double p_i1723_6_) { super(EntityRegister.TRAINENTITY.get(), p_i1723_1_, p_i1723_2_, p_i1723_4_, p_i1723_6_); } public static final String REG = "train_entity"; @Override public Type getMinecartType() { return AbstractMinecartEntity.Type.RIDEABLE; } public ActionResultType interact(PlayerEntity p_184230_1_, Hand p_184230_2_) { ActionResultType ret = super.interact(p_184230_1_, p_184230_2_); if (ret.consumesAction()) return ret; if (p_184230_1_.isSecondaryUseActive()) { return ActionResultType.PASS; } else if (this.isVehicle()) { return ActionResultType.PASS; } else if (!this.level.isClientSide) { return p_184230_1_.startRiding(this) ? ActionResultType.CONSUME : ActionResultType.PASS; } else { return ActionResultType.SUCCESS; } } @Override public void tick() { super.tick(); STAR.LOGGER.debug("STAR - Training Hard"); } public class TrainEntityRender<T extends TrainEntity> extends EntityRenderer<T> { protected final EntityModel<T> model = new CreeperModel<>(); public TrainEntityRender(EntityRendererManager p_i46155_1_) { super(p_i46155_1_); this.shadowRadius = 0.7F; } @Override public ResourceLocation getTextureLocation(TrainEntity p_110775_1_) { return new ResourceLocation(STAR.MODID, "textures/entity/purple_thing.png"); } @Override public void render(T p_225623_1_, float p_225623_2_, float p_225623_3_, MatrixStack p_225623_4_, IRenderTypeBuffer p_225623_5_, int p_225623_6_) { super.render(p_225623_1_, p_225623_2_, p_225623_3_, p_225623_4_, p_225623_5_, p_225623_6_); //Bunch of other stuff copied from the MinecartRenderer p_225623_4_.scale(-1.0F, -1.0F, 1.0F); this.model.setupAnim(p_225623_1_, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F); IVertexBuilder ivertexbuilder = p_225623_5_.getBuffer(this.model.renderType(this.getTextureLocation(p_225623_1_))); this.model.renderToBuffer(p_225623_4_, ivertexbuilder, p_225623_6_, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); p_225623_4_.popPose(); STAR.LOGGER.debug("STAR - RENDER"); } protected void renderMinecartContents(T p_225630_1_, float p_225630_2_, BlockState p_225630_3_, MatrixStack p_225630_4_, IRenderTypeBuffer p_225630_5_, int p_225630_6_) { Minecraft.getInstance().getBlockRenderer().renderSingleBlock(p_225630_3_, p_225630_4_, p_225630_5_, p_225630_6_, OverlayTexture.NO_OVERLAY); } } Event Register: @SubscribeEvent public static void onClientSetupEvent(FMLClientSetupEvent event) { LOGGER.info("STAR - Client Setup"); //Other renderers RenderingRegistry.registerEntityRenderingHandler(EntityRegister.TRAINENTITY.get(), TrainEntityRender::new); } Any help would be greatly appreciated.
  5. I used diesieben07 suggestion and got it all working. I have included my completed entity for anyone who needs it. Entity Class: public class TestEntity extends CowEntity { public static final String REG = "simple_entity"; public TestEntity(EntityType<? extends CowEntity> p_i48567_1_, World p_i48567_2_) { super(p_i48567_1_, p_i48567_2_); STAR.LOGGER.debug("STAR - Entity Constructed"); } public static AttributeModifierMap.MutableAttribute createAttributes() { return MobEntity.createMobAttributes().add(Attributes.MAX_HEALTH, 0.5D) .add(Attributes.MOVEMENT_SPEED, (double)0.2F) .add(Attributes.FOLLOW_RANGE, 20.0) .add(Attributes.ATTACK_DAMAGE, 20.0); } @Override protected void registerGoals() { STAR.LOGGER.debug("STAR - Entity Goals"); this.goalSelector.addGoal(0, new TemptGoal(this, 1.25D, Ingredient.of(Items.WHEAT), false)); } } Entity register: public class EntityRegister { public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, STAR.MODID); public static final RegistryObject<EntityType<TestEntity>> TESTENTITY = ENTITIES.register(TestEntity.REG, () -> EntityType.Builder.<TestEntity>of(TestEntity::new, EntityClassification.MISC) .sized(0.98F, 0.7F) .clientTrackingRange(8) .build(TestEntity.REG)); } Thanks for all your help.
  6. Ha, lol, I got confused between galloping and sprinting. Turns out horses gallop not sprint. Anyway I just override the gallop method instead and it works a treat. Thanks for your help
  7. Ok, so I have created my modifier like so, private static final UUID CAR_SPEED_MODIFIER_SPRINTING_UUID = UUID.fromString("889db856-9d63-45c8-8f9a-b9ac68b509a3"); private static final AttributeModifier CAR_SPEED_MODIFIER_SPRINTING = new AttributeModifier(CAR_SPEED_MODIFIER_SPRINTING_UUID, "Sprinting speed boost", 5.0D , AttributeModifier.Operation.MULTIPLY_TOTAL); //constructors and whatnot @Override //overriding net.minecraft.entity.LivingEntity.setSprinting public void setSprinting(boolean p_70031_1_) { this.setSharedFlag(3, p_70031_1_); ModifiableAttributeInstance modifiableattributeinstance = this.getAttribute(Attributes.MOVEMENT_SPEED); if (modifiableattributeinstance.getModifier(CAR_SPEED_MODIFIER_SPRINTING_UUID) != null) { modifiableattributeinstance.removeModifier(CAR_SPEED_MODIFIER_SPRINTING); STAR.LOGGER.debug("Sprint overr c1:" + CAR_SPEED_MODIFIER_SPRINTING_UUID); } if (p_70031_1_) { modifiableattributeinstance.addTransientModifier(CAR_SPEED_MODIFIER_SPRINTING); STAR.LOGGER.debug("Sprint overr c2:" + CAR_SPEED_MODIFIER_SPRINTING_UUID); } } But the override method still does not seem to be running at all. Is there an event or something I need to use.
  8. Hi, I'm trying to change the sprinting modifier for an entity extended from a HorseEntity. I have tried overriding the setSprinting method from LivingEntity like so. private static final UUID SPEED_MODIFIER_SPRINTING_UUID = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); private static final AttributeModifier SPEED_MODIFIER_SPRINTING = new AttributeModifier(SPEED_MODIFIER_SPRINTING_UUID, "Sprinting speed boost", 5.0D , AttributeModifier.Operation.MULTIPLY_TOTAL); @Override public void setSprinting(boolean p_70031_1_) { this.setSharedFlag(3, p_70031_1_); ModifiableAttributeInstance modifiableattributeinstance = this.getAttribute(Attributes.MOVEMENT_SPEED); if (modifiableattributeinstance.getModifier(SPEED_MODIFIER_SPRINTING_UUID) != null) { modifiableattributeinstance.removeModifier(SPEED_MODIFIER_SPRINTING); } if (p_70031_1_) { modifiableattributeinstance.addTransientModifier(SPEED_MODIFIER_SPRINTING); } } But the method does not seem to be run when sprinting. The only other way I can think to do this is using an access transformer to make the modifier public. Any help would be greatly appreciated.
  9. Ok, so I seem to have registered goals for the entity but I still have the problem that whenever I spawn it the game crashes. Here is my entity class so far. public class TestEntity extends CowEntity { public static final String REG = "simple_entity"; public static final EntityType<TestEntity> TYPE = //Entity type builder public static final AttributeModifierMap MAP = //Entity Attribute builder public TestEntity(EntityType<? extends CowEntity> p_i48567_1_, World p_i48567_2_) { super(p_i48567_1_, p_i48567_2_); Main.LOGGER.debug("STAR - Entity Constructed"); this.setNoGravity(false); } @Override protected void registerGoals() { super.registerGoals(); Main.LOGGER.debug("STAR - Entity Goals"); this.goalSelector.addGoal(0, new TemptGoal(this, 1.25D, Ingredient.of(Items.WHEAT), false)); } } Any ideas why this error is still occurring.
  10. Hi again, I'm trying to create a custom living entity but I keep running into this issue that causes a crash due to a ticking entity. Crash: [12:31:15] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception net.minecraft.crash.ReportedException: Ticking entity at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:855) ~[forge:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:787) ~[forge:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.integrated.IntegratedServer.tickServer(IntegratedServer.java:78) ~[forge:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:642) ~[forge:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:232) ~[forge:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Thread.java:748) [?:1.8.0_282] {} Caused by: java.lang.NullPointerException at net.minecraft.entity.LivingEntity.travel(LivingEntity.java:1905) ~[forge:?] {re:classloading} at net.minecraft.entity.LivingEntity.aiStep(LivingEntity.java:2449) ~[forge:?] {re:classloading} at net.minecraft.entity.MobEntity.aiStep(MobEntity.java:488) ~[forge:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.entity.AgeableEntity.aiStep(AgeableEntity.java:115) ~[forge:?] {re:classloading} at net.minecraft.entity.passive.AnimalEntity.aiStep(AnimalEntity.java:51) ~[forge:?] {re:classloading} at net.minecraft.entity.LivingEntity.tick(LivingEntity.java:2158) ~[forge:?] {re:classloading} at net.minecraft.entity.MobEntity.tick(MobEntity.java:300) ~[forge:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.server.ServerWorld.tickNonPassenger(ServerWorld.java:611) ~[forge:?] {re:classloading} at net.minecraft.world.World.guardEntityTick(World.java:554) ~[forge:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.world.server.ServerWorld.tick(ServerWorld.java:404) ~[forge:?] {re:classloading} at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:851) ~[forge:?] {re:classloading,pl:accesstransformer:B} ... 5 more AL lib: (EE) alc_cleanup: 1 device not closed It seems to be that I have not defined an ai/brain but I have no idea how to do this. I cant seem to see any event to do this in the library. Any help would be greatly appreciated.
  11. Thanks for all your help. Here is the method that seems to register the attributes correctly. Entity Class: public class TestEntity extends CowEntity { public static final String REG = "simple_entity"; public static final EntityType<TestEntity> TYPE = EntityType.Builder.<TestEntity>of(TestEntity::new, EntityClassification.MISC) .sized(0.98F, 0.7F) .clientTrackingRange(8) .build(REG); public static final AttributeModifierMap MAP = AttributeModifierMap.builder().add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 20.0) .add(Attributes.FOLLOW_RANGE, 20.0) .build(); public TestEntity(EntityType<? extends CowEntity> p_i48567_1_, World p_i48567_2_) { super(p_i48567_1_, p_i48567_2_); this.setNoAi(true); } } Main Class: @Mod(Main.MODID) public class Main { //trim public Main() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.register(this.getClass()); //trim LOGGER.info("STAR has been initialised"); } //trim @SubscribeEvent public static void entityAttributeCreationEvent(EntityAttributeCreationEvent event) { LOGGER.info("STAR - Entity Attribute Event"); event.put(TestEntity.TYPE, TestEntity.MAP); } //trim } Now I seem to have an error where there is no defined ai for the entity causing a ticking crash but I'll make a separate topic for that.
  12. Okay, so I've tried to add it as a subscribe event but it does not appear to exist. I'm using forge-1.16.4-35.1.4 in the eclipse IDE. Here is the event I created: @SubscribeEvent public void entityAttributeCreationEvent(EntityAttributeCreationEvent event) { //EntityAttributeCreateEvent cannot be resolved to a type } There don't seem to be any import candidates.
  13. Hi, I am trying to add a custom entity, however whenever I try to summon the entity I keep receiving the following error. [10:19:35] [Server thread/WARN] [minecraft/EntityType]: Exception loading entity: java.lang.NullPointerException: null at net.minecraft.entity.ai.attributes.AttributeModifierManager.getAttributeValue(AttributeModifierManager.java:67) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.LivingEntity.getAttributeValue(LivingEntity.java:1849) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.LivingEntity.getMaxHealth(LivingEntity.java:1610) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.LivingEntity.<init>(LivingEntity.java:209) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.MobEntity.<init>(MobEntity.java:108) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.entity.CreatureEntity.<init>(CreatureEntity.java:13) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.AgeableEntity.<init>(AgeableEntity.java:21) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.passive.AnimalEntity.<init>(AnimalEntity.java:37) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.passive.CowEntity.<init>(CowEntity.java:35) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at me.minecraft.star.entities.TestEntity.<init>(TestEntity.java:15) ~[main/:?] {re:classloading} at net.minecraft.entity.EntityType.create(EntityType.java:448) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} at net.minecraft.entity.EntityType.lambda$loadEntityUnchecked$1(EntityType.java:459) ~[forge-1.16.4-35.1.4_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading} //removed excess at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:721) ~[forge:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:667) ~[forge:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.lambda$startServer$0(MinecraftServer.java:233) ~[forge:?] {re:classloading,pl:accesstransformer:B} at java.lang.Thread.run(Thread.java:748) [?:1.8.0_282] {} [10:19:35] [Render thread/INFO] [minecraft/NewChatGui]: [CHAT] Unable to summon entity I have tried multiple different methods but for some reason the entity attributes are not being set correctly. I am currently using the method suggested in the topic below with no success. https://forums.minecraftforge.net/topic/87597-1161-custom-entity-attributes/ Code: Main class: @Mod(Main.MODID) public class Main { //Removed excess private void setup(final FMLCommonSetupEvent event) { LOGGER.info("STAR - Setup Complete"); DeferredWorkQueue.runLater(() -> { GlobalEntityTypeAttributes.put(EntityRegister.TESTENTITY_TYPE, TestEntity.setCustomAttributes().create()); }); } } Entity Class: public class TestEntity extends CowEntity { //Removed Excess public static AttributeModifierMap.MutableAttribute setCustomAttributes() { return MobEntity.func_233666_p_().createMutableAttribute(Attributes.MOVEMENT_SPEED, (double)0.5F).createMutableAttribute(Attributes.MAX_HEALTH, 20.0D).createMutableAttribute(Attributes.ATTACK_DAMAGE, 5.0D); } } I am using a deferred register method to register entities and it seems to be registering them successfully in the output. It also appears in the commands autofill. Any help would be greatly appreciated
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.