Skip to content

Commit

Permalink
Boyfriend is here life is no longer anguish
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Dec 4, 2023
1 parent 620ae16 commit d8b469a
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
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;
import net.minecraft.world.entity.EntityType;
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 {

Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
Expand All @@ -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));
}
}
Expand All @@ -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;
}
Expand All @@ -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();
Expand All @@ -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);

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -33,7 +30,7 @@ public ImmutableMultimap.Builder<Attribute, AttributeModifier> createExtraAttrib
@Override
public InteractionResultHolder<ItemStack> 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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand Down

0 comments on commit d8b469a

Please sign in to comment.