Compare commits

..

4 Commits

Author SHA1 Message Date
9dde7b4288 1.0.4
All checks were successful
EnergonRelics/pipeline/head This commit looks good
2020-09-10 19:10:56 -04:00
40de5445d1 1.0.3
All checks were successful
EnergonRelics/pipeline/head This commit looks good
2020-09-06 10:41:30 -04:00
643e287e23 1.0.2
All checks were successful
EnergonRelics/pipeline/head This commit looks good
2020-08-31 19:19:54 -04:00
e5135deef1 Add Veridium Block To Beacon Base Blocks Tag
All checks were successful
EnergonRelics/pipeline/head This commit looks good
2020-08-30 19:10:33 -04:00
6 changed files with 58 additions and 21 deletions

View File

@ -1,5 +1,14 @@
# Changelog # 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
**1.0.1** **1.0.1**
* Add Advancements * Add Advancements
* Industrial Laser Can Smelt Nether Gold Ore * Industrial Laser Can Smelt Nether Gold Ore

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.1 mod_version = 1.0.4
maven_group = com.thebrokenrail maven_group = com.thebrokenrail
# Dependencies # Dependencies

View File

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

View File

@ -19,17 +19,23 @@ class StructureGeneratorPiece extends StructurePiece {
private final StructureGeneratorBlock block; private final StructureGeneratorBlock block;
private final BlockRotation rotation; private final BlockRotation rotation;
private final BlockPos pos; private final BlockPos pos;
private boolean placed;
StructureGeneratorPiece(StructureGeneratorBlock block, BlockRotation rotation, BlockPos pos) { private StructureGeneratorPiece(StructureGeneratorBlock block, BlockRotation rotation, BlockPos pos, boolean placed) {
super(block.piece, 0); super(block.piece, 0);
this.block = block; this.block = block;
this.rotation = rotation; this.rotation = rotation;
this.pos = pos; this.pos = pos;
this.placed = placed;
boundingBox = BlockBox.create(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); boundingBox = BlockBox.create(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1);
} }
StructureGeneratorPiece(StructureGeneratorBlock block, BlockRotation rotation, BlockPos pos) {
this(block, rotation, pos, false);
}
StructureGeneratorPiece(StructureGeneratorBlock block, CompoundTag tag) { StructureGeneratorPiece(StructureGeneratorBlock block, CompoundTag tag) {
this(block, BlockRotation.valueOf(tag.getString("Rot")), new BlockPos(tag.getInt("X"), tag.getInt("Y"), tag.getInt("Z"))); this(block, BlockRotation.valueOf(tag.getString("Rot")), new BlockPos(tag.getInt("X"), tag.getInt("Y"), tag.getInt("Z")), tag.getBoolean("Placed"));
} }
@Override @Override
@ -38,19 +44,24 @@ class StructureGeneratorPiece extends StructurePiece {
tag.putInt("X", pos.getX()); tag.putInt("X", pos.getX());
tag.putInt("Y", pos.getY()); tag.putInt("Y", pos.getY());
tag.putInt("Z", pos.getZ()); tag.putInt("Z", pos.getZ());
tag.putBoolean("Placed", placed);
} }
@Override @Override
public boolean generate(StructureWorldAccess world, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator, Random random, BlockBox boundingBox, ChunkPos chunkPos, BlockPos blockPos) { public boolean generate(StructureWorldAccess world, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator, Random random, BlockBox boundingBox, ChunkPos chunkPos, BlockPos blockPos) {
BlockState state = block.getDefaultState().rotate(rotation); if (!placed) {
BlockState state = block.getDefaultState().rotate(rotation);
world.setBlockState(pos, state, 3); world.setBlockState(pos, state, 3);
BlockEntity entity = world.getBlockEntity(pos); BlockEntity entity = world.getBlockEntity(pos);
if (entity instanceof StructureGeneratorBlockEntity) { if (entity instanceof StructureGeneratorBlockEntity) {
((StructureGeneratorBlockEntity) entity).setSeed(random.nextLong()); ((StructureGeneratorBlockEntity) entity).setSeed(random.nextLong());
}
block.schedule(world, pos);
placed = true;
} }
block.schedule(world, pos);
return true; return true;
} }
} }

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--;
} }

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"energonrelics:veridium_block"
]
}