Compare commits

...

2 Commits

Author SHA1 Message Date
TheBrokenRail 9dde7b4288 1.0.4
EnergonRelics/pipeline/head This commit looks good Details
2020-09-10 19:10:56 -04:00
TheBrokenRail 40de5445d1 1.0.3
EnergonRelics/pipeline/head This commit looks good Details
2020-09-06 10:41:30 -04:00
4 changed files with 29 additions and 12 deletions

View File

@ -1,5 +1,11 @@
# Changelog
**1.0.4**
* Fix Crash When Sneak-Using Dye On A Block
**1.0.3**
* Fix Gravity Crash
**1.0.2**
* Attempt To Fix Structure Generation Crash

View File

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

View File

@ -106,15 +106,17 @@ public class PhaseShifterBlock extends EnergyBlock {
UseBlockCallback.EVENT.register((player, world, hand, hit) -> {
if (!player.isSpectator() && player.shouldCancelInteraction()) {
BlockState state = world.getBlockState(hit.getBlockPos());
ItemStack stack = player.getStackInHand(hand);
if (stack.getItem() instanceof DyeItem) {
DyeColor newColor = ((DyeItem) stack.getItem()).getColor();
if (state.get(PhaseShifterBlock.COLOR) != newColor) {
world.setBlockState(hit.getBlockPos(), state.with(PhaseShifterBlock.COLOR, newColor));
if (!player.isCreative()) {
stack.decrement(1);
if (state.getBlock() == PhaseShifterBlock.this) {
ItemStack stack = player.getStackInHand(hand);
if (stack.getItem() instanceof DyeItem) {
DyeColor newColor = ((DyeItem) stack.getItem()).getColor();
if (state.get(PhaseShifterBlock.COLOR) != newColor) {
world.setBlockState(hit.getBlockPos(), state.with(PhaseShifterBlock.COLOR, newColor));
if (!player.isCreative()) {
stack.decrement(1);
}
return ActionResult.SUCCESS;
}
return ActionResult.SUCCESS;
}
}
}

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.config.HardcodedConfig;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.MinecraftServer;
@ -26,6 +27,8 @@ import java.util.function.Predicate;
public abstract class MixinEntity implements PortalCooldownEntity {
@Unique
private int energyPortalCooldown = 0;
@Unique
private boolean touchingBeam = false;
@Shadow
public abstract Box getBoundingBox();
@ -53,7 +56,8 @@ public abstract class MixinEntity implements PortalCooldownEntity {
for (int q = k; q < l; ++q) {
for (int r = m; r < n; ++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();
return true;
}
@ -71,7 +75,7 @@ public abstract class MixinEntity implements PortalCooldownEntity {
@Inject(at = @At("HEAD"), method = "hasNoGravity", cancellable = true)
public void hasNoGravity(CallbackInfoReturnable<Boolean> info) {
if (!saving && isTouching(block -> block instanceof BeamBlock)) {
if (!saving && touchingBeam) {
info.setReturnValue(true);
}
}
@ -92,8 +96,13 @@ public abstract class MixinEntity implements PortalCooldownEntity {
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")
public void tick(CallbackInfo info) {
public void tickReturn(CallbackInfo info) {
energyPortalCooldown--;
}