Skip to content
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