Skip to content

Commit

Permalink
Merge pull request #2455 from shermanflima/trunk/1.20.1
Browse files Browse the repository at this point in the history
Fix Dormant Creeper Spore Charm Issues #2419 and #2454
  • Loading branch information
Lothrazar authored Jan 6, 2025
2 parents 8f5bb80 + 9d50d6f commit 7d41fa2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;

import static com.lothrazar.cyclic.block.BlockCyclic.LIT;

public class TileInsertingMagnet extends TileBlockEntityCyclic {

private static final double ENTITY_PULL_DIST = 0.2; //closer than this and nothing happens
Expand All @@ -38,15 +40,17 @@ public void saveAdditional(CompoundTag tag) {
}

public static void serverTick(Level level, BlockPos blockPos, BlockState blockState, TileInsertingMagnet e) {
Set<Item> filter = new HashSet<>(); // TODO: filter from DATACARD if present
final int radius = BlockMagnetPanel.RADIUS.get();
int vradius = 0;
int x = blockPos.getX();
int y = blockPos.getY();
int z = blockPos.getZ();
AABB axisalignedbb = (new AABB(x, y, z, x + 1, y + 1, z + 1)).inflate(radius, vradius, radius);
List<ItemEntity> list = level.getEntitiesOfClass(ItemEntity.class, axisalignedbb);
pullEntityList(x + 0.5, y + 0.1, z + 0.5, true, list, filter);
if(blockState.getValue(LIT)) {
Set<Item> filter = new HashSet<>(); // TODO: filter from DATACARD if present
final int radius = BlockMagnetPanel.RADIUS.get();
int vradius = 0;
int x = blockPos.getX();
int y = blockPos.getY();
int z = blockPos.getZ();
AABB axisalignedbb = (new AABB(x, y, z, x + 1, y + 1, z + 1)).inflate(radius, vradius, radius);
List<ItemEntity> list = level.getEntitiesOfClass(ItemEntity.class, axisalignedbb);
pullEntityList(x + 0.5, y + 0.1, z + 0.5, true, list, filter);
}
}

public static int pullEntityList(double x, double y, double z, boolean towardsPos, List<ItemEntity> all, Set<Item> filter) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/lothrazar/cyclic/event/ItemEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public void onPotionAddedEvent(MobEffectEvent.Added event) {
public void onEntityDamage(LivingDamageEvent event) {
DamageSource src = event.getSource();
if (event.getEntity() instanceof Player player) {
if (src.is(DamageTypes.EXPLOSION)) {
if (src.is(DamageTypes.PLAYER_EXPLOSION)) {
//explosion thingy
this.damageFinder(event, player, ItemRegistry.CHARM_CREEPER.get(), 0);
}
Expand Down

0 comments on commit 7d41fa2

Please sign in to comment.