mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-02-24 15:00:48 +00:00
to whom it may concern: my nuts hang
This commit is contained in:
parent
0056f06473
commit
8d7b039d79
@ -22,6 +22,7 @@ import com.hbm.blocks.network.*;
|
||||
import com.hbm.blocks.rail.*;
|
||||
import com.hbm.blocks.test.*;
|
||||
import com.hbm.blocks.turret.*;
|
||||
import com.hbm.hrist.BlockConduit;
|
||||
import com.hbm.items.block.*;
|
||||
import com.hbm.items.bomb.ItemPrototypeBlock;
|
||||
import com.hbm.items.special.ItemOreBlock;
|
||||
@ -1235,6 +1236,8 @@ public class ModBlocks {
|
||||
public static Block logic_block;
|
||||
|
||||
public static Material materialGas = new MaterialGas();
|
||||
|
||||
public static Block conduit_straight;
|
||||
|
||||
private static void initializeBlock() {
|
||||
|
||||
@ -2387,6 +2390,7 @@ public class ModBlocks {
|
||||
|
||||
logic_block = new LogicBlock().setBlockName("logic_block").setBlockTextureName(RefStrings.MODID + ":logic_block");
|
||||
|
||||
conduit_straight = new BlockConduit().setBlockName("conduit_straight").setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
}
|
||||
|
||||
private static void registerBlock() {
|
||||
@ -3540,6 +3544,8 @@ public class ModBlocks {
|
||||
register(wand_structure);
|
||||
|
||||
register(logic_block);
|
||||
|
||||
register(conduit_straight);
|
||||
}
|
||||
|
||||
private static void register(Block b) {
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
package com.hbm.hrist;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.hrist.ConduitPiece.ConnectionDefinition;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
// you can think of it like a pipeline
|
||||
public class BlockConduit extends BlockDummyable {
|
||||
@ -13,23 +18,39 @@ public class BlockConduit extends BlockDummyable {
|
||||
super(Material.ground);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getDimensions() {
|
||||
return new int[] {0, 0, 2, 2, 1, 0};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
return 2;
|
||||
}
|
||||
@Override public TileEntity createNewTileEntity(World world, int meta) { return null; }
|
||||
@Override public int[] getDimensions() { return new int[] {0, 0, 2, 2, 1, 0}; }
|
||||
@Override public int getOffset() { return 2; }
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(meta >= 12) {
|
||||
ConduitPiece piece = this.getPiece(world, x, y, z, meta);
|
||||
ConduitSpace.pushPiece(world, piece, new BlockPos(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block b, int meta) {
|
||||
super.breakBlock(world, x, y, z, b, meta);
|
||||
|
||||
if(meta >= 12) {
|
||||
ConduitSpace.popPiece(world, new BlockPos(x, y, z));
|
||||
}
|
||||
}
|
||||
|
||||
public ConduitPiece getPiece(World world, int x, int y, int z, int meta) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(meta - 10);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||
DirPos d0 = new DirPos(
|
||||
x + 0.5 + rot.offsetX * 0.5 + dir.offsetX * 2.5, y,
|
||||
z + 0.5 + rot.offsetZ * 0.5 + dir.offsetZ * 2.5, dir);
|
||||
DirPos d1 = new DirPos(
|
||||
x + 0.5 + rot.offsetX * 0.5 - dir.offsetX * 2.5, y,
|
||||
z + 0.5 + rot.offsetZ * 0.5 - dir.offsetZ * 2.5, dir.getOpposite());
|
||||
return new ConduitPiece(new ConnectionDefinition(d0, d1));
|
||||
}
|
||||
}
|
||||
|
||||
34
src/main/java/com/hbm/hrist/ConDbg.java
Normal file
34
src/main/java/com/hbm/hrist/ConDbg.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.hbm.hrist;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.hrist.ConduitSpace.ConduitWorld;
|
||||
import com.hbm.util.ParticleUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/** Test and debugging tools */
|
||||
public class ConDbg {
|
||||
|
||||
public static void debugVisualsWorld(World world) {
|
||||
|
||||
ConduitWorld cWorld = ConduitSpace.worlds.get(world);
|
||||
if(cWorld == null) return;
|
||||
|
||||
for(Entry<BlockPos, ConduitPiece> entry : cWorld.pieces.entrySet()) {
|
||||
|
||||
BlockPos pos = entry.getValue().definitions[0].connectors[0];
|
||||
BlockPos nex = entry.getValue().definitions[0].connectors[1];
|
||||
|
||||
double x = pos.getX();
|
||||
double y = pos.getY() + 0.5;
|
||||
double z = pos.getZ();
|
||||
double dx = nex.getX() - pos.getX();
|
||||
double dy = nex.getY() - pos.getY();
|
||||
double dz = nex.getZ() - pos.getZ();
|
||||
|
||||
ParticleUtil.spawnDroneLine(world, x, y, z, dx, dy, dz, 0xff0000, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5,7 +5,7 @@ public class ConduitConnection {
|
||||
|
||||
protected boolean valid = true;
|
||||
public ConduitConnection[] connectedTo = new ConduitConnection[2]; // a sausage always has two ends
|
||||
public int stateKeepAlive;
|
||||
public int stateKeepAlive; // unclear whether that's a good idea, since it requires the traveling object to be chunk loaded
|
||||
public ConnectionStatus state = ConnectionStatus.OKAY;
|
||||
|
||||
public boolean isValid() { return this.valid; }
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.hbm.hrist;
|
||||
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
// like a tile entity but without all the useless crap
|
||||
public class ConduitPiece {
|
||||
@ -29,14 +29,14 @@ public class ConduitPiece {
|
||||
public static class ConnectionDefinition {
|
||||
|
||||
public ConduitPiece parent;
|
||||
public BlockPos[] connectors = new BlockPos[2];
|
||||
public DirPos[] connectors = new DirPos[2];
|
||||
double distance;
|
||||
|
||||
public ConnectionDefinition(BlockPos start, BlockPos end) {
|
||||
public ConnectionDefinition(DirPos start, DirPos end) {
|
||||
this(start, end, start.distanceTo(end));
|
||||
}
|
||||
|
||||
public ConnectionDefinition(BlockPos start, BlockPos end, double distance) {
|
||||
public ConnectionDefinition(DirPos start, DirPos end, double distance) {
|
||||
this.connectors[0] = start;
|
||||
this.connectors[1] = end;
|
||||
this.distance = distance;
|
||||
|
||||
@ -3,11 +3,58 @@ package com.hbm.hrist;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.util.fauxpointtwelve.DimPos;
|
||||
import com.hbm.hrist.ConduitPiece.ConnectionDefinition;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/// ROBUR PER UNITATEM ///
|
||||
public class ConduitSpace {
|
||||
|
||||
/** Maps conduit core pos to the actual conduit piece logical unit */
|
||||
public static Map<DimPos, ConduitPiece> pieces = new HashMap();
|
||||
public static Map<World, ConduitWorld> worlds = new HashMap();
|
||||
|
||||
public static void pushPiece(World world, ConduitPiece piece, BlockPos core) {
|
||||
ConduitWorld cWorld = worlds.get(world);
|
||||
if(cWorld == null) {
|
||||
cWorld = new ConduitWorld();
|
||||
worlds.put(world, cWorld);
|
||||
}
|
||||
cWorld.push(piece, core);
|
||||
}
|
||||
|
||||
public static void popPiece(World world, BlockPos core) {
|
||||
ConduitWorld cWorld = worlds.get(world);
|
||||
if(cWorld == null) return;
|
||||
cWorld.pop(cWorld.pieces.get(core), core);
|
||||
}
|
||||
|
||||
public static class ConduitWorld {
|
||||
|
||||
/** Maps conduit core pos to the actual conduit piece logical unit, for access of the conduit blocks */
|
||||
public static Map<BlockPos, ConduitPiece> pieces = new HashMap();
|
||||
/** Maps a connection pos to a conduit piece, used for calculating connections */
|
||||
public static Map<DirPos, ConduitPiece> connections = new HashMap();
|
||||
|
||||
public void push(ConduitPiece piece, BlockPos core) {
|
||||
pieces.put(core, piece);
|
||||
|
||||
// for branches, there's some repetition in the keys, but we don't care about that
|
||||
// since this maps to the PIECE, not the CONNECTION
|
||||
for(ConnectionDefinition def : piece.definitions) {
|
||||
pieces.put(def.connectors[0], piece);
|
||||
pieces.put(def.connectors[1], piece);
|
||||
}
|
||||
}
|
||||
|
||||
public void pop(ConduitPiece piece, BlockPos core) {
|
||||
if(piece == null) return;
|
||||
pieces.remove(core);
|
||||
|
||||
for(ConnectionDefinition def : piece.definitions) {
|
||||
pieces.remove(def.connectors[0]);
|
||||
pieces.remove(def.connectors[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
On the menu:
|
||||
|
||||
R-Components
|
||||
* Connectors (i.e. a type of node)
|
||||
* Connections between their connectors with directionality
|
||||
* Connections unify into a Line, unless there is a branch
|
||||
* Branches need a certain type of node which is referenced in their Line for quick access
|
||||
|
||||
ColSys
|
||||
* The mechanism
|
||||
|
||||
DynComp
|
||||
* More or less dynamic system for producing arbitrary-shaped R-Comps
|
||||
* Even more local nodes for entity transformation
|
||||
* May god have merc on my soil
|
||||
|
||||
Other
|
||||
* Invent CL that doesn't suck balls
|
||||
* Pathing? Probably? I guess?
|
||||
* ow
|
||||
@ -1868,7 +1868,7 @@ public class ClientProxy extends ServerProxy {
|
||||
if("debugdrone".equals(type)) {
|
||||
Item held = player.getHeldItem() == null ? null : player.getHeldItem().getItem();
|
||||
|
||||
if(held == ModItems.drone ||
|
||||
if(data.getBoolean("showalways") || held == ModItems.drone ||
|
||||
held == Item.getItemFromBlock(ModBlocks.drone_crate_provider) ||
|
||||
held == Item.getItemFromBlock(ModBlocks.drone_crate_requester) ||
|
||||
held == Item.getItemFromBlock(ModBlocks.drone_dock) ||
|
||||
|
||||
@ -24,6 +24,7 @@ import com.hbm.handler.BobmazonOfferFactory;
|
||||
import com.hbm.handler.BossSpawnHandler;
|
||||
import com.hbm.handler.EntityEffectHandler;
|
||||
import com.hbm.hazard.HazardSystem;
|
||||
import com.hbm.hrist.ConDbg;
|
||||
import com.hbm.interfaces.IBomb;
|
||||
import com.hbm.interfaces.Spaghetti;
|
||||
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
||||
@ -610,6 +611,9 @@ public class ModEventHandler {
|
||||
}
|
||||
|
||||
EntityRailCarBase.updateMotion(event.world);
|
||||
|
||||
// Connection Debug Tools
|
||||
ConDbg.debugVisualsWorld(event.world);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +28,10 @@ public class ParticleUtil {
|
||||
}
|
||||
|
||||
public static void spawnDroneLine(World world, double x, double y, double z, double x0, double y0, double z0, int color) {
|
||||
spawnDroneLine(world, x, y, z, x0, y0, z0, color, false);
|
||||
}
|
||||
|
||||
public static void spawnDroneLine(World world, double x, double y, double z, double x0, double y0, double z0, int color, boolean showalways) {
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "debugdrone");
|
||||
@ -35,6 +39,7 @@ public class ParticleUtil {
|
||||
data.setDouble("mY", y0);
|
||||
data.setDouble("mZ", z0);
|
||||
data.setInteger("color", color);
|
||||
if(showalways) data.setBoolean("showalways", showalways);
|
||||
if(world.isRemote) {
|
||||
data.setDouble("posX", x);
|
||||
data.setDouble("posY", y);
|
||||
|
||||
@ -33,7 +33,6 @@ public class DirPos extends BlockPos {
|
||||
}
|
||||
}
|
||||
|
||||
public ForgeDirection getDir() {
|
||||
return this.dir;
|
||||
}
|
||||
public ForgeDirection getDir() { return this.dir; }
|
||||
public BlockPos toPos() { return new BlockPos(x, y, z); }
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user