Skip to content

Commit

Permalink
xp bottle spawning xp orb tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Feb 18, 2021
1 parent 9e16caf commit e9d2601
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void updateRemoval(Entity entity, RemovalReason reason)
private BaseText attachExtraCountHoverText(BaseText text, long extraCount, long ticks)
{
return TextUtil.attachHoverText(text, Messenger.c(
"q " + this.getCountDisplayString(),
"w " + this.getCountDisplayString(),
"g : ",
CounterUtil.ratePerHourText(extraCount, ticks, "wgg")
));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package carpettisaddition.mixins.command.lifetime.spawning;

import carpettisaddition.commands.lifetime.interfaces.IEntity;
import carpettisaddition.commands.lifetime.spawning.LiteralSpawningReason;
import net.minecraft.entity.Entity;
import net.minecraft.entity.thrown.ThrownExperienceBottleEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;

@Mixin(ThrownExperienceBottleEntity.class)
public class ThrownExperienceBottleEntityMixin
{
@ModifyArg(
method = "onCollision",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/World;spawnEntity(Lnet/minecraft/entity/Entity;)Z"
),
index = 0
)
private Entity onXPBottleDroppedXpLifeTimeTracker(Entity entity)
{
((IEntity)entity).recordSpawning(LiteralSpawningReason.ITEM);
return entity;
}
}
1 change: 1 addition & 0 deletions src/main/resources/carpet-tis-addition.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"command.lifetime.spawning.SlimeEntityMixin",
"command.lifetime.spawning.SpawnHelperMixin",
"command.lifetime.spawning.SummonCommandMixin",
"command.lifetime.spawning.ThrownExperienceBottleEntityMixin",
"command.lifetime.spawning.ZombieEntityMixin",
"command.raid.RaidAccessor",
"command.raid.RaidManagerAccessor",
Expand Down

0 comments on commit e9d2601

Please sign in to comment.