From fbd9c39572a14d4d8d22f8ce7aa4113e4bcc0509 Mon Sep 17 00:00:00 2001 From: Carmelo Buscemi Date: Sat, 9 Jan 2021 16:07:18 +0100 Subject: [PATCH] feat: improved tags; misc --- .../entity/projectile/BoneShardEntity.java | 10 ++++----- .../projectile/MelonSeedProjectileEntity.java | 21 ++++++++++--------- .../RottenFleshProjectileEntity.java | 12 +++++------ .../init/renderer/EntityRendererInit.java | 9 +++----- .../mobs/init/renderer/FluidRendererInit.java | 1 - .../tags/entity_types/impact_projectiles.json | 6 ++++++ .../tags/entity_types/raiders.json | 6 ++++++ .../tags/entity_types/skeletons.json | 6 ++++++ 8 files changed, 42 insertions(+), 29 deletions(-) create mode 100644 src/main/resources/data/earthtojavamobs/tags/entity_types/impact_projectiles.json create mode 100644 src/main/resources/data/earthtojavamobs/tags/entity_types/raiders.json create mode 100644 src/main/resources/data/earthtojavamobs/tags/entity_types/skeletons.json diff --git a/src/main/java/slexom/earthtojava/mobs/entity/projectile/BoneShardEntity.java b/src/main/java/slexom/earthtojava/mobs/entity/projectile/BoneShardEntity.java index 049e379d..186e2c1a 100644 --- a/src/main/java/slexom/earthtojava/mobs/entity/projectile/BoneShardEntity.java +++ b/src/main/java/slexom/earthtojava/mobs/entity/projectile/BoneShardEntity.java @@ -21,12 +21,12 @@ public class BoneShardEntity extends ThrownItemEntity { - public BoneShardEntity(World worldIn, LivingEntity throwerIn) { - super(EntityTypesInit.BONE_SHARD_REGISTRY_OBJECT, throwerIn, worldIn); + public BoneShardEntity(World world, LivingEntity owner) { + super(EntityTypesInit.BONE_SHARD_REGISTRY_OBJECT, owner, world); } - public BoneShardEntity(World worldIn, double x, double y, double z) { - super(EntityTypesInit.BONE_SHARD_REGISTRY_OBJECT, x, y, z, worldIn); + public BoneShardEntity(World world, double x, double y, double z) { + super(EntityTypesInit.BONE_SHARD_REGISTRY_OBJECT, x, y, z, world); } public BoneShardEntity(EntityType entityType, World world) { @@ -41,7 +41,7 @@ protected Item getDefaultItem() { @Environment(EnvType.CLIENT) private ParticleEffect getParticleParameters() { ItemStack itemStack = this.getItem(); - return (ParticleEffect) (itemStack.isEmpty() ? ParticleTypes.SPIT : new ItemStackParticleEffect(ParticleTypes.ITEM, itemStack)); + return itemStack.isEmpty() ? ParticleTypes.SPIT : new ItemStackParticleEffect(ParticleTypes.ITEM, itemStack); } @Environment(EnvType.CLIENT) diff --git a/src/main/java/slexom/earthtojava/mobs/entity/projectile/MelonSeedProjectileEntity.java b/src/main/java/slexom/earthtojava/mobs/entity/projectile/MelonSeedProjectileEntity.java index 46e4efed..ab4c35f8 100644 --- a/src/main/java/slexom/earthtojava/mobs/entity/projectile/MelonSeedProjectileEntity.java +++ b/src/main/java/slexom/earthtojava/mobs/entity/projectile/MelonSeedProjectileEntity.java @@ -10,6 +10,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; +import net.minecraft.network.Packet; +import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket; import net.minecraft.particle.ItemStackParticleEffect; import net.minecraft.particle.ParticleEffect; import net.minecraft.particle.ParticleTypes; @@ -19,14 +21,13 @@ import slexom.earthtojava.mobs.init.EntityTypesInit; public class MelonSeedProjectileEntity extends ThrownItemEntity { - - - public MelonSeedProjectileEntity(World worldIn, LivingEntity throwerIn) { - super(EntityTypesInit.MELON_SEED_PROJECTILE_REGISTRY_OBJECT, throwerIn, worldIn); + + public MelonSeedProjectileEntity(World world, LivingEntity owner) { + super(EntityTypesInit.MELON_SEED_PROJECTILE_REGISTRY_OBJECT, owner, world); } - public MelonSeedProjectileEntity(World worldIn, double x, double y, double z) { - super(EntityTypesInit.MELON_SEED_PROJECTILE_REGISTRY_OBJECT, x, y, z, worldIn); + public MelonSeedProjectileEntity(World world, double x, double y, double z) { + super(EntityTypesInit.MELON_SEED_PROJECTILE_REGISTRY_OBJECT, x, y, z, world); } public MelonSeedProjectileEntity(EntityType entityType, World world) { @@ -41,7 +42,7 @@ protected Item getDefaultItem() { @Environment(EnvType.CLIENT) private ParticleEffect getParticleParameters() { ItemStack itemStack = this.getItem(); - return (ParticleEffect) (itemStack.isEmpty() ? ParticleTypes.ITEM_SNOWBALL : new ItemStackParticleEffect(ParticleTypes.ITEM, itemStack)); + return itemStack.isEmpty() ? ParticleTypes.ITEM_SNOWBALL : new ItemStackParticleEffect(ParticleTypes.ITEM, itemStack); } @Environment(EnvType.CLIENT) @@ -66,8 +67,8 @@ protected void onCollision(HitResult hitResult) { this.world.sendEntityStatus(this, (byte) 3); this.remove(); } - } - - + public Packet createSpawnPacket() { + return new EntitySpawnS2CPacket(this); + } } \ No newline at end of file diff --git a/src/main/java/slexom/earthtojava/mobs/entity/projectile/RottenFleshProjectileEntity.java b/src/main/java/slexom/earthtojava/mobs/entity/projectile/RottenFleshProjectileEntity.java index b2c15326..c3713cd8 100644 --- a/src/main/java/slexom/earthtojava/mobs/entity/projectile/RottenFleshProjectileEntity.java +++ b/src/main/java/slexom/earthtojava/mobs/entity/projectile/RottenFleshProjectileEntity.java @@ -21,13 +21,12 @@ public class RottenFleshProjectileEntity extends ThrownItemEntity { - - public RottenFleshProjectileEntity(World worldIn, LivingEntity throwerIn) { - super(EntityTypesInit.ROTTEN_FLESH_PROJECTILE_REGISTRY_OBJECT, throwerIn, worldIn); + public RottenFleshProjectileEntity(World world, LivingEntity owner) { + super(EntityTypesInit.ROTTEN_FLESH_PROJECTILE_REGISTRY_OBJECT, owner, world); } - public RottenFleshProjectileEntity(World worldIn, double x, double y, double z) { - super(EntityTypesInit.ROTTEN_FLESH_PROJECTILE_REGISTRY_OBJECT, x, y, z, worldIn); + public RottenFleshProjectileEntity(World world, double x, double y, double z) { + super(EntityTypesInit.ROTTEN_FLESH_PROJECTILE_REGISTRY_OBJECT, x, y, z, world); } public RottenFleshProjectileEntity(EntityType entityType, World world) { @@ -42,7 +41,7 @@ protected Item getDefaultItem() { @Environment(EnvType.CLIENT) private ParticleEffect getParticleParameters() { ItemStack itemStack = this.getItem(); - return (ParticleEffect) (itemStack.isEmpty() ? ParticleTypes.SPIT : new ItemStackParticleEffect(ParticleTypes.ITEM, itemStack)); + return itemStack.isEmpty() ? ParticleTypes.SPIT : new ItemStackParticleEffect(ParticleTypes.ITEM, itemStack); } @Environment(EnvType.CLIENT) @@ -67,7 +66,6 @@ protected void onCollision(HitResult hitResult) { this.world.sendEntityStatus(this, (byte) 3); this.remove(); } - } } \ No newline at end of file diff --git a/src/main/java/slexom/earthtojava/mobs/init/renderer/EntityRendererInit.java b/src/main/java/slexom/earthtojava/mobs/init/renderer/EntityRendererInit.java index dc6e5e6a..c1b96f3e 100644 --- a/src/main/java/slexom/earthtojava/mobs/init/renderer/EntityRendererInit.java +++ b/src/main/java/slexom/earthtojava/mobs/init/renderer/EntityRendererInit.java @@ -2,7 +2,6 @@ import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry; import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.entity.FlyingItemEntityRenderer; import net.minecraft.entity.EntityType; import slexom.earthtojava.mobs.client.renderer.entity.*; @@ -23,16 +22,14 @@ private static void registerBlockEntityRenderer() { } private static void registerProjectileRenderer() { - EntityRendererRegistry.INSTANCE.register(EntityTypesInit.MELON_SEED_PROJECTILE_REGISTRY_OBJECT, (dispatcher, context) -> new FlyingItemEntityRenderer<>(dispatcher, MinecraftClient.getInstance().getItemRenderer())); - EntityRendererRegistry.INSTANCE.register(EntityTypesInit.BONE_SHARD_REGISTRY_OBJECT, (dispatcher, context) -> new FlyingItemEntityRenderer<>(dispatcher, MinecraftClient.getInstance().getItemRenderer())); - EntityRendererRegistry.INSTANCE.register(EntityTypesInit.ROTTEN_FLESH_PROJECTILE_REGISTRY_OBJECT, (dispatcher, context) -> new FlyingItemEntityRenderer<>(dispatcher, MinecraftClient.getInstance().getItemRenderer())); + EntityRendererRegistry.INSTANCE.register(EntityTypesInit.MELON_SEED_PROJECTILE_REGISTRY_OBJECT, (dispatcher, context) -> new FlyingItemEntityRenderer<>(dispatcher, context.getItemRenderer())); + EntityRendererRegistry.INSTANCE.register(EntityTypesInit.BONE_SHARD_REGISTRY_OBJECT, (dispatcher, context) -> new FlyingItemEntityRenderer<>(dispatcher, context.getItemRenderer())); + EntityRendererRegistry.INSTANCE.register(EntityTypesInit.ROTTEN_FLESH_PROJECTILE_REGISTRY_OBJECT, (dispatcher, context) -> new FlyingItemEntityRenderer<>(dispatcher, context.getItemRenderer())); } private static void registerEntitiesRenderer() { registerBaseVariantEntitiesRenderer(); registerSpecialVariantEntitiesRenderer(); - - } private static void registerBaseVariantEntitiesRenderer() { diff --git a/src/main/java/slexom/earthtojava/mobs/init/renderer/FluidRendererInit.java b/src/main/java/slexom/earthtojava/mobs/init/renderer/FluidRendererInit.java index 02512d45..f7bac304 100644 --- a/src/main/java/slexom/earthtojava/mobs/init/renderer/FluidRendererInit.java +++ b/src/main/java/slexom/earthtojava/mobs/init/renderer/FluidRendererInit.java @@ -26,7 +26,6 @@ public class FluidRendererInit { public static void init() { - BlockRenderLayerMap.INSTANCE.putFluids(RenderLayer.getSolid(), FluidInit.MUD_FLUID_FLOWING, FluidInit.MUD_FLUID_STILL); setupFluidRendering(FluidInit.MUD_FLUID_STILL, FluidInit.MUD_FLUID_FLOWING, 0x472804); } diff --git a/src/main/resources/data/earthtojavamobs/tags/entity_types/impact_projectiles.json b/src/main/resources/data/earthtojavamobs/tags/entity_types/impact_projectiles.json new file mode 100644 index 00000000..7eae038e --- /dev/null +++ b/src/main/resources/data/earthtojavamobs/tags/entity_types/impact_projectiles.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "earthtojavamobs:bone_shard" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/earthtojavamobs/tags/entity_types/raiders.json b/src/main/resources/data/earthtojavamobs/tags/entity_types/raiders.json new file mode 100644 index 00000000..4a1e7587 --- /dev/null +++ b/src/main/resources/data/earthtojavamobs/tags/entity_types/raiders.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "earthtojavamobs:viler_witch" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/earthtojavamobs/tags/entity_types/skeletons.json b/src/main/resources/data/earthtojavamobs/tags/entity_types/skeletons.json new file mode 100644 index 00000000..1fbfa320 --- /dev/null +++ b/src/main/resources/data/earthtojavamobs/tags/entity_types/skeletons.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "earthtojavamobs:skeleton_wolf" + ] +} \ No newline at end of file