Skip to content

Commit

Permalink
Now decorated pots spawn all mobs
Browse files Browse the repository at this point in the history
  • Loading branch information
WenXin20 committed Jan 1, 2025
1 parent 4be2f24 commit 76d5d21
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/main/java/com/wenxin2/marioverse/mixin/ContainersMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ public class ContainersMixin {
private static void dropContents(Level world, double x, double y, double z, Container container, CallbackInfo ci) {
if (container instanceof DecoratedPotBlockEntity decoratedPotBE && !ConfigRegistry.DISABLE_DECORATED_POT_TWEAKS.get()) {
for (int i = 0; i < container.getContainerSize(); i++) {
marioverse$spawnFromContainer(world, new BlockPos((int) x, (int) y, (int) z), container.getItem(i), null,
ConfigRegistry.DECORATED_POT_SPAWNS_MOBS.get(), ConfigRegistry.DECORATED_POT_SPAWNS_POWER_UPS.get(),
TagRegistry.DECORATED_POT_CANNOT_SPAWN);
stackCount = decoratedPotBE.getTheItem().getCount();
for (int j = 0; j < stackCount; j++) {
marioverse$spawnFromContainer(world, new BlockPos((int) x, (int) y, (int) z), container.getItem(i), null,
ConfigRegistry.DECORATED_POT_SPAWNS_MOBS.get(), ConfigRegistry.DECORATED_POT_SPAWNS_POWER_UPS.get(),
TagRegistry.DECORATED_POT_CANNOT_SPAWN);
}

if (container.getItem(i).getItem() instanceof BlockItem blockItem && blockItem.getBlock() instanceof CoinBlock)
marioverse$playCoinSound(world, new BlockPos((int) x, (int) y, (int) z));
Expand All @@ -63,12 +66,13 @@ else if (container.getItem(i).getItem() instanceof BoatItem)
marioverse$playBoatSound(world, new BlockPos((int) x, (int) y, (int) z));
else if (container.getItem(i).getItem() instanceof MinecartItem)
marioverse$playMinecartSound(world, new BlockPos((int) x, (int) y, (int) z));

decoratedPotBE.removeTheItem();
}
} else if (container instanceof QuestionBlockEntity questionBE) {
for (int i = 0; i < container.getContainerSize(); i++) {
stackCount = questionBE.getStackInSlot().getCount();
for (int j = 0; j < questionBE.getStackInSlot().getCount(); j++) {
for (int j = 0; j < stackCount; j++) {
marioverse$spawnFromContainer(world, new BlockPos((int) x, (int) y, (int) z), container.getItem(i), null,
ConfigRegistry.QUESTION_SPAWNS_MOBS.get(), ConfigRegistry.QUESTION_SPAWNS_POWER_UPS.get(),
TagRegistry.QUESTION_BLOCK_CANNOT_SPAWN);
Expand All @@ -90,9 +94,8 @@ else if (container.getItem(i).getItem() instanceof MinecartItem)
marioverse$playMinecartSound(world, new BlockPos((int) x, (int) y, (int) z));
else marioverse$playItemSound(world, new BlockPos((int) x, (int) y, (int) z));

for (int j = 0; j < stackCount; j++) {
for (int j = 0; j < stackCount; j++)
questionBE.removeItems();
}
}
}
}
Expand Down

0 comments on commit 76d5d21

Please sign in to comment.