Edit potion splash
Thrown potions now leave a trail of particles and create a ring around them reflecting the true scale of their AoE Slightly shortened cooldown on splash potions Potions throw further (temporary, will be replaced with charging soon) Let me know if it has trouble in multiplayer, there's a little weirdness in the client/server sync
This commit is contained in:
parent
e43131daf5
commit
a8bdbaa187
|
|
@ -0,0 +1,12 @@
|
|||
package xyz.nearmisses.patience.mc_rebalance.mixin;
|
||||
|
||||
import net.minecraft.world.item.ThrowablePotionItem;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(ThrowablePotionItem.class)
|
||||
public class PotionThrowRework {
|
||||
@ModifyConstant(method="use", constant = @Constant(floatValue = 0.5F))
|
||||
private float teachSteveToThrow(float constant){return constant*1.8F;}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package xyz.nearmisses.patience.mc_rebalance.mixin;
|
||||
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.core.particles.ColorParticleOption;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.FastColor;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.projectile.ItemSupplier;
|
||||
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
|
||||
import net.minecraft.world.entity.projectile.ThrownPotion;
|
||||
import net.minecraft.world.item.alchemy.PotionContents;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
|
||||
@Mixin(ThrownPotion.class)
|
||||
public abstract class PotionVisualsRework extends ThrowableItemProjectile implements ItemSupplier {
|
||||
|
||||
public PotionVisualsRework(EntityType<? extends ThrowableItemProjectile> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
}
|
||||
|
||||
@Unique
|
||||
private int trailTimer=4;
|
||||
|
||||
@Inject(method="onHit", at=@At("HEAD"))
|
||||
private void MarkRadiusWithParticles(HitResult hitResult, CallbackInfo ci){
|
||||
PotionContents potionContents = this.getItem().getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY);
|
||||
|
||||
if(!this.level().isClientSide()){
|
||||
int ringScale = 4;
|
||||
int ringDensity = 30;
|
||||
for(int i = 0; i<ringDensity; i++) {
|
||||
((ServerLevel) this.level()).sendParticles(
|
||||
ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, FastColor.ARGB32.opaque(potionContents.getColor())), // Nature of the particle
|
||||
this.getX() + ringScale *Math.sin(i*2*Math.PI/ ringDensity), this.getY() +0.22, this.getZ() + ringScale *Math.cos(i*2*Math.PI/ ringDensity), // position
|
||||
1, // How many in one place
|
||||
0.0, 0.0, 0.0, 0.0 // No idea
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(){
|
||||
super.tick();
|
||||
if(!this.level().isClientSide() && this.trailTimer--==0){
|
||||
PotionContents potionContents = this.getItem().getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY);
|
||||
this.trailTimer = 4;
|
||||
((ServerLevel) this.level()).sendParticles(
|
||||
ColorParticleOption.create(ParticleTypes.ENTITY_EFFECT, FastColor.ARGB32.opaque(potionContents.getColor())),
|
||||
this.getX(), this.getY() +0.22, this.getZ(),
|
||||
1,
|
||||
0.0, 0.0, 0.0, 0.0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
public class SplashCooldownTweak {
|
||||
@Inject(method="use", at=@At("HEAD"))
|
||||
void use(Level level, Player player, InteractionHand interactionHand, CallbackInfoReturnable<InteractionResultHolder<ItemStack>> cir){
|
||||
player.getCooldowns().addCooldown(player.getItemInHand(interactionHand).getItem(), 30);
|
||||
player.getCooldowns().addCooldown(player.getItemInHand(interactionHand).getItem(), 24);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
"GrowRateTweak",
|
||||
"LingeringCooldownTweak",
|
||||
"PlayerTweaks",
|
||||
"PotionThrowRework",
|
||||
"PotionVisualsRework",
|
||||
"SplashCooldownTweak",
|
||||
"mob.BlazeAIRework",
|
||||
"mob.BlazeRework",
|
||||
|
|
|
|||
Loading…
Reference in a new issue