Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Dormant Creeper Spore Charm Issues #2419 and #2454 #2455

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading