Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Fix disappearing blocks + more lang
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Mar 5, 2023
1 parent 3dcb1b1 commit 48eced9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import com.brandon3055.draconicevolution.DEFeatures;
import com.brandon3055.draconicevolution.blocks.ParticleGenerator;
import com.brandon3055.draconicevolution.integration.funkylocomotion.IMovableStructure;
import com.brandon3055.draconicevolution.world.EnergyCoreStructure;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
Expand Down Expand Up @@ -83,13 +85,27 @@ public void revert() {
world.setBlockState(pos, DEFeatures.particleGenerator.getDefaultState().withProperty(ParticleGenerator.TYPE, "stabilizer"));
return;
}

Block block = Block.REGISTRY.getObject(new ResourceLocation(blockName));
if (block != Blocks.AIR) {
world.setBlockState(pos, block.getDefaultState());
Block block;
if (blockName.equals(EnergyCoreStructure.gtDraconiumName)){
if (EnergyCoreStructure.gtDraconium != null){
world.setBlockState(pos, EnergyCoreStructure.gtDraconium);
}
}
else {
world.setBlockToAir(pos);
if (blockName.equals(EnergyCoreStructure.gtAwakenedName)){
if (EnergyCoreStructure.gtAwakened != null){
Block awakenedBlock = EnergyCoreStructure.gtAwakened.getBlock();
world.setBlockState(pos, EnergyCoreStructure.gtAwakened);
}
}
else{
block = Block.REGISTRY.getObject(new ResourceLocation(blockName));

if (block != Blocks.AIR) {
world.setBlockState(pos, block.getDefaultState());
}
else {
world.setBlockToAir(pos);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import java.util.Objects;
import java.util.function.BiConsumer;

// Same as MultiblockStorage, but uses IBlockState instead of String, and has fallback block
Expand Down Expand Up @@ -50,7 +51,7 @@ public boolean checkStructure(World world, BlockPos startPos) {
if (!helper.checkBlock(blockStorage[x][y][z][0], world, pos.add(startPos))) {
if (!helper.checkBlock(blockStorage[x][y][z][1], world, pos.add(startPos))) {
helper.invalidBlock = startPos.add(pos);
helper.expectedBlock = blockStorage[x][y][z][0].getBlock().getLocalizedName();
helper.expectedBlock = Objects.requireNonNull(blockStorage[x][y][z][0].getBlock().getRegistryName()).toString();
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,12 @@ else if (flag == FLAG_FORME) {
world.setBlockState(pos, DEFeatures.invisECoreBlock.getDefaultState());
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileInvisECoreBlock) {
((TileInvisECoreBlock) tile).blockName = Objects.requireNonNull(state.getBlock().getRegistryName()).toString();
if (state == gtDraconium)
if (state.equals(gtDraconium))
((TileInvisECoreBlock) tile).blockName = gtDraconiumName;
if (state == gtAwakened)
if (state.equals(gtAwakened))
((TileInvisECoreBlock) tile).blockName = gtAwakenedName;
else
((TileInvisECoreBlock) tile).blockName = Objects.requireNonNull(state.getBlock().getRegistryName()).toString();
((TileInvisECoreBlock) tile).setController(core);
}
}
Expand Down

0 comments on commit 48eced9

Please sign in to comment.