mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
proxy tiles work with re-eval, network debugger item
This commit is contained in:
parent
27b9948b2b
commit
7cb0bec184
@ -5,6 +5,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +53,7 @@ public interface IEnergyConductor extends IEnergyConnector {
|
|||||||
* Each link has to decide what other links will join the same net.
|
* Each link has to decide what other links will join the same net.
|
||||||
* @param copy
|
* @param copy
|
||||||
*/
|
*/
|
||||||
public default void reevaluate(HashMap<Integer, IEnergyConductor> copy) {
|
public default void reevaluate(HashMap<Integer, IEnergyConductor> copy, HashMap<Integer, Integer> proxies) {
|
||||||
|
|
||||||
for(int[] pos : getConnectionPoints()) {
|
for(int[] pos : getConnectionPoints()) {
|
||||||
int newX = pos[0];
|
int newX = pos[0];
|
||||||
@ -62,12 +63,37 @@ public interface IEnergyConductor extends IEnergyConnector {
|
|||||||
|
|
||||||
IEnergyConductor neighbor = copy.get(id);
|
IEnergyConductor neighbor = copy.get(id);
|
||||||
|
|
||||||
if(neighbor != null && neighbor.getPowerNet() != null && this.canReevaluate() && neighbor.canReevaluate()) {
|
if(neighbor == null) {
|
||||||
|
Integer newId = proxies.get(id);
|
||||||
|
|
||||||
if(this.getPowerNet() == null) {
|
if(newId != null) {
|
||||||
neighbor.getPowerNet().joinLink(this);
|
neighbor = copy.get(newId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(neighbor != null && this.canReevaluate() && neighbor.canReevaluate()) {
|
||||||
|
|
||||||
|
if(neighbor.getPowerNet() != null) {
|
||||||
|
|
||||||
|
//neighbor net and no self net
|
||||||
|
if(this.getPowerNet() == null) {
|
||||||
|
neighbor.getPowerNet().joinLink(this);
|
||||||
|
//neighbor net and self net
|
||||||
|
} else {
|
||||||
|
this.getPowerNet().joinNetworks(neighbor.getPowerNet());
|
||||||
|
}
|
||||||
|
|
||||||
|
//bidirectional re-eval, experimental and technically optional, only useful as a fallback
|
||||||
} else {
|
} else {
|
||||||
this.getPowerNet().joinNetworks(neighbor.getPowerNet());
|
|
||||||
|
//no neighbor net and no self net
|
||||||
|
if(this.getPowerNet() == null) {
|
||||||
|
this.setPowerNet(new PowerNet().joinLink(this));
|
||||||
|
neighbor.setPowerNet(this.getPowerNet().joinLink(neighbor));
|
||||||
|
//no neighbor net and self net
|
||||||
|
} else {
|
||||||
|
neighbor.setPowerNet(this.getPowerNet().joinLink(neighbor));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,4 +140,10 @@ public interface IEnergyConductor extends IEnergyConnector {
|
|||||||
|
|
||||||
return this.getPowerNet().transferPower(power);
|
return this.getPowerNet().transferPower(power);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public default Vec3 getDebugParticlePos() {
|
||||||
|
TileEntity te = (TileEntity) this;
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(te.xCoord + 0.5, te.yCoord + 1.5, te.zCoord + 0.5);
|
||||||
|
return vec;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
package api.hbm.energy;
|
package api.hbm.energy;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.hbm.packet.AuxParticlePacketNT;
|
import com.hbm.packet.AuxParticlePacketNT;
|
||||||
import com.hbm.packet.PacketDispatcher;
|
import com.hbm.packet.PacketDispatcher;
|
||||||
|
|
||||||
@ -94,4 +97,20 @@ public interface IEnergyConnector extends ILoadedTile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final boolean particleDebug = false;
|
public static final boolean particleDebug = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the conductor has mutliblock proxies which need to be taken into consideration for re-eval.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public default boolean hasProxies() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the identities (position-based) of proxies which resolve into the conductor's own identity.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public default List<Integer> getProxies() {
|
||||||
|
return new ArrayList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ public class PowerNet implements IPowerNet {
|
|||||||
|
|
||||||
private boolean valid = true;
|
private boolean valid = true;
|
||||||
private HashMap<Integer, IEnergyConductor> links = new HashMap();
|
private HashMap<Integer, IEnergyConductor> links = new HashMap();
|
||||||
|
private HashMap<Integer, Integer> proxies = new HashMap();
|
||||||
private List<IEnergyConnector> subscribers = new ArrayList();
|
private List<IEnergyConnector> subscribers = new ArrayList();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -42,14 +43,29 @@ public class PowerNet implements IPowerNet {
|
|||||||
conductor.getPowerNet().leaveLink(conductor);
|
conductor.getPowerNet().leaveLink(conductor);
|
||||||
|
|
||||||
conductor.setPowerNet(this);
|
conductor.setPowerNet(this);
|
||||||
this.links.put(conductor.getIdentity(), conductor);
|
int identity = conductor.getIdentity();
|
||||||
|
this.links.put(identity, conductor);
|
||||||
|
|
||||||
|
if(conductor.hasProxies()) {
|
||||||
|
for(Integer i : conductor.getProxies()) {
|
||||||
|
this.proxies.put(i, identity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void leaveLink(IEnergyConductor conductor) {
|
public void leaveLink(IEnergyConductor conductor) {
|
||||||
conductor.setPowerNet(null);
|
conductor.setPowerNet(null);
|
||||||
this.links.remove(conductor.getIdentity());
|
int identity = conductor.getIdentity();
|
||||||
|
this.links.remove(identity);
|
||||||
|
|
||||||
|
if(conductor.hasProxies()) {
|
||||||
|
for(Integer i : conductor.getProxies()) {
|
||||||
|
this.proxies.remove(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -74,6 +90,11 @@ public class PowerNet implements IPowerNet {
|
|||||||
return linkList;
|
return linkList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashMap<Integer, Integer> getProxies() {
|
||||||
|
HashMap<Integer, Integer> proxyCopy = new HashMap(proxies);
|
||||||
|
return proxyCopy;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IEnergyConnector> getSubscribers() {
|
public List<IEnergyConnector> getSubscribers() {
|
||||||
return this.subscribers;
|
return this.subscribers;
|
||||||
@ -143,8 +164,9 @@ public class PowerNet implements IPowerNet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reevaluate() {
|
public void reevaluate() {
|
||||||
|
|
||||||
HashMap<Integer, IEnergyConductor> copy = new HashMap(links);
|
HashMap<Integer, IEnergyConductor> copy = new HashMap(links);
|
||||||
|
HashMap<Integer, Integer> proxyCopy = new HashMap(proxies);
|
||||||
|
|
||||||
for(IEnergyConductor link : copy.values()) {
|
for(IEnergyConductor link : copy.values()) {
|
||||||
this.leaveLink(link);
|
this.leaveLink(link);
|
||||||
@ -153,7 +175,7 @@ public class PowerNet implements IPowerNet {
|
|||||||
for(IEnergyConductor link : copy.values()) {
|
for(IEnergyConductor link : copy.values()) {
|
||||||
|
|
||||||
link.setPowerNet(null);
|
link.setPowerNet(null);
|
||||||
link.reevaluate(copy);
|
link.reevaluate(copy, proxyCopy);
|
||||||
|
|
||||||
if(link.getPowerNet() == null) {
|
if(link.getPowerNet() == null) {
|
||||||
link.setPowerNet(new PowerNet().joinLink(link));
|
link.setPowerNet(new PowerNet().joinLink(link));
|
||||||
|
|||||||
@ -471,6 +471,8 @@ public class ModBlocks {
|
|||||||
public static Block fallout;
|
public static Block fallout;
|
||||||
public static Block foam_layer;
|
public static Block foam_layer;
|
||||||
public static Block sand_boron_layer;
|
public static Block sand_boron_layer;
|
||||||
|
public static Block leaves_layer;
|
||||||
|
|
||||||
|
|
||||||
public static Block sellafield_slaked;
|
public static Block sellafield_slaked;
|
||||||
public static Block sellafield_0;
|
public static Block sellafield_0;
|
||||||
@ -1677,6 +1679,7 @@ public class ModBlocks {
|
|||||||
fallout = new BlockFallout(Material.snow).setBlockName("fallout").setStepSound(Block.soundTypeGravel).setCreativeTab(MainRegistry.blockTab).setHardness(0.1F).setLightOpacity(0).setBlockTextureName(RefStrings.MODID + ":ash");
|
fallout = new BlockFallout(Material.snow).setBlockName("fallout").setStepSound(Block.soundTypeGravel).setCreativeTab(MainRegistry.blockTab).setHardness(0.1F).setLightOpacity(0).setBlockTextureName(RefStrings.MODID + ":ash");
|
||||||
foam_layer = new BlockLayering(Material.snow).setBlockName("foam_layer").setStepSound(Block.soundTypeSnow).setCreativeTab(MainRegistry.blockTab).setHardness(0.1F).setLightOpacity(0).setBlockTextureName(RefStrings.MODID + ":foam");
|
foam_layer = new BlockLayering(Material.snow).setBlockName("foam_layer").setStepSound(Block.soundTypeSnow).setCreativeTab(MainRegistry.blockTab).setHardness(0.1F).setLightOpacity(0).setBlockTextureName(RefStrings.MODID + ":foam");
|
||||||
sand_boron_layer = new BlockLayering(Material.sand).setBlockName("sand_boron_layer").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.1F).setLightOpacity(0).setBlockTextureName(RefStrings.MODID + ":sand_boron");
|
sand_boron_layer = new BlockLayering(Material.sand).setBlockName("sand_boron_layer").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.1F).setLightOpacity(0).setBlockTextureName(RefStrings.MODID + ":sand_boron");
|
||||||
|
leaves_layer = new BlockLayering(Material.leaves).setBlockName("leaves_layer").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.1F).setLightOpacity(0).setBlockTextureName(RefStrings.MODID + ":waste_leaves");
|
||||||
|
|
||||||
burning_earth = new WasteEarth(Material.ground, true).setBlockName("burning_earth").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.blockTab).setHardness(0.6F).setBlockTextureName(RefStrings.MODID + ":burning_earth");
|
burning_earth = new WasteEarth(Material.ground, true).setBlockName("burning_earth").setStepSound(Block.soundTypeGrass).setCreativeTab(MainRegistry.blockTab).setHardness(0.6F).setBlockTextureName(RefStrings.MODID + ":burning_earth");
|
||||||
tektite = new BlockGeneric(Material.sand).setBlockName("tektite").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":tektite");
|
tektite = new BlockGeneric(Material.sand).setBlockName("tektite").setStepSound(Block.soundTypeSand).setCreativeTab(MainRegistry.blockTab).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":tektite");
|
||||||
@ -2707,6 +2710,7 @@ public class ModBlocks {
|
|||||||
GameRegistry.registerBlock(fallout, fallout.getUnlocalizedName());
|
GameRegistry.registerBlock(fallout, fallout.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(foam_layer, foam_layer.getUnlocalizedName());
|
GameRegistry.registerBlock(foam_layer, foam_layer.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(sand_boron_layer, sand_boron_layer.getUnlocalizedName());
|
GameRegistry.registerBlock(sand_boron_layer, sand_boron_layer.getUnlocalizedName());
|
||||||
|
GameRegistry.registerBlock(leaves_layer, leaves_layer.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(burning_earth, burning_earth.getUnlocalizedName());
|
GameRegistry.registerBlock(burning_earth, burning_earth.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(tektite, tektite.getUnlocalizedName());
|
GameRegistry.registerBlock(tektite, tektite.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(ore_tektite_osmiridium, ore_tektite_osmiridium.getUnlocalizedName());
|
GameRegistry.registerBlock(ore_tektite_osmiridium, ore_tektite_osmiridium.getUnlocalizedName());
|
||||||
|
|||||||
@ -2,9 +2,7 @@ package com.hbm.blocks.fluid;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.hbm.lib.ModDamageSource;
|
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.util.ArmorUtil;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -12,8 +10,6 @@ import net.minecraft.block.material.Material;
|
|||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.passive.EntitySquid;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -61,6 +57,7 @@ public class GenericFluidBlock extends BlockFluidClassic {
|
|||||||
flowingIcon = register.registerIcon(RefStrings.MODID + ":" + flowingName);
|
flowingIcon = register.registerIcon(RefStrings.MODID + ":" + flowingName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Only temporary, will be moved into a subclass */
|
||||||
@Override
|
@Override
|
||||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||||
|
|
||||||
|
|||||||
@ -1209,6 +1209,7 @@ public class ModItems {
|
|||||||
public static Item mirror_tool;
|
public static Item mirror_tool;
|
||||||
public static Item rbmk_tool;
|
public static Item rbmk_tool;
|
||||||
public static Item coltan_tool;
|
public static Item coltan_tool;
|
||||||
|
public static Item power_net_tool;
|
||||||
|
|
||||||
public static Item template_folder;
|
public static Item template_folder;
|
||||||
public static Item journal_pip;
|
public static Item journal_pip;
|
||||||
@ -2388,6 +2389,7 @@ public class ModItems {
|
|||||||
public static Item bucket_acid;
|
public static Item bucket_acid;
|
||||||
public static Item bucket_toxic;
|
public static Item bucket_toxic;
|
||||||
public static Item bucket_schrabidic_acid;
|
public static Item bucket_schrabidic_acid;
|
||||||
|
public static Item bucket_sulfuric_acid;
|
||||||
|
|
||||||
public static Item door_metal;
|
public static Item door_metal;
|
||||||
public static Item door_office;
|
public static Item door_office;
|
||||||
@ -4732,6 +4734,7 @@ public class ModItems {
|
|||||||
mirror_tool = new ItemMirrorTool().setUnlocalizedName("mirror_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":mirror_tool");
|
mirror_tool = new ItemMirrorTool().setUnlocalizedName("mirror_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":mirror_tool");
|
||||||
rbmk_tool = new ItemRBMKTool().setUnlocalizedName("rbmk_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":rbmk_tool");
|
rbmk_tool = new ItemRBMKTool().setUnlocalizedName("rbmk_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":rbmk_tool");
|
||||||
coltan_tool = new ItemColtanCompass().setUnlocalizedName("coltan_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":coltass");
|
coltan_tool = new ItemColtanCompass().setUnlocalizedName("coltan_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":coltass");
|
||||||
|
power_net_tool = new ItemPowerNetTool().setUnlocalizedName("power_net_tool").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":power_net_tool");
|
||||||
|
|
||||||
key = new ItemKey().setUnlocalizedName("key").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":key");
|
key = new ItemKey().setUnlocalizedName("key").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":key");
|
||||||
key_red = new ItemCustomLore().setUnlocalizedName("key_red").setMaxStackSize(1).setCreativeTab(null).setTextureName(RefStrings.MODID + ":key_red");
|
key_red = new ItemCustomLore().setUnlocalizedName("key_red").setMaxStackSize(1).setCreativeTab(null).setTextureName(RefStrings.MODID + ":key_red");
|
||||||
@ -5472,6 +5475,7 @@ public class ModItems {
|
|||||||
bucket_acid = new ItemModBucket(ModBlocks.acid_block).setUnlocalizedName("bucket_acid").setContainerItem(Items.bucket).setCreativeTab(MainRegistry.blockTab).setTextureName(RefStrings.MODID + ":bucket_acid");
|
bucket_acid = new ItemModBucket(ModBlocks.acid_block).setUnlocalizedName("bucket_acid").setContainerItem(Items.bucket).setCreativeTab(MainRegistry.blockTab).setTextureName(RefStrings.MODID + ":bucket_acid");
|
||||||
bucket_toxic = new ItemModBucket(ModBlocks.toxic_block).setUnlocalizedName("bucket_toxic").setContainerItem(Items.bucket).setCreativeTab(MainRegistry.blockTab).setTextureName(RefStrings.MODID + ":bucket_toxic");
|
bucket_toxic = new ItemModBucket(ModBlocks.toxic_block).setUnlocalizedName("bucket_toxic").setContainerItem(Items.bucket).setCreativeTab(MainRegistry.blockTab).setTextureName(RefStrings.MODID + ":bucket_toxic");
|
||||||
bucket_schrabidic_acid = new ItemModBucket(ModBlocks.schrabidic_block).setUnlocalizedName("bucket_schrabidic_acid").setContainerItem(Items.bucket).setCreativeTab(MainRegistry.blockTab).setTextureName(RefStrings.MODID + ":bucket_schrabidic_acid");
|
bucket_schrabidic_acid = new ItemModBucket(ModBlocks.schrabidic_block).setUnlocalizedName("bucket_schrabidic_acid").setContainerItem(Items.bucket).setCreativeTab(MainRegistry.blockTab).setTextureName(RefStrings.MODID + ":bucket_schrabidic_acid");
|
||||||
|
bucket_sulfuric_acid = new ItemModBucket(ModBlocks.sulfuric_acid_block).setUnlocalizedName("bucket_sulfuric_acid").setContainerItem(Items.bucket).setCreativeTab(MainRegistry.blockTab).setTextureName(RefStrings.MODID + ":bucket_sulfuric_acid");
|
||||||
|
|
||||||
door_metal = new ItemModDoor().setUnlocalizedName("door_metal").setCreativeTab(MainRegistry.blockTab).setTextureName(RefStrings.MODID + ":door_metal");
|
door_metal = new ItemModDoor().setUnlocalizedName("door_metal").setCreativeTab(MainRegistry.blockTab).setTextureName(RefStrings.MODID + ":door_metal");
|
||||||
door_office = new ItemModDoor().setUnlocalizedName("door_office").setCreativeTab(MainRegistry.blockTab).setTextureName(RefStrings.MODID + ":door_office");
|
door_office = new ItemModDoor().setUnlocalizedName("door_office").setCreativeTab(MainRegistry.blockTab).setTextureName(RefStrings.MODID + ":door_office");
|
||||||
@ -5621,6 +5625,7 @@ public class ModItems {
|
|||||||
BucketHandler.INSTANCE.buckets.put(ModBlocks.acid_block, ModItems.bucket_acid);
|
BucketHandler.INSTANCE.buckets.put(ModBlocks.acid_block, ModItems.bucket_acid);
|
||||||
BucketHandler.INSTANCE.buckets.put(ModBlocks.toxic_block, ModItems.bucket_toxic);
|
BucketHandler.INSTANCE.buckets.put(ModBlocks.toxic_block, ModItems.bucket_toxic);
|
||||||
BucketHandler.INSTANCE.buckets.put(ModBlocks.schrabidic_block, ModItems.bucket_schrabidic_acid);
|
BucketHandler.INSTANCE.buckets.put(ModBlocks.schrabidic_block, ModItems.bucket_schrabidic_acid);
|
||||||
|
BucketHandler.INSTANCE.buckets.put(ModBlocks.sulfuric_acid_block, ModItems.bucket_sulfuric_acid);
|
||||||
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
|
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6838,6 +6843,7 @@ public class ModItems {
|
|||||||
GameRegistry.registerItem(mirror_tool, mirror_tool.getUnlocalizedName());
|
GameRegistry.registerItem(mirror_tool, mirror_tool.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(rbmk_tool, rbmk_tool.getUnlocalizedName());
|
GameRegistry.registerItem(rbmk_tool, rbmk_tool.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(coltan_tool, coltan_tool.getUnlocalizedName());
|
GameRegistry.registerItem(coltan_tool, coltan_tool.getUnlocalizedName());
|
||||||
|
GameRegistry.registerItem(power_net_tool, power_net_tool.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(dosimeter, dosimeter.getUnlocalizedName());
|
GameRegistry.registerItem(dosimeter, dosimeter.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(geiger_counter, geiger_counter.getUnlocalizedName());
|
GameRegistry.registerItem(geiger_counter, geiger_counter.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(digamma_diagnostic, digamma_diagnostic.getUnlocalizedName());
|
GameRegistry.registerItem(digamma_diagnostic, digamma_diagnostic.getUnlocalizedName());
|
||||||
@ -8003,6 +8009,7 @@ public class ModItems {
|
|||||||
GameRegistry.registerItem(bucket_acid, bucket_acid.getUnlocalizedName());
|
GameRegistry.registerItem(bucket_acid, bucket_acid.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(bucket_toxic, bucket_toxic.getUnlocalizedName());
|
GameRegistry.registerItem(bucket_toxic, bucket_toxic.getUnlocalizedName());
|
||||||
GameRegistry.registerItem(bucket_schrabidic_acid, bucket_schrabidic_acid.getUnlocalizedName());
|
GameRegistry.registerItem(bucket_schrabidic_acid, bucket_schrabidic_acid.getUnlocalizedName());
|
||||||
|
GameRegistry.registerItem(bucket_sulfuric_acid, bucket_sulfuric_acid.getUnlocalizedName());
|
||||||
|
|
||||||
//Door Items
|
//Door Items
|
||||||
GameRegistry.registerItem(door_metal, door_metal.getUnlocalizedName());
|
GameRegistry.registerItem(door_metal, door_metal.getUnlocalizedName());
|
||||||
|
|||||||
81
src/main/java/com/hbm/items/tool/ItemPowerNetTool.java
Normal file
81
src/main/java/com/hbm/items/tool/ItemPowerNetTool.java
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
package com.hbm.items.tool;
|
||||||
|
|
||||||
|
import com.hbm.blocks.BlockDummyable;
|
||||||
|
import com.hbm.packet.AuxParticlePacketNT;
|
||||||
|
import com.hbm.packet.PacketDispatcher;
|
||||||
|
import com.hbm.util.ChatBuilder;
|
||||||
|
|
||||||
|
import api.hbm.energy.IEnergyConductor;
|
||||||
|
import api.hbm.energy.IPowerNet;
|
||||||
|
import api.hbm.energy.PowerNet;
|
||||||
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class ItemPowerNetTool extends Item {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) {
|
||||||
|
|
||||||
|
Block b = world.getBlock(x, y, z);
|
||||||
|
|
||||||
|
if(b instanceof BlockDummyable) {
|
||||||
|
int[] pos = ((BlockDummyable) b).findCore(world, x, y, z);
|
||||||
|
|
||||||
|
if(pos != null) {
|
||||||
|
x = pos[0];
|
||||||
|
y = pos[1];
|
||||||
|
z = pos[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
|
if(!(te instanceof IEnergyConductor))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(world.isRemote)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
IEnergyConductor con = (IEnergyConductor) te;
|
||||||
|
IPowerNet net = con.getPowerNet();
|
||||||
|
|
||||||
|
if(net == null) {
|
||||||
|
player.addChatComponentMessage(ChatBuilder.start("Error: No network found! This should be impossible!").color(EnumChatFormatting.RED).flush());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(net instanceof PowerNet)) {
|
||||||
|
player.addChatComponentMessage(ChatBuilder.start("Error: Cannot print diagnostic for non-standard power net implementation!").color(EnumChatFormatting.RED).flush());
|
||||||
|
}
|
||||||
|
|
||||||
|
PowerNet network = (PowerNet) net;
|
||||||
|
String id = Integer.toHexString(net.hashCode());
|
||||||
|
|
||||||
|
player.addChatComponentMessage(ChatBuilder.start("Start of diagnostic for network" + id).color(EnumChatFormatting.GOLD).flush());
|
||||||
|
player.addChatComponentMessage(ChatBuilder.start("Links: " + network.getLinks().size()).color(EnumChatFormatting.YELLOW).flush());
|
||||||
|
player.addChatComponentMessage(ChatBuilder.start("Proxies: " + network.getProxies().size()).color(EnumChatFormatting.YELLOW).flush());
|
||||||
|
player.addChatComponentMessage(ChatBuilder.start("Subscribers: " + network.getSubscribers().size()).color(EnumChatFormatting.YELLOW).flush());
|
||||||
|
player.addChatComponentMessage(ChatBuilder.start("End of diagnostic for network" + id).color(EnumChatFormatting.GOLD).flush());
|
||||||
|
|
||||||
|
for(IEnergyConductor link : network.getLinks()) {
|
||||||
|
Vec3 pos = link.getDebugParticlePos();
|
||||||
|
|
||||||
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setString("type", "text");
|
||||||
|
data.setInteger("color", 0xffff00);
|
||||||
|
data.setFloat("scale", 0.5F);
|
||||||
|
data.setString("text", id);
|
||||||
|
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, pos.xCoord, pos.yCoord, pos.zCoord), new TargetPoint(world.provider.dimensionId, pos.xCoord, pos.yCoord, pos.zCoord, 20));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1571,6 +1571,15 @@ public class ClientProxy extends ServerProxy {
|
|||||||
if("amat".equals(type)) {
|
if("amat".equals(type)) {
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleAmatFlash(world, x, y, z, data.getFloat("scale")));
|
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleAmatFlash(world, x, y, z, data.getFloat("scale")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if("debug".equals(type)) {
|
||||||
|
String t = data.getString("text");
|
||||||
|
int color = data.getInteger("color");
|
||||||
|
float scale = data.getFloat("scale");
|
||||||
|
ParticleText text = new ParticleText(world, x, y, z, color, t);
|
||||||
|
text.multipleParticleScaleBy(scale);
|
||||||
|
Minecraft.getMinecraft().effectRenderer.addEffect(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<Integer, Long> vanished = new HashMap();
|
private HashMap<Integer, Long> vanished = new HashMap();
|
||||||
|
|||||||
64
src/main/java/com/hbm/particle/ParticleText.java
Normal file
64
src/main/java/com/hbm/particle/ParticleText.java
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
package com.hbm.particle;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.particle.EntityFX;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class ParticleText extends EntityFX {
|
||||||
|
|
||||||
|
int color;
|
||||||
|
String text;
|
||||||
|
|
||||||
|
public ParticleText(World world, double x, double y, double z, int color, String text) {
|
||||||
|
super(world, x, y, z);
|
||||||
|
this.particleMaxAge = 30;
|
||||||
|
this.color = color;
|
||||||
|
this.text = text;
|
||||||
|
|
||||||
|
this.motionY = 0.1D;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFXLayer() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderParticle(Tessellator tess, float interp, float x, float y, float z, float tx, float tz) {
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 0.0F);
|
||||||
|
RenderHelper.disableStandardItemLighting();
|
||||||
|
|
||||||
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
FontRenderer font = mc.fontRenderer;
|
||||||
|
|
||||||
|
this.rotationYaw = -mc.thePlayer.rotationYaw;
|
||||||
|
this.rotationPitch = mc.thePlayer.rotationPitch;
|
||||||
|
|
||||||
|
float pX = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) interp - interpPosX);
|
||||||
|
float pY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) interp - interpPosY);
|
||||||
|
float pZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) interp - interpPosZ);
|
||||||
|
|
||||||
|
GL11.glTranslatef(pX, pY, pZ);
|
||||||
|
GL11.glRotatef(this.rotationYaw, 0.0F, 1.0F, 0.0F);
|
||||||
|
GL11.glRotatef(this.rotationPitch, 1.0F, 0.0F, 0.0F);
|
||||||
|
GL11.glScalef(-1.0F, -1.0F, 1.0F);
|
||||||
|
|
||||||
|
GL11.glScaled(particleScale, particleScale, particleScale);
|
||||||
|
|
||||||
|
font.drawStringWithShadow(text, -(int) (font.getStringWidth(text) * 0.5F), -(int) (font.FONT_HEIGHT * 0.5F), color);
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
|
GL11.glPolygonOffset(0.0F, 0.0F);
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,3 @@
|
|||||||
package com.hbm.saveddata.satellites;
|
package com.hbm.saveddata.satellites;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
public class SatelliteLunarMiner extends SatelliteMiner { }
|
||||||
|
|
||||||
public class SatelliteLunarMiner extends SatelliteMiner {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,5 +1,8 @@
|
|||||||
package com.hbm.tileentity;
|
package com.hbm.tileentity;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import api.hbm.energy.IEnergyConductor;
|
import api.hbm.energy.IEnergyConductor;
|
||||||
import api.hbm.energy.IPowerNet;
|
import api.hbm.energy.IPowerNet;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
@ -68,4 +71,17 @@ public class TileEntityProxyConductor extends TileEntityProxyBase implements IEn
|
|||||||
((IEnergyConductor)te).setPowerNet(network);
|
((IEnergyConductor)te).setPowerNet(network);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<int[]> getConnectionPoints() {
|
||||||
|
|
||||||
|
/*TileEntity te = this.getTE();
|
||||||
|
|
||||||
|
if(te instanceof IEnergyConductor) {
|
||||||
|
return ((IEnergyConductor)te).getConnectionPoints();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/* Proxy TE doesn't need to implement proxying here because the conductor main TE already has a network-specific proxying system */
|
||||||
|
return new ArrayList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,8 +3,6 @@ package com.hbm.tileentity.network;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import api.hbm.energy.IEnergyConductor;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.hbm.blocks.BlockDummyable;
|
import com.hbm.blocks.BlockDummyable;
|
||||||
|
|
||||||
|
import api.hbm.energy.IEnergyConductor;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
|
|
||||||
public class TileEntitySubstation extends TileEntityPylonBase {
|
public class TileEntitySubstation extends TileEntityPylonBase {
|
||||||
@ -58,4 +59,19 @@ public class TileEntitySubstation extends TileEntityPylonBase {
|
|||||||
pos.add(new int[] {xCoord + 1, yCoord, zCoord - 2});
|
pos.add(new int[] {xCoord + 1, yCoord, zCoord - 2});
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasProxies() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Integer> getProxies() {
|
||||||
|
List<Integer> proxies = new ArrayList();
|
||||||
|
proxies.add(IEnergyConductor.getIdentityFromPos(xCoord + 1, yCoord, zCoord + 1));
|
||||||
|
proxies.add(IEnergyConductor.getIdentityFromPos(xCoord + 1, yCoord, zCoord - 1));
|
||||||
|
proxies.add(IEnergyConductor.getIdentityFromPos(xCoord - 1, yCoord, zCoord + 1));
|
||||||
|
proxies.add(IEnergyConductor.getIdentityFromPos(xCoord - 1, yCoord, zCoord - 1));
|
||||||
|
return proxies;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,11 @@ public class ChatBuilder {
|
|||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ChatBuilder startTranslation(String text) {
|
||||||
|
ChatBuilder builder = new ChatBuilder("").nextTranslation(text);
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
public ChatBuilder next(String text) {
|
public ChatBuilder next(String text) {
|
||||||
ChatComponentText append = new ChatComponentText(text);
|
ChatComponentText append = new ChatComponentText(text);
|
||||||
this.last.appendSibling(append);
|
this.last.appendSibling(append);
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 425 B |
BIN
src/main/resources/assets/hbm/textures/items/power_net_tool.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/power_net_tool.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 321 B |
Loading…
x
Reference in New Issue
Block a user