1.0.3
All checks were successful
EnergonRelics/pipeline/head This commit looks good

This commit is contained in:
TheBrokenRail 2020-09-06 10:41:30 -04:00
parent 643e287e23
commit 40de5445d1
3 changed files with 16 additions and 4 deletions

View File

@ -1,5 +1,8 @@
# Changelog # Changelog
**1.0.3**
* Fix Gravity Crash
**1.0.2** **1.0.2**
* Attempt To Fix Structure Generation Crash * Attempt To Fix Structure Generation Crash

View File

@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
fabric_loader_version = 0.9.2+build.206 fabric_loader_version = 0.9.2+build.206
# Mod Properties # Mod Properties
mod_version = 1.0.2 mod_version = 1.0.3
maven_group = com.thebrokenrail maven_group = com.thebrokenrail
# Dependencies # Dependencies

View File

@ -5,6 +5,7 @@ import com.thebrokenrail.energonrelics.block.forcefield.util.BeamBlock;
import com.thebrokenrail.energonrelics.block.portal.PortalCooldownEntity; import com.thebrokenrail.energonrelics.block.portal.PortalCooldownEntity;
import com.thebrokenrail.energonrelics.config.HardcodedConfig; import com.thebrokenrail.energonrelics.config.HardcodedConfig;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@ -26,6 +27,8 @@ import java.util.function.Predicate;
public abstract class MixinEntity implements PortalCooldownEntity { public abstract class MixinEntity implements PortalCooldownEntity {
@Unique @Unique
private int energyPortalCooldown = 0; private int energyPortalCooldown = 0;
@Unique
private boolean touchingBeam = false;
@Shadow @Shadow
public abstract Box getBoundingBox(); public abstract Box getBoundingBox();
@ -53,7 +56,8 @@ public abstract class MixinEntity implements PortalCooldownEntity {
for (int q = k; q < l; ++q) { for (int q = k; q < l; ++q) {
for (int r = m; r < n; ++r) { for (int r = m; r < n; ++r) {
pos.set(p, q, r); pos.set(p, q, r);
if (test.test(getEntityWorld().getBlockState(pos).getBlock())) { BlockState state = getEntityWorld().getBlockState(pos);
if (state.getCollisionShape(getEntityWorld(), pos).isEmpty() && test.test(state.getBlock())) {
getEntityWorld().getProfiler().pop(); getEntityWorld().getProfiler().pop();
return true; return true;
} }
@ -71,7 +75,7 @@ public abstract class MixinEntity implements PortalCooldownEntity {
@Inject(at = @At("HEAD"), method = "hasNoGravity", cancellable = true) @Inject(at = @At("HEAD"), method = "hasNoGravity", cancellable = true)
public void hasNoGravity(CallbackInfoReturnable<Boolean> info) { public void hasNoGravity(CallbackInfoReturnable<Boolean> info) {
if (!saving && isTouching(block -> block instanceof BeamBlock)) { if (!saving && touchingBeam) {
info.setReturnValue(true); info.setReturnValue(true);
} }
} }
@ -92,8 +96,13 @@ public abstract class MixinEntity implements PortalCooldownEntity {
energyPortalCooldown = tag.getInt(EnergonRelics.NAMESPACE + ":EnergyPortalCooldown"); energyPortalCooldown = tag.getInt(EnergonRelics.NAMESPACE + ":EnergyPortalCooldown");
} }
@Inject(at = @At("HEAD"), method = "tick")
public void tickHead(CallbackInfo info) {
touchingBeam = isTouching(block -> block instanceof BeamBlock);
}
@Inject(at = @At("RETURN"), method = "tick") @Inject(at = @At("RETURN"), method = "tick")
public void tick(CallbackInfo info) { public void tickReturn(CallbackInfo info) {
energyPortalCooldown--; energyPortalCooldown--;
} }