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
**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**
* Add Advancements
* 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
# Mod Properties
mod_version = 1.0.1
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

@ -19,17 +19,23 @@ class StructureGeneratorPiece extends StructurePiece {
private final StructureGeneratorBlock block;
private final BlockRotation rotation;
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);
this.block = block;
this.rotation = rotation;
this.pos = pos;
this.placed = placed;
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) {
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
@ -38,19 +44,24 @@ class StructureGeneratorPiece extends StructurePiece {
tag.putInt("X", pos.getX());
tag.putInt("Y", pos.getY());
tag.putInt("Z", pos.getZ());
tag.putBoolean("Placed", placed);
}
@Override
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);
BlockEntity entity = world.getBlockEntity(pos);
if (entity instanceof StructureGeneratorBlockEntity) {
((StructureGeneratorBlockEntity) entity).setSeed(random.nextLong());
world.setBlockState(pos, state, 3);
BlockEntity entity = world.getBlockEntity(pos);
if (entity instanceof StructureGeneratorBlockEntity) {
((StructureGeneratorBlockEntity) entity).setSeed(random.nextLong());
}
block.schedule(world, pos);
placed = true;
}
block.schedule(world, pos);
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.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--;
}

View File

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