Skip to content

Commit

Permalink
Revert "Fix entities sometimes spawning in chest, Closes #163"
Browse files Browse the repository at this point in the history
This reverts commit 143b480.

Closes #165
  • Loading branch information
rubensworks committed Jul 16, 2024
1 parent 9b42134 commit c7d1316
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 33 deletions.
11 changes: 0 additions & 11 deletions src/main/java/org/cyclops/colossalchests/block/ChestWall.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.core.Vec3i;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockAndTintGetter;
Expand All @@ -22,8 +21,6 @@
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.phys.BlockHitResult;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.entity.living.FinalizeSpawnEvent;
import org.cyclops.colossalchests.blockentity.BlockEntityColossalChest;
import org.cyclops.cyclopscore.block.multi.CubeDetector;
import org.cyclops.cyclopscore.helper.MinecraftHelpers;
Expand All @@ -47,14 +44,6 @@ public ChestWall(Block.Properties properties, ChestMaterial material) {

this.registerDefaultState(this.stateDefinition.any()
.setValue(ENABLED, false));
NeoForge.EVENT_BUS.addListener(this::onLivingSpawn);
}

public void onLivingSpawn(FinalizeSpawnEvent event) {
// Only isValidSpawn is insufficient in some cases, so we add this forceful check as well.
if (event.getSpawnType() != MobSpawnType.CHUNK_GENERATION && event.getEntity().getBlockStateOn().getBlock() == this) {
event.setSpawnCancelled(true);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import net.minecraft.world.InteractionResult;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockAndTintGetter;
Expand All @@ -42,8 +41,6 @@
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.entity.living.FinalizeSpawnEvent;
import org.cyclops.colossalchests.RegistryEntries;
import org.cyclops.colossalchests.blockentity.BlockEntityColossalChest;
import org.cyclops.cyclopscore.block.BlockWithEntityGui;
Expand All @@ -55,6 +52,7 @@
import org.cyclops.cyclopscore.helper.LocationHelpers;
import org.cyclops.cyclopscore.helper.MinecraftHelpers;
import org.cyclops.cyclopscore.inventory.SimpleInventory;
import org.spongepowered.asm.mixin.Interface;

import javax.annotation.Nullable;

Expand All @@ -79,14 +77,6 @@ public ColossalChest(Properties properties, ChestMaterial material) {

this.registerDefaultState(this.stateDefinition.any()
.setValue(ENABLED, false));
NeoForge.EVENT_BUS.addListener(this::onLivingSpawn);
}

public void onLivingSpawn(FinalizeSpawnEvent event) {
// Only isValidSpawn is insufficient in some cases, so we add this forceful check as well.
if (event.getSpawnType() != MobSpawnType.CHUNK_GENERATION && event.getEntity().getBlockStateOn().getBlock() == this) {
event.setSpawnCancelled(true);
}
}

@org.jetbrains.annotations.Nullable
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/org/cyclops/colossalchests/block/Interface.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import net.minecraft.core.Vec3i;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockAndTintGetter;
Expand All @@ -24,8 +23,6 @@
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.phys.BlockHitResult;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.entity.living.FinalizeSpawnEvent;
import org.cyclops.colossalchests.blockentity.BlockEntityColossalChest;
import org.cyclops.colossalchests.blockentity.BlockEntityInterface;
import org.cyclops.cyclopscore.block.BlockWithEntity;
Expand Down Expand Up @@ -54,16 +51,8 @@ public Interface(Block.Properties properties, ChestMaterial material) {

this.registerDefaultState(this.stateDefinition.any()
.setValue(ENABLED, false));
NeoForge.EVENT_BUS.addListener(this::onLivingSpawn);
}

public void onLivingSpawn(FinalizeSpawnEvent event) {
// Only isValidSpawn is insufficient in some cases, so we add this forceful check as well.
if (event.getSpawnType() != MobSpawnType.CHUNK_GENERATION && event.getEntity().getBlockStateOn().getBlock() == this) {
event.setSpawnCancelled(true);
}
}

@Override
public String getDescriptionId() {
String baseKey = super.getDescriptionId();
Expand Down

0 comments on commit c7d1316

Please sign in to comment.