From d8b469a25f232fb94ca999ab5f29e2cd0918e6f9 Mon Sep 17 00:00:00 2001 From: SammySemicolon <69329424+SammySemicolon@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:59:15 +0100 Subject: [PATCH] Boyfriend is here life is no longer anguish --- .../entity/HexProjectileEntityRenderer.java | 5 +--- .../common/entity/FloatingItemEntity.java | 7 ++++++ .../common/entity/HexProjectileEntity.java | 24 ++++++++++--------- .../curiosities/weapons/MagicStaveItem.java | 7 ++---- .../curiosities/weapons/MalumStaveItem.java | 13 +++------- .../common/entity/EntityRegistry.java | 1 - 6 files changed, 26 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/sammy/malum/client/renderer/entity/HexProjectileEntityRenderer.java b/src/main/java/com/sammy/malum/client/renderer/entity/HexProjectileEntityRenderer.java index 604c0ff02..278d3bdf6 100644 --- a/src/main/java/com/sammy/malum/client/renderer/entity/HexProjectileEntityRenderer.java +++ b/src/main/java/com/sammy/malum/client/renderer/entity/HexProjectileEntityRenderer.java @@ -10,9 +10,8 @@ import net.minecraft.resources.*; import net.minecraft.util.*; import net.minecraft.world.phys.*; -import org.joml.*; import team.lodestar.lodestone.helpers.*; -import team.lodestar.lodestone.registry.client.*; +import team.lodestar.lodestone.setup.*; import team.lodestar.lodestone.systems.easing.*; import team.lodestar.lodestone.systems.rendering.*; import team.lodestar.lodestone.systems.rendering.rendeertype.*; @@ -37,8 +36,6 @@ public HexProjectileEntityRenderer(EntityRendererProvider.Context context) { } private static final ResourceLocation SAW = malumPath("textures/particle/saw.png"); - private static final RenderType ADDITIVE_SAW = LodestoneRenderTypeRegistry.ADDITIVE_TEXTURE.apply(SAW); - private static final RenderType LUMITRANSPARENT_SAW = LodestoneRenderTypeRegistry.TRANSPARENT_TEXTURE.apply(SAW, ShaderUniformHandler.LUMITRANSPARENT); private static final ResourceLocation LIGHT_TRAIL = malumPath("textures/vfx/concentrated_trail.png"); private static final RenderType TRAIL_TYPE = LodestoneRenderTypeRegistry.ADDITIVE_TEXTURE_TRIANGLE.apply(LIGHT_TRAIL); diff --git a/src/main/java/com/sammy/malum/common/entity/FloatingItemEntity.java b/src/main/java/com/sammy/malum/common/entity/FloatingItemEntity.java index 299bafe6e..49ce61d5b 100644 --- a/src/main/java/com/sammy/malum/common/entity/FloatingItemEntity.java +++ b/src/main/java/com/sammy/malum/common/entity/FloatingItemEntity.java @@ -3,6 +3,7 @@ import com.sammy.malum.common.item.spirit.*; import com.sammy.malum.registry.common.item.ItemRegistry; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.*; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; @@ -10,6 +11,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import net.minecraftforge.network.*; public class FloatingItemEntity extends FloatingEntity { @@ -41,6 +43,11 @@ public void onSyncedDataUpdated(EntityDataAccessor pKey) { super.onSyncedDataUpdated(pKey); } + @Override + public Packet getAddEntityPacket() { + return NetworkHooks.getEntitySpawningPacket(this); + } + protected ItemStack getItemRaw() { return this.getEntityData().get(DATA_ITEM_STACK); } diff --git a/src/main/java/com/sammy/malum/common/entity/HexProjectileEntity.java b/src/main/java/com/sammy/malum/common/entity/HexProjectileEntity.java index 17e2013c6..5d25ad68f 100644 --- a/src/main/java/com/sammy/malum/common/entity/HexProjectileEntity.java +++ b/src/main/java/com/sammy/malum/common/entity/HexProjectileEntity.java @@ -69,7 +69,9 @@ protected void defineSynchedData() { public void onSyncedDataUpdated(EntityDataAccessor pKey) { if (DATA_FADING_AWAY.equals(pKey)) { fadingAway = entityData.get(DATA_FADING_AWAY); - age = 70; + if (fadingAway) { + age = 70; + } } super.onSyncedDataUpdated(pKey); } @@ -118,10 +120,10 @@ protected void onHitEntity(EntityHitResult result) { } if (getOwner() instanceof LivingEntity staveOwner) { Entity target = result.getEntity(); - if (level().isClientSide) { + if (level.isClientSide) { return; } - DamageSource source = target.damageSources().mobProjectile(this, staveOwner); + DamageSource source = DamageSource.indirectMobAttack(this, staveOwner); boolean success = target.hurt(source, damage); if (success && target instanceof LivingEntity livingentity) { ItemStack stave = getItem(); @@ -133,12 +135,12 @@ protected void onHitEntity(EntityHitResult result) { if (magicDamage > 0) { if (livingentity.isAlive()) { livingentity.invulnerableTime = 0; - livingentity.hurt(DamageTypeRegistry.create(level(), DamageTypeRegistry.VOODOO, this, staveOwner), magicDamage); + livingentity.hurt(DamageTypeRegistry.VOODOO, magicDamage); } } getEntityData().set(DATA_FADING_AWAY, true); - ParticleEffectTypeRegistry.HEX_BOLT_IMPACT.createPositionedEffect(level(), new PositionEffectData(position().add(getDeltaMovement().scale(0.5f))), new ColorEffectData(SpiritTypeRegistry.WICKED_SPIRIT), HexBoltHitEnemyParticleEffect.createData(getDeltaMovement().reverse().normalize())); - target.level().playSound(null, target.getX(), target.getY(), target.getZ(), SoundRegistry.SCYTHE_CUT.get(), target.getSoundSource(), 1.0F, 0.9f + target.level().random.nextFloat() * 0.2f); + ParticleEffectTypeRegistry.HEX_BOLT_IMPACT.createPositionedEffect(level, new PositionEffectData(position().add(getDeltaMovement().scale(0.5f))), new ColorEffectData(SpiritTypeRegistry.WICKED_SPIRIT), HexBoltHitEnemyParticleEffect.createData(getDeltaMovement().reverse().normalize())); + target.level.playSound(null, target.getX(), target.getY(), target.getZ(), SoundRegistry.SCYTHE_CUT.get(), target.getSoundSource(), 1.0F, 0.9f + target.level.random.nextFloat() * 0.2f); setDeltaMovement(getDeltaMovement().scale(0.05f)); } } @@ -154,7 +156,7 @@ public void tick() { } if (soundCooldown-- == 0) { if (random.nextFloat() < 0.6f) { - level().playSound(null, blockPosition(), SoundRegistry.ARCANE_WHISPERS.get(), SoundSource.NEUTRAL, 0.3f, Mth.nextFloat(random, 1.1f, 2f)); + level.playSound(null, blockPosition(), SoundRegistry.ARCANE_WHISPERS.get(), SoundSource.NEUTRAL, 0.3f, Mth.nextFloat(random, 1.1f, 2f)); } soundCooldown = random.nextInt(40) + 40; } @@ -178,10 +180,10 @@ public void tick() { yRotO = getYRot(); xRotO = getXRot(); } - if (level().isClientSide && !fadingAway) { + if (level.isClientSide && !fadingAway) { float scalar = age > 70 ? 1f - (age - 70) / 10f : 1f; Vec3 norm = motion.normalize().scale(0.05f); - var lightSpecs = SpiritLightSpecs.spiritLightSpecs(level(), position(), SpiritTypeRegistry.WICKED_SPIRIT); + var lightSpecs = SpiritLightSpecs.spiritLightSpecs(level, position(), SpiritTypeRegistry.WICKED_SPIRIT); lightSpecs.getBuilder().multiplyLifetime(1.25f).setMotion(norm); lightSpecs.getBloomBuilder().multiplyLifetime(1.25f).setMotion(norm); lightSpecs.spawnParticles(); @@ -197,9 +199,9 @@ public void tick() { .enableNoClip() .setSpritePicker(SimpleParticleOptions.ParticleSpritePicker.RANDOM_SPRITE) .addTickActor(behavior) - .spawn(level(), position().x, position().y, position().z) + .spawn(level, position().x, position().y, position().z) .setRenderType(LodestoneWorldParticleRenderType.LUMITRANSPARENT) - .spawn(level(), position().x, position().y, position().z); + .spawn(level, position().x, position().y, position().z); } } diff --git a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/MagicStaveItem.java b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/MagicStaveItem.java index 075f85e50..0e7447066 100644 --- a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/MagicStaveItem.java +++ b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/MagicStaveItem.java @@ -2,17 +2,14 @@ import com.google.common.collect.*; import com.sammy.malum.common.entity.*; -import com.sammy.malum.registry.common.*; -import com.sammy.malum.registry.common.item.*; import net.minecraft.stats.*; import net.minecraft.world.*; import net.minecraft.world.entity.ai.attributes.*; import net.minecraft.world.entity.player.*; import net.minecraft.world.item.*; -import net.minecraft.world.item.enchantment.*; import net.minecraft.world.level.*; import net.minecraft.world.phys.*; -import team.lodestar.lodestone.registry.common.*; +import team.lodestar.lodestone.setup.*; public class MagicStaveItem extends MalumStaveItem { @@ -33,7 +30,7 @@ public ImmutableMultimap.Builder createExtraAttrib @Override public InteractionResultHolder use(Level pLevel, Player pPlayer, InteractionHand pUsedHand) { ItemStack stack = pPlayer.getItemInHand(pUsedHand); - Level level = pPlayer.level(); + Level level = pPlayer.level; if (!level.isClientSide && !pPlayer.getCooldowns().isOnCooldown(stack.getItem())) { float magicDamage = (float) pPlayer.getAttributes().getValue(LodestoneAttributeRegistry.MAGIC_DAMAGE.get()); int angle = pUsedHand == InteractionHand.MAIN_HAND ? 225 : 90; diff --git a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/MalumStaveItem.java b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/MalumStaveItem.java index 300df6719..4b88b4e74 100644 --- a/src/main/java/com/sammy/malum/common/item/curiosities/weapons/MalumStaveItem.java +++ b/src/main/java/com/sammy/malum/common/item/curiosities/weapons/MalumStaveItem.java @@ -1,23 +1,16 @@ package com.sammy.malum.common.item.curiosities.weapons; import com.sammy.malum.common.entity.*; -import com.sammy.malum.common.entity.boomerang.*; import com.sammy.malum.core.systems.item.*; import com.sammy.malum.registry.client.*; import com.sammy.malum.registry.common.*; -import com.sammy.malum.registry.common.item.*; import net.minecraft.core.particles.*; import net.minecraft.server.level.*; -import net.minecraft.sounds.*; import net.minecraft.util.*; -import net.minecraft.world.damagesource.*; import net.minecraft.world.entity.*; import net.minecraft.world.entity.player.*; import net.minecraft.world.item.*; -import net.minecraft.world.item.enchantment.*; import net.minecraftforge.event.entity.living.*; -import team.lodestar.lodestone.helpers.*; -import team.lodestar.lodestone.registry.common.tag.*; import team.lodestar.lodestone.systems.item.*; public class MalumStaveItem extends ModCombatItem implements IMalumEventResponderItem { @@ -30,15 +23,15 @@ public MalumStaveItem(Tier tier, float attackDamageIn, float attackSpeedIn, Prop public void hurtEvent(LivingHurtEvent event, LivingEntity attacker, LivingEntity target, ItemStack stack) { if (attacker instanceof Player player && !(event.getSource().getDirectEntity() instanceof HexProjectileEntity)) { spawnSweepParticles(player, ParticleRegistry.SCYTHE_CUT_ATTACK_PARTICLE.get()); - attacker.level().playSound(null, target.getX(), target.getY(), target.getZ(), SoundRegistry.SCYTHE_CUT.get(), attacker.getSoundSource(), 1, 1); + attacker.level.playSound(null, target.getX(), target.getY(), target.getZ(), SoundRegistry.SCYTHE_CUT.get(), attacker.getSoundSource(), 1, 1); } } public void spawnSweepParticles(Player player, SimpleParticleType type) { double d0 = (-Mth.sin(player.getYRot() * ((float) Math.PI / 180F))); double d1 = Mth.cos(player.getYRot() * ((float) Math.PI / 180F)); - if (player.level() instanceof ServerLevel) { - ((ServerLevel) player.level()).sendParticles(type, player.getX() + d0, player.getY(0.5D), player.getZ() + d1, 0, d0, 0.0D, d1, 0.0D); + if (player.level instanceof ServerLevel) { + ((ServerLevel) player.level).sendParticles(type, player.getX() + d0, player.getY(0.5D), player.getZ() + d1, 0, d0, 0.0D, d1, 0.0D); } } } \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/registry/common/entity/EntityRegistry.java b/src/main/java/com/sammy/malum/registry/common/entity/EntityRegistry.java index de2342e59..c412e4146 100644 --- a/src/main/java/com/sammy/malum/registry/common/entity/EntityRegistry.java +++ b/src/main/java/com/sammy/malum/registry/common/entity/EntityRegistry.java @@ -4,7 +4,6 @@ import com.sammy.malum.client.renderer.entity.*; import com.sammy.malum.common.entity.*; import com.sammy.malum.common.entity.boomerang.*; -import com.sammy.malum.common.entity.night_terror.*; import com.sammy.malum.common.entity.nitrate.*; import com.sammy.malum.common.entity.spirit.*; import com.sammy.malum.registry.common.item.*;