mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-08-10 17:55:44 +00:00
augh
This commit is contained in:
parent
06e5e7eaa2
commit
660a4beacc
@ -2359,7 +2359,7 @@ public class ModBlocks {
|
||||
wand_structure = new BlockWandStructure().setBlockName("wand_structure");
|
||||
|
||||
logic_block = new LogicBlock().setBlockName("logic_block").setBlockTextureName(RefStrings.MODID + ":logic_block");
|
||||
logic_block_invis = new LogicBlock().setBlockName("logic_block_invis").setBlockTextureName(RefStrings.MODID + ":logic_block");
|
||||
logic_block_invis = new LogicBlockInvis().setBlockName("logic_block_invis").setBlockTextureName(RefStrings.MODID + ":logic_block");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -220,9 +220,7 @@ public class BlockWandLogic extends BlockContainer implements ILookOverlay, IToo
|
||||
public int placedRotation;
|
||||
|
||||
Block disguise;
|
||||
int disguiseMeta = -1;
|
||||
|
||||
boolean invisible = false;
|
||||
int disguiseMeta = 0;
|
||||
|
||||
public String actionID = "FODDER_WAVE";
|
||||
public String conditionID = "PLAYER_CUBE_5";
|
||||
@ -241,29 +239,31 @@ public class BlockWandLogic extends BlockContainer implements ILookOverlay, IToo
|
||||
}
|
||||
|
||||
private void replace() {
|
||||
if (!(worldObj.getBlock(xCoord, yCoord, zCoord) instanceof BlockWandLogic)) {
|
||||
MainRegistry.logger.warn("Somehow the block at: " + xCoord + ", " + yCoord + ", " + zCoord + " isn't a logic block but we're doing a TE update as if it is, cancelling!");
|
||||
return;
|
||||
}
|
||||
if(!worldObj.isRemote) {
|
||||
if (!(worldObj.getBlock(xCoord, yCoord, zCoord) instanceof BlockWandLogic)) {
|
||||
MainRegistry.logger.warn("Somehow the block at: " + xCoord + ", " + yCoord + ", " + zCoord + " isn't a logic block but we're doing a TE update as if it is, cancelling!");
|
||||
return;
|
||||
}
|
||||
|
||||
worldObj.setBlock(xCoord,yCoord,zCoord, disguise == null ? ModBlocks.logic_block_invis : ModBlocks.logic_block);
|
||||
worldObj.setBlock(xCoord, yCoord, zCoord, disguise == null ? ModBlocks.logic_block_invis : ModBlocks.logic_block, 0, 3);
|
||||
|
||||
TileEntity te = worldObj.getTileEntity(xCoord, yCoord, zCoord);
|
||||
TileEntity te = worldObj.getTileEntity(xCoord, yCoord, zCoord);
|
||||
|
||||
if(te == null || te instanceof BlockWandLoot.TileEntityWandLoot) {
|
||||
MainRegistry.logger.warn("TE for logic block set incorrectly at: " + xCoord + ", " + yCoord + ", " + zCoord + ". If you're using some sort of world generation mod, report it to the author!");
|
||||
te = ModBlocks.wand_logic.createTileEntity(worldObj, 0);
|
||||
worldObj.setTileEntity(xCoord, yCoord, zCoord, te);
|
||||
}
|
||||
if (te == null || te instanceof BlockWandLoot.TileEntityWandLoot) {
|
||||
MainRegistry.logger.warn("TE for logic block set incorrectly at: " + xCoord + ", " + yCoord + ", " + zCoord + ". If you're using some sort of world generation mod, report it to the author!");
|
||||
te = ModBlocks.wand_logic.createTileEntity(worldObj, 0);
|
||||
worldObj.setTileEntity(xCoord, yCoord, zCoord, te);
|
||||
}
|
||||
|
||||
if(te instanceof LogicBlock.TileEntityLogicBlock){
|
||||
LogicBlock.TileEntityLogicBlock logic = (LogicBlock.TileEntityLogicBlock) te;
|
||||
logic.actionID = actionID;
|
||||
logic.conditionID = conditionID;
|
||||
logic.interactionID = interactionID;
|
||||
logic.direction = ForgeDirection.getOrientation(placedRotation);
|
||||
logic.disguise = disguise;
|
||||
logic.disguiseMeta = disguiseMeta;
|
||||
if (te instanceof LogicBlock.TileEntityLogicBlock) {
|
||||
LogicBlock.TileEntityLogicBlock logic = (LogicBlock.TileEntityLogicBlock) te;
|
||||
logic.actionID = actionID;
|
||||
logic.conditionID = conditionID;
|
||||
logic.interactionID = interactionID;
|
||||
logic.direction = ForgeDirection.getOrientation(placedRotation);
|
||||
logic.disguise = disguise;
|
||||
logic.disguiseMeta = disguiseMeta;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import com.hbm.blocks.IBlockSideRotation;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.world.gen.util.LogicBlockActions;
|
||||
import com.hbm.world.gen.util.LogicBlockConditions;
|
||||
@ -51,15 +52,14 @@ public class LogicBlock extends BlockContainer {
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return this != ModBlocks.logic_block_invis;
|
||||
}
|
||||
this == ModBlocks.logic_block_invis ? -1 :
|
||||
}*/
|
||||
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return this == ModBlocks.logic_block_invis ? -1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, int x, int y, int z, EntityPlayer player, int side, float subX, float subY, float subZ) {
|
||||
@ -95,6 +95,9 @@ public class LogicBlock extends BlockContainer {
|
||||
public EntityPlayer player;
|
||||
|
||||
public ForgeDirection direction = ForgeDirection.UNKNOWN;
|
||||
|
||||
boolean disguised = false;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
@ -121,8 +124,14 @@ public class LogicBlock extends BlockContainer {
|
||||
timer++;
|
||||
}
|
||||
}
|
||||
if(!disguised){
|
||||
markDirty();
|
||||
worldObj.markBlockForUpdate(xCoord,yCoord,zCoord);
|
||||
disguised = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
21
src/main/java/com/hbm/blocks/generic/LogicBlockInvis.java
Normal file
21
src/main/java/com/hbm/blocks/generic/LogicBlockInvis.java
Normal file
@ -0,0 +1,21 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import com.hbm.blocks.IBlockSideRotation;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class LogicBlockInvis extends LogicBlock{
|
||||
|
||||
public LogicBlockInvis() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -393,8 +393,6 @@ public class LogicBlockActions {
|
||||
int y = tile.yCoord;
|
||||
int z = tile.zCoord;
|
||||
|
||||
ForgeDirection parallel = tile.direction.getRotation(ForgeDirection.UP);
|
||||
|
||||
if(tile.phase == 0 && !world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y - 2, z + 1).expand(3, 3, 3)).isEmpty()){
|
||||
world.getClosestPlayer(x,y,z, 300).addChatMessage(new ChatComponentText(
|
||||
EnumChatFormatting.LIGHT_PURPLE + "[POWER LOCK]" +
|
||||
@ -402,11 +400,17 @@ public class LogicBlockActions {
|
||||
tile.phase++;
|
||||
|
||||
TileEntityLockableBase safe = null;
|
||||
if(world.getTileEntity(x - parallel.offsetX,y,z) instanceof TileEntityLockableBase)
|
||||
safe = (TileEntityLockableBase) world.getTileEntity(x,y,z - parallel.offsetX);
|
||||
if(safe != null){
|
||||
|
||||
for (int i1 = 0; i1 < 6; ++i1) {
|
||||
if (world.getTileEntity(x + Facing.offsetsXForSide[i1], y + Facing.offsetsYForSide[i1], z + Facing.offsetsZForSide[i1]) instanceof TileEntityLockableBase) {
|
||||
safe = (TileEntityLockableBase) world.getTileEntity(x + Facing.offsetsXForSide[i1], y + Facing.offsetsYForSide[i1], z + Facing.offsetsZForSide[i1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (safe != null) {
|
||||
safe.setPins(world.rand.nextInt(999));
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@ -70,8 +71,12 @@ public class LogicBlockInteractions {
|
||||
IEnergyHandlerMK2 handler = null;
|
||||
ForgeDirection parallel = logic.direction.getRotation(ForgeDirection.UP);
|
||||
|
||||
if(world.getTileEntity(x,y + 1,z) instanceof IEnergyHandlerMK2)
|
||||
handler = (IEnergyHandlerMK2) world.getTileEntity(x,y + 1,z);
|
||||
for (int i1 = 0; i1 < 6; ++i1) {
|
||||
if(world.getTileEntity(x + Facing.offsetsXForSide[i1], y + Facing.offsetsYForSide[i1], z + Facing.offsetsZForSide[i1]) instanceof IEnergyHandlerMK2) {
|
||||
handler = (IEnergyHandlerMK2) world.getTileEntity(x + Facing.offsetsXForSide[i1], y + Facing.offsetsYForSide[i1], z + Facing.offsetsZForSide[i1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(handler == null || !(handler.getPower() > 500_000))
|
||||
player.addChatMessage(new ChatComponentText(
|
||||
@ -83,9 +88,12 @@ public class LogicBlockInteractions {
|
||||
EnumChatFormatting.RESET + " Power Restorted! Safe Unlocked!"));
|
||||
|
||||
TileEntityLockableBase safe = null;
|
||||
if(world.getTileEntity(x - parallel.offsetX,y,z) instanceof TileEntityLockableBase)
|
||||
safe = (TileEntityLockableBase) world.getTileEntity(x - parallel.offsetX,y,z);
|
||||
|
||||
for (int i1 = 0; i1 < 6; ++i1) {
|
||||
if (world.getTileEntity(x + Facing.offsetsXForSide[i1], y + Facing.offsetsYForSide[i1], z + Facing.offsetsZForSide[i1]) instanceof TileEntityLockableBase) {
|
||||
safe = (TileEntityLockableBase) world.getTileEntity(x + Facing.offsetsXForSide[i1], y + Facing.offsetsYForSide[i1], z + Facing.offsetsZForSide[i1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(safe != null){
|
||||
safe.unlock();
|
||||
world.playSoundAtEntity(player, "hbm:block.lockOpen", 3.0F, 0.8F);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user