Skip to content

Commit

Permalink
fixed missing drops
Browse files Browse the repository at this point in the history
  • Loading branch information
Globox1997 committed Nov 21, 2023
1 parent f4e918b commit 1d37df8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 47 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Added:
- Added SpoiledZ compat
### Fixed:
-
- Fixed mount dismounting
- Fixed missing drops
### Changed:
- Tweaked internals
38 changes: 0 additions & 38 deletions src/main/java/net/rpgz/mixin/LivingEntityMixin.java

This file was deleted.

17 changes: 10 additions & 7 deletions src/main/java/net/rpgz/mixin/MobEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.At;

Expand Down Expand Up @@ -164,6 +163,16 @@ public void onDeath(DamageSource damageSource) {
super.onDeath(damageSource);
}

@Override
public ItemEntity dropStack(ItemStack stack) {
if (this.isDead()) {
addInventoryItem(stack);
return null;
} else {
return super.dropStack(stack);
}
}

private void despawnParticlesServer() {
for (int i = 0; i < 20; ++i) {
double d = this.random.nextGaussian() * 0.025D;
Expand Down Expand Up @@ -191,12 +200,6 @@ private void isAffectedByDaylightMixin(CallbackInfoReturnable<Boolean> info) {
}
}

@Redirect(method = "dropEquipment", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/mob/MobEntity;dropStack(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/entity/ItemEntity;"))
private ItemEntity dropEquipmentMixin(MobEntity mobEntity, ItemStack itemStack) {
this.addInventoryItem(itemStack);
return null;
}

@Override
public void addInventoryItem(ItemStack stack) {
RpgHelper.addStackToInventory((MobEntity) (Object) this, stack, this.getWorld());
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/rpgz.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"package": "net.rpgz.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"LivingEntityMixin",
"MobEntityMixin",
"HopperBlockEntityMixin",
"ServerPlayerEntityMixin",
Expand Down

0 comments on commit 1d37df8

Please sign in to comment.