Jump to content

TheUnnamed

Members
  • Posts

    12
  • Joined

  • Last visited

Recent Profile Visitors

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

TheUnnamed's Achievements

Tree Puncher

Tree Puncher (2/8)

2

Reputation

  1. Regarding your problem, use the posX, posY, posZ double variables instead, from the entity class, this I believe will give you the exact position.
  2. Not 100% sure as I don't have a 1.11.2 workspace set up, but in 1.14.2 the Javadocs tells me that setRotationAndPosition() sets the position and rotation, clamping and wrapping params to valid values. Used by network code. Whereas setLocationAndAngles() simply sets the location and Yaw/Pitch of the entity in the world.
  3. You need to set location and angles of the entity. You can use the setLocationAndAngles method for that, from the Entity class. EntityModMob mob = new EntityModMob(event.getWorld()); mob.setLocationAndAngles(DESIRED POSITION AND ROTATION GOES HERE); event.getWorld().spawnEntity(mob);
  4. I solved it. Here's how I did it: When I set the EntityType variable for my named variable "ENT_PROJECTILE" and build, I use the setCustomClientFactory method, so it would look exactly like this: ENT_PROJECTILE = registerEntity(EntityType.Builder.<EntityModProjectile>create(EntityClassification.MISC).setCustomClientFactory(EntityModProjectile::new).size(0.25F, 0.25F), "ent_projectile"); Inside of my EntityModProjectile class I extended the ProjectileItemEntity class, overrided the createSpawnPacket method and returned getEntitySpawningPacket from NetworkHooks class. Like this: @Override public IPacket<?> createSpawnPacket() { return NetworkHooks.getEntitySpawningPacket(this); } I then created another constructor inside of the EntityModProjectile class, like this: public EntityModProjectile(FMLPlayMessages.SpawnEntity packet, World worldIn) { super(ModEntityType.ENT_PROJECTILE, worldIn); }
  5. I think you are posting in the wrong forum section, you can either contact the mod authors or post in "Support and Bug Reports", for these kind of matters I believe. I thought you were modding, as in writing code for your own mod.
  6. What's the potion effect, a custom one? Also this is an simple example of how you can use instanceof operator: public void methodName(Entity entity) { if (entity instanceof EntityPlayerMP) { EntityPlayerMP player = (EntityPlayerMP) entity; if (player.isBla()) { // code... } } }
  7. It says right there that EntityPlayerSP cannot be cast to EntityPlayerMP. You most likely need to check if entity is instanceof desired Entity class.
  8. Overriding the getHarvestLevel method and returning an Int value works for me. But then again I'm not dropping the block via a Loot Table, I spawn desired items in spawnAdditionalDrops method, and this is called when the block is harvested.
  9. Thank you for your input PhilipChonacky. I've done exactly as you've suggested, but the issue still persists, the entity I'm summoning with the /summon command is still invisible. It says the entity has been registered in the console, so I'm not quite sure what could be the problem. Keep in mind that this only occurs with entities that are created with SSpawnObjectPacket and not SSpawnMobPacket in the IPacket<?> createSpawnPacket() method it seems, because mob entities register and render just fine in-game, as previously stated.
  10. Is this a valid way to register entities? Be it entities extending classes such as ProjectileItemEntity or MonsterEntity class. The reason I ask is because while the mob entity is registring and showing in game just fine, the throwable entity is not, and is completely invisible in game when spawned (even when I don't register entity rendering with the RenderingRegistry class - this would in turn render it as a white box which is not happening). public static EntityType<?> ENT_MOB = null; public static EntityType<EntityModProjectile> ENT_PROJECTILE = null; static { ENT_MOB = registerEntityAndEgg(event.getRegistry(), EntityType.Builder.create(EntityModMob::new, EntityClassification.MONSTER).size(0.6F, 1.95F), 0xdcdcdc, 0xe21a1a, "ent_mob"); ENT_PROJECTILE = registerEntity(EntityType.Builder.<EntityModProjectile>create(EntityModProjectile::new, EntityClassification.MISC).size(0.25F, 0.25F).setTrackingRange(64).setUpdateInterval(20).setShouldReceiveVelocityUpdates(false), "ent_projectile"); } @SubscribeEvent public static void registerItems(final RegistryEvent.Register<EntityType<?>> event) { event.getRegistry().registerAll(ENT_MOB, ENT_PROJECTILE); } public static <T extends Entity> EntityType<T> registerEntity(EntityType.Builder builder, String name) { EntityType<T> type = (EntityType<T>) builder.build(Main.MODID + '.' + name).setRegistryName(name); return type; } And this is how I register entity rendering: RenderingRegistry.registerEntityRenderingHandler(EntityModMob.class, renderManager -> new RenderModMob(renderManager)); RenderingRegistry.registerEntityRenderingHandler(EntityModProjectile.class, renderManager -> new SpriteRenderer<EntityModProjectile>(renderManager, Minecraft.getInstance().getItemRenderer())); EntityModProjectile class: public class EntityModProjectile extends ProjectileItemEntity { public EntityModProjectile(EntityType<? extends EntityModProjectile> entityTypeIn, World worldIn) { super(entityTypeIn, worldIn); } public EntityModProjectile(World worldIn, LivingEntity throwerIn) { super(ModEntityType.ENT_PROJECTILE, throwerIn, worldIn); } public EntityModProjectile(World worldIn, double x, double y, double z) { super(ModEntityType.ENT_PROJECTILE, x, y, z, worldIn); } @Override protected Item func_213885_i() { return ModItems.MOD_PROJECTILE; } }
  11. Nvm, I'm retarded. I forgot to change the value of @Mod("examplemod") to match the entry in the META-INF/mods.toml file. Runs fine now.
  12. Running Forge in IntelliJ crashes as soon as main menu screen is "fading in" / loading up. I've picked correct module so I'm not sure what is wrong. Could it be that 1.14.2 just released, and it's bugged?
×
×
  • Create New...

Important Information

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