From 9aabf5f65066aab8413ba47ce6c3aa18e1eb4f78 Mon Sep 17 00:00:00 2001 From: brandon3055 Date: Mon, 21 Sep 2015 09:52:10 +1000 Subject: [PATCH] Updated API --- build.gradle | 2 +- build.properties | 2 +- .../api/GeneratorOverride.java | 36 +++++ .../draconicevolution/api/package-info.java | 2 +- .../draconicevolution/client/ClientProxy.java | 4 +- .../client/model/ModelArmorOBJTest.java | 89 +++++++++++ .../client/model/ModelDraconicArmor.java | 3 +- .../client/model/ModelRenderOBJ.java | 139 ++++++++++++++++++ .../render/particle/ParticleEnergyBeam.java | 2 +- .../render/particle/ParticleReactorBeam.java | 8 +- .../client/render/particle/Particles.java | 8 +- .../tile/RenderTileEnergyStorageCore.java | 2 +- .../tile/RenderTileTeleporterStand.java | 2 +- .../common/blocks/multiblock/IIsSlave.java | 14 -- .../blocks/multiblock/IReactorPart.java | 30 ++++ .../multiblock/InvisibleMultiblock.java | 1 - .../multiblock/ReactorEnergyInjector.java | 29 ++++ .../blocks/multiblock/ReactorStabilizer.java | 39 ++++- .../common/entity/EntityChaosDrill.java | 2 +- .../common/entity/EntityChaosGuardian.java | 30 ++-- .../common/entity/EntityCustomDragon.java | 2 +- .../common/entity/EntityDragonHeart.java | 2 +- .../common/entity/EntityDragonProjectile.java | 6 +- .../common/entity/EntityEnderArrow.java | 2 +- .../handler/MinecraftForgeEventHandler.java | 2 +- .../common/tileentities/TileTestBlock.java | 4 +- .../energynet/TileRemoteEnergyBase.java | 2 +- .../TileWirelessEnergyTransceiver.java | 2 +- .../TileEnergyStorageCore.java | 5 + .../multiblocktiles/TilePortalBlock.java | 2 +- .../reactor/ReactorExplosion.java | 2 +- .../reactor/TileReactorCore.java | 45 +++++- .../reactor/TileReactorEnergyInjector.java | 36 ++++- .../reactor/TileReactorStabilizer.java | 35 ++++- .../common/world/ChaosWorldGenHandler.java | 4 +- .../common/world/DraconicWorldGenerator.java | 9 +- .../common/world/WorldGenChaosIsland.java | 6 +- .../assets/draconicevolution/lang/en_US.lang | 9 ++ 38 files changed, 534 insertions(+), 85 deletions(-) create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/model/ModelArmorOBJTest.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/client/model/ModelRenderOBJ.java delete mode 100644 src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IIsSlave.java create mode 100644 src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IReactorPart.java diff --git a/build.gradle b/build.gradle index 0f72fdd2..f0a5f15e 100644 --- a/build.gradle +++ b/build.gradle @@ -51,7 +51,7 @@ dependencies { compile "codechicken:CodeChickenLib:${config.minecraft_version}-${config.CCLIB_version}:dev" compile "codechicken:CodeChickenCore:${config.minecraft_version}-${config.ccc_version}:dev" compile "codechicken:NotEnoughItems:${config.minecraft_version}-${config.NEI_version}:dev" - + if (file('../BrandonsCore/').exists()) compile project('../BrandonsCore') } diff --git a/build.properties b/build.properties index ba67bec9..5fde08d2 100644 --- a/build.properties +++ b/build.properties @@ -1,6 +1,6 @@ minecraft_version=1.7.10 mod_version=1.0.2-Snapshot_3 -forge_version=10.13.3.1403-1.7.10 +forge_version=10.13.4.1492-1.7.10 CCLIB_version=1.1.1.99 NEI_version=1.0.3.74 ccc_version=1.0.4.29 diff --git a/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java b/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java index a124464f..f4463be2 100644 --- a/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java +++ b/src/main/java/com/brandon3055/draconicevolution/api/GeneratorOverride.java @@ -1,5 +1,8 @@ package com.brandon3055.draconicevolution.api; +import com.brandon3055.brandonscore.common.utills.DataUtills; +import com.brandon3055.draconicevolution.common.world.ChaosWorldGenHandler; +import com.brandon3055.draconicevolution.common.world.DraconicWorldGenerator; import com.brandon3055.draconicevolution.common.world.WorldGenEnderComet; import com.brandon3055.draconicevolution.common.world.WorldGenEnderIsland; import net.minecraft.world.World; @@ -11,11 +14,44 @@ import java.util.Random; */ public class GeneratorOverride { + /**Spawns a comet at the given x y z coordinates*/ public void spawnCometAt(World world, int x, int y, int z, Random rand) { new WorldGenEnderComet().generate(world, rand, x, y, z); } + /**This nolonger dose anything!*/ + @Deprecated public void spawnChaosIslendAt(World world, int x, int y, int z, Random rand) { new WorldGenEnderIsland().generate(world, rand, x, y, z); } + + /** + * This can be used to generate a chaos island at a given set of coordinates + * This method needs to be called foe every chunk in a 360 x 360 block area. + * Its ok to run it on a larger area it just wont do anything to chunks outside that area. + * + * @param chunkX the x pos of the chunk being generated (this is the xCoord divided by 16 not the xCoord itself) + * @param chunkZ the z pos of the chunk being generated (this is the zCoord divided by 16 not the zCoord itself) + * @param centerX this should be the center of the area you are spawning the island it (this is the actual xCoord) + * @param centerZ this should be the center of the area you are spawning the island it (this is the actual zCoord) + * @param random a random + * */ + public static void generateChaosChunk(World world, int chunkX, int chunkZ, int centerX, int centerZ, Random random){ + ChaosWorldGenHandler.generateChunk(world, chunkX, chunkZ, new DataUtills.XZPair(centerX, centerZ), random); + } + + /**Use this at startup to disable / re enable default chaos island generation*/ + public static void setChaosIslandsEnabled(boolean chaosIslandsEnabled) { + DraconicWorldGenerator.chaosIslandsEnabled = chaosIslandsEnabled; + } + + /**Use this at startup to disable / re enable default comet*/ + public static void setCometsEnabled(boolean cometsEnabled) { + DraconicWorldGenerator.cometsEnabled = cometsEnabled; + } + + /**Use this at startup to disable / re enable default draconium generation in the end*/ + public static void setOreEnabledInEnd(boolean cometsEnabled) { + DraconicWorldGenerator.oreEnabledInEnd = cometsEnabled; + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/api/package-info.java b/src/main/java/com/brandon3055/draconicevolution/api/package-info.java index e8f8fa4a..5fd88b21 100644 --- a/src/main/java/com/brandon3055/draconicevolution/api/package-info.java +++ b/src/main/java/com/brandon3055/draconicevolution/api/package-info.java @@ -1,7 +1,7 @@ /** * Created by Brandon on 19/03/2015. */ -@API(apiVersion = "1.1", owner = "DraconicEvolution", provides = "DraconicEvolution|API") +@API(apiVersion = "1.2", owner = "DraconicEvolution", provides = "DraconicEvolution|API") package com.brandon3055.draconicevolution.api; import cpw.mods.fml.common.API; \ No newline at end of file diff --git a/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java index fc8cf70b..a0de0d0f 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/ClientProxy.java @@ -22,7 +22,7 @@ import com.brandon3055.draconicevolution.client.render.tile.*; import com.brandon3055.draconicevolution.common.CommonProxy; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.ModItems; -import com.brandon3055.draconicevolution.common.blocks.multiblock.IIsSlave; +import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart; import com.brandon3055.draconicevolution.common.entity.*; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.lib.References; @@ -252,7 +252,7 @@ public class ClientProxy extends CommonProxy { @Override public ParticleReactorBeam reactorBeam(TileEntity tile, ParticleReactorBeam oldBeam, boolean render) { - if (!tile.getWorldObj().isRemote || !(tile instanceof IIsSlave)) return null; + if (!tile.getWorldObj().isRemote || !(tile instanceof IReactorPart)) return null; ParticleReactorBeam beam = oldBeam; boolean inRange = ParticleHandler.isInRange(tile.xCoord, tile.yCoord, tile.zCoord, 50); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelArmorOBJTest.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelArmorOBJTest.java new file mode 100644 index 00000000..973d65c5 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelArmorOBJTest.java @@ -0,0 +1,89 @@ +package com.brandon3055.draconicevolution.client.model; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + + +public class ModelArmorOBJTest extends ModelBiped { + + public ModelRenderer head; + public ModelRenderer body; + public ModelRenderer rightArm; + public ModelRenderer leftArm; + public ModelRenderer rightLeg; + public ModelRenderer leftLeg; + public ModelRenderer rightBoot; + public ModelRenderer leftBoot; + + + public ModelArmorOBJTest(float f, boolean isHelmet, boolean isChestPiece, boolean isLeggings, boolean isdBoots, boolean isDraconic) { + super(f, 0.0f, 128, 128); + + + this.bipedHead = new ModelRenderer(this, 0, 0); + this.bipedHead.setRotationPoint(0.0F, 0.0F, 0.0F); + this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.0F); + + this.head = new ModelRenderOBJ(this, null, null); + + this.bipedBody = new ModelRenderer(this, 16, 16); + this.bipedBody.setRotationPoint(0.0F, 0.0F, 0.0F); + this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, 0.0F); + + this.head = new ModelRenderOBJ(this, null, null); + + this.bipedLeftArm = new ModelRenderer(this, 40, 16); + this.bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F); + this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); + + this.head = new ModelRenderOBJ(this, null, null); + + this.bipedRightArm = new ModelRenderer(this, 40, 16); + this.bipedRightArm.setRotationPoint(-5.0F, 2.0F, 0.0F); + this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0.0F); + + this.head = new ModelRenderOBJ(this, null, null); + + this.bipedLeftLeg = new ModelRenderer(this, 0, 16); + this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F, 0.0F); + this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); + + this.head = new ModelRenderOBJ(this, null, null); + + this.bipedRightLeg = new ModelRenderer(this, 0, 16); + this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F, 0.0F); + this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, 0.0F); + + this.head = new ModelRenderOBJ(this, null, null); + + this.bipedHead.cubeList.clear(); + this.bipedHeadwear.cubeList.clear(); + this.bipedBody.cubeList.clear(); + this.bipedRightArm.cubeList.clear(); + this.bipedLeftArm.cubeList.clear(); + this.bipedLeftLeg.cubeList.clear(); + this.bipedRightLeg.cubeList.clear(); + + } + + @Override + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + this.bipedRightLeg.render(f5); + this.bipedBody.render(f5*1.05F);// * 1.1F); + this.bipedLeftArm.render(f5); + this.bipedRightArm.render(f5); + this.bipedLeftLeg.render(f5); + this.bipedHead.render(f5*1.05F); + } + + /** + * This is a helper function from Tabula to set the rotation of model parts + */ + public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) { + modelRenderer.rotateAngleX = x; + modelRenderer.rotateAngleY = y; + modelRenderer.rotateAngleZ = z; + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmor.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmor.java index c46e7f8b..cad94b32 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmor.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelDraconicArmor.java @@ -8,7 +8,7 @@ import net.minecraft.entity.Entity; * Draconic Armor.tcn - TechneToTabulaImporter * Created using Tabula 5.0.0 */ -public class ModelDraconicArmor extends ModelBiped { +public class ModelDraconicArmor extends ModelBiped {// // public ModelRenderer bipedHead; // public ModelRenderer bipedBody; // public ModelRenderer bipedRightArm; @@ -683,7 +683,6 @@ public class ModelDraconicArmor extends ModelBiped { @Override public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { setRotationAngles(f, f1, f2, f3, f4, f5, entity); - this.bipedRightLeg.render(f5); this.bipedBody.render(f5*1.05F);// * 1.1F); this.bipedLeftArm.render(f5); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/model/ModelRenderOBJ.java b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelRenderOBJ.java new file mode 100644 index 00000000..03d6153e --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/client/model/ModelRenderOBJ.java @@ -0,0 +1,139 @@ +package com.brandon3055.draconicevolution.client.model; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.model.AdvancedModelLoader; +import net.minecraftforge.client.model.IModelCustom; +import org.lwjgl.opengl.GL11; + +/** + * Created by brandon3055 on 16/9/2015. + */ +public class ModelRenderOBJ extends ModelRenderer { + private IModelCustom model; + private ResourceLocation texture; + + + public ModelRenderOBJ(ModelBase baseModel, ResourceLocation customModel, ResourceLocation texture) { + super(baseModel); + this.model = AdvancedModelLoader.loadModel(customModel); + this.texture = texture; + } + + @Override + public void render(float scale) { + if(!this.isHidden && this.showModel) { +// if(!this.compiled) { +// this.compileDisplayList(scale); +// } + + GL11.glTranslatef(this.offsetX, this.offsetY, this.offsetZ); + int i; + if(this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { + if(this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) { +// GL11.glCallList(this.displayList); +// if(this.childModels != null) { +// for(i = 0; i < this.childModels.size(); ++i) { +// ((ModelRenderer)this.childModels.get(i)).render(scale); +// } +// } + } else { + GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); +// GL11.glCallList(this.displayList); +// if(this.childModels != null) { +// for(i = 0; i < this.childModels.size(); ++i) { +// ((ModelRenderer)this.childModels.get(i)).render(scale); +// } +// } + + GL11.glTranslatef(-this.rotationPointX * scale, -this.rotationPointY * scale, -this.rotationPointZ * scale); + } + } else { + GL11.glPushMatrix(); + GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + if(this.rotateAngleZ != 0.0F) { + GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); + } + + if(this.rotateAngleY != 0.0F) { + GL11.glRotatef(this.rotateAngleY * 57.295776F, 0.0F, 1.0F, 0.0F); + } + + if(this.rotateAngleX != 0.0F) { + GL11.glRotatef(this.rotateAngleX * 57.295776F, 1.0F, 0.0F, 0.0F); + } + + + +// GL11.glCallList(this.displayList); +// if(this.childModels != null) { +// for(i = 0; i < this.childModels.size(); ++i) { +// ((ModelRenderer)this.childModels.get(i)).render(scale); +// } +// } + + GL11.glPopMatrix(); + } + + GL11.glTranslatef(-this.offsetX, -this.offsetY, -this.offsetZ); + } + + } + + @Override + public void renderWithRotation(float scale) { + if(!this.isHidden && this.showModel) { +// if(!this.compiled) { +// this.compileDisplayList(scale); +// } + + GL11.glPushMatrix(); + GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + if(this.rotateAngleY != 0.0F) { + GL11.glRotatef(this.rotateAngleY * 57.295776F, 0.0F, 1.0F, 0.0F); + } + + if(this.rotateAngleX != 0.0F) { + GL11.glRotatef(this.rotateAngleX * 57.295776F, 1.0F, 0.0F, 0.0F); + } + + if(this.rotateAngleZ != 0.0F) { + GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); + } + +// GL11.glCallList(this.displayList); + GL11.glPopMatrix(); + } + + } + + @Override + public void postRender(float scale) { + if(!this.isHidden && this.showModel) { +// if(!this.compiled) { +// this.compileDisplayList(scale); +// } + + if(this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) { + if(this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F) { + GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + } + } else { + GL11.glTranslatef(this.rotationPointX * scale, this.rotationPointY * scale, this.rotationPointZ * scale); + if(this.rotateAngleZ != 0.0F) { + GL11.glRotatef(this.rotateAngleZ * 57.295776F, 0.0F, 0.0F, 1.0F); + } + + if(this.rotateAngleY != 0.0F) { + GL11.glRotatef(this.rotateAngleY * 57.295776F, 0.0F, 1.0F, 0.0F); + } + + if(this.rotateAngleX != 0.0F) { + GL11.glRotatef(this.rotateAngleX * 57.295776F, 1.0F, 0.0F, 0.0F); + } + } + } + + } +} diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java index edba57a7..c14c98b4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleEnergyBeam.java @@ -66,7 +66,7 @@ public class ParticleEnergyBeam extends EntityFX { if (offsetMode > 0) { - double dist = Utills.getDistance(x, z, tX, tZ); + double dist = Utills.getDistanceAtoB(x, z, tX, tZ); if (dist == 0) dist = 0.1; double xDist = x - tX; double zDist = z - tZ; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleReactorBeam.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleReactorBeam.java index 1e2b0745..a22473cb 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleReactorBeam.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/ParticleReactorBeam.java @@ -1,7 +1,7 @@ package com.brandon3055.draconicevolution.client.render.particle; import com.brandon3055.draconicevolution.client.handler.ResourceHandler; -import com.brandon3055.draconicevolution.common.blocks.multiblock.IIsSlave; +import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector; @@ -60,7 +60,7 @@ public class ParticleReactorBeam extends EntityFX { @Override public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { - if (!((IIsSlave)tile).isActive()) return; + if (!((IReactorPart)tile).isActive()) return; tessellator.draw(); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_CULL_FACE); @@ -72,7 +72,7 @@ public class ParticleReactorBeam extends EntityFX { GL11.glTranslated((double)xx, (double)yy, (double)zz); //Common Fields - MultiblockHelper.TileLocation master = ((IIsSlave)tile).getMaster(); + MultiblockHelper.TileLocation master = ((IReactorPart)tile).getMaster(); float offsetX = (float)(master.posX - tile.xCoord); float offsetY = (float)((double)master.posY - tile.yCoord); float offsetZ = (float)(master.posZ - tile.zCoord); @@ -84,7 +84,7 @@ public class ParticleReactorBeam extends EntityFX { GL11.glRotatef((float) (-Math.atan2((double) offsetZ, (double) offsetX)) * 180.0F / (float) Math.PI - 90.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef((float)(-Math.atan2((double)f7, (double)offsetY)) * 180.0F / (float)Math.PI - 90.0F, 1.0F, 0.0F, 0.0F); - TileReactorCore reactor = ((IIsSlave)tile).getMaster().getTileEntity(worldObj) instanceof TileReactorCore ? (TileReactorCore) ((IIsSlave)tile).getMaster().getTileEntity(worldObj) : null; + TileReactorCore reactor = ((IReactorPart)tile).getMaster().getTileEntity(worldObj) instanceof TileReactorCore ? (TileReactorCore) ((IReactorPart)tile).getMaster().getTileEntity(worldObj) : null; if (tile instanceof TileReactorStabilizer && reactor != null) renderStabilizerEffect(tessellator, reactor, offsetX, offsetY, offsetZ, length, partialTick); else if (reactor != null){ diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java index ba3ca1c2..3c8dc8d8 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/particle/Particles.java @@ -586,8 +586,8 @@ public class Particles { //super.onUpdate(); if (particleAge >= particleMaxAge || this.getDistanceSq(targetX, targetY, targetZ) < 0.05) setDead(); - double d1 = Utills.getDistance(startX, startY, startZ, targetX, targetY, targetZ); - double d2 = Utills.getDistance(posX, posY, posZ, targetX, targetY, targetZ); + double d1 = Utills.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ); + double d2 = Utills.getDistanceAtoB(posX, posY, posZ, targetX, targetY, targetZ); particleScale = ((float) (d2 / d1)) * baseScale; particleAge ++; @@ -805,8 +805,8 @@ public class Particles { //super.onUpdate(); if (particleAge >= particleMaxAge) setDead(); // -// double d1 = Utills.getDistance(startX, startY, startZ, targetX, targetY, targetZ); -// double d2 = Utills.getDistance(posX, posY, posZ, targetX, targetY, targetZ); +// double d1 = Utills.getDistanceAtoB(startX, startY, startZ, targetX, targetY, targetZ); +// double d2 = Utills.getDistanceAtoB(posX, posY, posZ, targetX, targetY, targetZ); //particleScale = ((float) (d2 / d1)) * baseScale; particleAlpha = (1F - (float)((double)particleAge / particleMaxAge)); diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java index 48df09b1..fc960c25 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileEnergyStorageCore.java @@ -65,7 +65,7 @@ public class RenderTileEnergyStorageCore extends TileEntitySpecialRenderer {//to GL11.glTranslated(x+0.5, y+0.5, z+0.5); FMLClientHandler.instance().getClient().getTextureManager().bindTexture(iner_model_texture); - double colour = ((TileEnergyStorageCore) tile).getEnergyStored() / ((TileEnergyStorageCore) tile).getMaxEnergyStored(); + double colour = (double)((TileEnergyStorageCore) tile).getEnergyStored() / (double)((TileEnergyStorageCore) tile).getMaxEnergyStored(); float brightness = (float)Math.abs(Math.sin((float) Minecraft.getSystemTime() / 3000f) * 100f); colour = 1f - colour; diff --git a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java index fabebcea..5c053cc0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java +++ b/src/main/java/com/brandon3055/draconicevolution/client/render/tile/RenderTileTeleporterStand.java @@ -133,7 +133,7 @@ public class RenderTileTeleporterStand extends TileEntitySpecialRenderer{ double yDiff = player.posY - (tileentity.yCoord+0.5); double zDiff = player.posZ - (tileentity.zCoord+0.5); double yawAngle = Math.toDegrees(Math.atan2(zDiff, xDiff)); - double pitchAngle = Math.toDegrees(Math.atan2(yDiff, Utills.getDistance(player.posX, player.posY, player.posZ, tileentity.xCoord + 0.5, tileentity.yCoord + 0.5, tileentity.zCoord + 0.5))); + double pitchAngle = Math.toDegrees(Math.atan2(yDiff, Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, tileentity.xCoord + 0.5, tileentity.yCoord + 0.5, tileentity.zCoord + 0.5))); GL11.glRotated(yawAngle + 90 - rotation, 0, 1, 0); GL11.glRotated(-pitchAngle, 1, 0, 0); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IIsSlave.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IIsSlave.java deleted file mode 100644 index c3b9f38b..00000000 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IIsSlave.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.brandon3055.draconicevolution.common.blocks.multiblock; - -/** - * Created by Brandon on 23/7/2015. - */ -public interface IIsSlave { - public MultiblockHelper.TileLocation getMaster(); - - public void shutDown(); - - public boolean checkForMaster(); - - public boolean isActive(); -} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IReactorPart.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IReactorPart.java new file mode 100644 index 00000000..12e9a3f4 --- /dev/null +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/IReactorPart.java @@ -0,0 +1,30 @@ +package com.brandon3055.draconicevolution.common.blocks.multiblock; + +/** + * Created by Brandon on 23/7/2015. + */ +public interface IReactorPart { + public static int RMODE_TEMP = 0; + public static int RMODE_TEMP_INV = 1; + public static int RMODE_FIELD = 2; + public static int RMODE_FIELD_INV = 3; + public static int RMODE_SAT = 4; + public static int RMODE_SAT_INV = 5; + public static int RMODE_FUEL = 6; + public static int RMODE_FUEL_INV = 7; + + + public MultiblockHelper.TileLocation getMaster(); + + public void shutDown(); + + public boolean checkForMaster(); + + public boolean isActive(); + + public String getRedstoneModeString(); + + public void changeRedstoneMode(); + + public int getRedstoneMode(); +} diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java index 565b3808..14dc8031 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/InvisibleMultiblock.java @@ -107,7 +107,6 @@ public class InvisibleMultiblock extends BlockDE implements IHudDisplayBlock { world.markBlockForUpdate(master.xCoord, master.yCoord, master.zCoord); player.addChatComponentMessage(new ChatComponentText("Tier:" + (master.getTier() + 1))); String BN = String.valueOf(master.getEnergyStored()); - if (BN.substring(BN.length() - 2).contentEquals(".0")) BN = BN.substring(0, BN.length() - 2); player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("info.de.charge.txt") + ": " + Utills.formatNumber(master.getEnergyStored()) + " / " + Utills.formatNumber(master.getMaxEnergyStored()) + " [" + BN + " RF]")); } return true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorEnergyInjector.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorEnergyInjector.java index 4690647d..bef1d558 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorEnergyInjector.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorEnergyInjector.java @@ -5,14 +5,17 @@ import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.common.ModBlocks; import com.brandon3055.draconicevolution.common.blocks.BlockDE; import com.brandon3055.draconicevolution.common.lib.References; +import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorCore; import com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor.TileReactorEnergyInjector; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.ChatComponentText; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -88,6 +91,32 @@ public class ReactorEnergyInjector extends BlockDE { tile.facingDirection = ForgeDirection.getOrientation(d).getOpposite().ordinal(); tile.onPlaced(); } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart ? (IReactorPart)world.getTileEntity(x, y, z) : null; + if (tile != null) { + tile.changeRedstoneMode(); + if(!world.isRemote) player.addChatComponentMessage(new ChatComponentText(tile.getRedstoneModeString())); + return true; + } + return false; + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + @Override + public int getComparatorInputOverride(World world, int x, int y, int z, int p_149736_5_) { + IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart ? (IReactorPart)world.getTileEntity(x, y, z) : null; + if (tile == null) return 0; + TileReactorCore core = tile.getMaster().getTileEntity(world) instanceof TileReactorCore ? (TileReactorCore) tile.getMaster().getTileEntity(world) : null; + if (core != null) return core.getComparatorOutput(tile.getRedstoneMode()); + return 0; + } + @Override public boolean hasTileEntity(int metadata) { return true; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorStabilizer.java b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorStabilizer.java index cacfd8cc..068752bf 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorStabilizer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/blocks/multiblock/ReactorStabilizer.java @@ -15,6 +15,7 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -42,12 +43,24 @@ public class ReactorStabilizer extends BlockDE { @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { - TileReactorStabilizer tile = world.getTileEntity(x, y, z) instanceof TileReactorStabilizer ? (TileReactorStabilizer)world.getTileEntity(x, y, z) : null; - TileEntity core = null; - if (tile != null) core = tile.getMaster().getTileEntity(world); - if (core instanceof TileReactorCore){ - ((TileReactorCore) core).onStructureRightClicked(player); - return true; + if (!player.isSneaking()) + { + TileReactorStabilizer tile = world.getTileEntity(x, y, z) instanceof TileReactorStabilizer ? (TileReactorStabilizer) world.getTileEntity(x, y, z) : null; + TileEntity core = null; + if (tile != null) core = tile.getMaster().getTileEntity(world); + if (core instanceof TileReactorCore) + { + ((TileReactorCore) core).onStructureRightClicked(player); + return true; + } + } + else if (!world.isRemote){ + IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart ? (IReactorPart)world.getTileEntity(x, y, z) : null; + if (tile != null) { + tile.changeRedstoneMode(); + if(!world.isRemote) player.addChatComponentMessage(new ChatComponentText(tile.getRedstoneModeString())); + return true; + } } return false; } @@ -91,4 +104,18 @@ public class ReactorStabilizer extends BlockDE { super.breakBlock(world, x, y, z, p_149749_5_, p_149749_6_); if (core instanceof TileReactorCore) ((TileReactorCore) core).validateStructure(); } + + public boolean hasComparatorInputOverride() + { + return true; + } + + @Override + public int getComparatorInputOverride(World world, int x, int y, int z, int p_149736_5_) { + IReactorPart tile = world.getTileEntity(x, y, z) instanceof IReactorPart ? (IReactorPart)world.getTileEntity(x, y, z) : null; + if (tile == null) return 0; + TileReactorCore core = tile.getMaster().getTileEntity(world) instanceof TileReactorCore ? (TileReactorCore) tile.getMaster().getTileEntity(world) : null; + if (core != null) return core.getComparatorOutput(tile.getRedstoneMode()); + return 0; + } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java index f62c6756..d53e495b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosDrill.java @@ -74,7 +74,7 @@ public class EntityChaosDrill extends Entity { for( int x = (int)posX-r ; x <= (int)posX+r; x++){ for( int z = (int)posZ-r ; z <= (int)posZ+r; z++) { for (int y = (int)posY-r; y <= (int)posY+r; y++) { - int dist = (int) (Utills.getDistance(x, y, z, (int) posX, (int) posY, (int) posZ)); + int dist = (int) (Utills.getDistanceAtoB(x, y, z, (int) posX, (int) posY, (int) posZ)); if (dist <= r) { if (!worldObj.isAirBlock(x, y, z)) { if (blocks.size() <= dist) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java index 0eea80c8..b7d1866d 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityChaosGuardian.java @@ -124,7 +124,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio dataWatcher.updateObject(20, connectedCrystalID); updateTarget(); customAIUpdate(); - if (behaviour == EnumBehaviour.FIREBOMB && Utills.getDistance(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) moveSpeedMultiplier = 0; + if (behaviour == EnumBehaviour.FIREBOMB && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) moveSpeedMultiplier = 0; } if (this.getHealth() <= 0.0F) { @@ -188,7 +188,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio if (behaviour == EnumBehaviour.CIRCLE_PLAYER){ this.targetX = this.target.posX + (int)(Math.cos(circlePosition) * 60); this.targetZ = this.target.posZ + (int)(Math.sin(circlePosition) * 60); - moveSpeedMultiplier = 1F + Math.min(((float) Utills.getDistance(targetX, targetZ, posX, posZ) / 50) * 3F, 3F); + moveSpeedMultiplier = 1F + Math.min(((float) Utills.getDistanceAtoB(targetX, targetZ, posX, posZ) / 50) * 3F, 3F); }else { this.targetX = this.target.posX; this.targetZ = this.target.posZ; @@ -385,19 +385,19 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio break; case GO_HOME: - if (Utills.getDistance(posX, posZ, homeX, homeZ) < 70 ) selectNewBehaviour(); + if (Utills.getDistanceAtoB(posX, posZ, homeX, homeZ) < 70 ) selectNewBehaviour(); break; case GUARDING: break; case CHARGING: - if (Utills.getDistance(posX, posZ, homeX, homeZ) > 300) behaviour = EnumBehaviour.GO_HOME; + if (Utills.getDistanceAtoB(posX, posZ, homeX, homeZ) > 300) behaviour = EnumBehaviour.GO_HOME; break; case CIRCLE_PLAYER: circlePosition += (0.02F * circleDirection); - if (Utills.getDistance(posX, posZ, homeX, homeZ) > 300) behaviour = EnumBehaviour.GO_HOME; + if (Utills.getDistanceAtoB(posX, posZ, homeX, homeZ) > 300) behaviour = EnumBehaviour.GO_HOME; break; case LOW_HEALTH_STRATEGY: @@ -442,15 +442,15 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio private void updateAttack(){ if (worldObj.isRemote || getHealth() <= 0) return; - if (behaviour == EnumBehaviour.FIREBOMB && Utills.getDistance(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3){ + if (behaviour == EnumBehaviour.FIREBOMB && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3){ if (target == null || ticksExisted % 100 == 0) setNewTarget(); if (target != null){ - double distance = Utills.getDistance(target.posX, target.posZ, dragonPartHead.posX, dragonPartHead.posZ); - if (Utills.getDistance(target.posX, target.posZ, posX, posZ) < 5) distance *= -1; + double distance = Utills.getDistanceAtoB(target.posX, target.posZ, dragonPartHead.posX, dragonPartHead.posZ); + if (Utills.getDistanceAtoB(target.posX, target.posZ, posX, posZ) < 5) distance *= -1; float anglePitch = (float)Math.toDegrees(Math.atan2(target.posY - dragonPartHead.posY, distance)) * -1F; float angleYaw = (float)Math.toDegrees(Math.atan2(target.posX - dragonPartHead.posX, target.posZ - posZ)) * -1F; rotationPitch = anglePitch; - if (Utills.getDistance(target.posX, target.posZ, posX, posZ) > 8) rotationYaw = angleYaw + 180; + if (Utills.getDistanceAtoB(target.posX, target.posZ, posX, posZ) > 8) rotationYaw = angleYaw + 180; if (ticksExisted % 2 == 0) @@ -491,7 +491,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio switch (attackInProgress){ case ATTACK_FIREBALL_CHARGE: if (target == null && behaviour == EnumBehaviour.CHARGING) target = attackTarget; - if (Utills.getDistance(posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) > 10) + if (Utills.getDistanceAtoB(posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) > 10) { if (attackTimer % 2 == 0) { @@ -500,7 +500,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio worldObj.spawnEntityInWorld(projectile); } - double distance = Utills.getDistance(attackTarget.posX, attackTarget.posZ, dragonPartHead.posX, dragonPartHead.posZ); + double distance = Utills.getDistanceAtoB(attackTarget.posX, attackTarget.posZ, dragonPartHead.posX, dragonPartHead.posZ); float angle = (float)Math.toDegrees(Math.atan2(attackTarget.posY - dragonPartHead.posY, distance)) * -1F; rotationPitch = angle; @@ -533,7 +533,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio attackInProgress = -1; return; } - if (Utills.getDistance(posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) > 15) + if (Utills.getDistanceAtoB(posX, posY, posZ, attackTarget.posX, attackTarget.posY, attackTarget.posZ) > 15) { if (attackTimer % 2 == 0) { @@ -542,7 +542,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio worldObj.spawnEntityInWorld(projectile); } - double distance = Utills.getDistance(attackTarget.posX, attackTarget.posZ, dragonPartHead.posX, dragonPartHead.posZ); + double distance = Utills.getDistanceAtoB(attackTarget.posX, attackTarget.posZ, dragonPartHead.posX, dragonPartHead.posZ); float angle = (float)Math.toDegrees(Math.atan2(attackTarget.posY - dragonPartHead.posY, distance)) * -1F; rotationPitch = angle; @@ -615,7 +615,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio break; case FIREBOMB: - if (Utills.getDistance(posX, posY, posZ, homeX, homeY + 30, homeZ) > 3){ + if (Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) > 3){ targetX = homeX; targetY = homeY + 30; targetZ = homeZ; @@ -741,7 +741,7 @@ public class EntityChaosGuardian extends EntityDragon {//summon DraconicEvolutio break; case FIREBOMB: - if ((target == null && Utills.getDistance(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) || rand.nextInt(5) == 0) selectNewBehaviour(); + if ((target == null && Utills.getDistanceAtoB(posX, posY, posZ, homeX, homeY + 30, homeZ) <= 3) || rand.nextInt(5) == 0) selectNewBehaviour(); if (damageSource.getEntity() instanceof EntityPlayer && damageSource.getEntity() != target && worldObj.rayTraceBlocks(Vec3.createVectorHelper(posX, posY, posZ), Vec3.createVectorHelper(damageSource.getEntity().posX, damageSource.getEntity().posY, damageSource.getEntity().posZ)) == null){ target = damageSource.getEntity(); } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java index 2ef1aaa3..1749fae0 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityCustomDragon.java @@ -667,7 +667,7 @@ public class EntityCustomDragon extends EntityDragon { @Override public boolean attackEntityFromPart(EntityDragonPart p_70965_1_, DamageSource damageSource, float p_70965_3_) { -// if (damageSource.getEntity() != null && Utills.getDistance(damageSource.getEntity().posX)getDistanceToEntity(damageSource.getEntity()) > 100) { +// if (damageSource.getEntity() != null && Utills.getDistanceAtoB(damageSource.getEntity().posX)getDistanceToEntity(damageSource.getEntity()) > 100) { // LogHelper.info("cancel attack"); // return false; // } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java index eebac9cf..66caca0e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonHeart.java @@ -118,7 +118,7 @@ public class EntityDragonHeart extends Entity { List items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(posX-5, posY-5, posZ-5, posX+5, posY+5, posZ+5)); for (EntityItem item : items){ ItemStack stack = item.getEntityItem(); - if (Utills.getDistance(posX, posY + 0.5, posZ, item.posX, item.posY, item.posZ) < 1) { + if (Utills.getDistanceAtoB(posX, posY + 0.5, posZ, item.posX, item.posY, item.posZ) < 1) { if (coresConsumed == 16 || worldObj.isRemote) break; if (stack.getItem() != ModItems.draconicCore) { item.motionX=1; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java index 9b58d1c1..88e0f030 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityDragonProjectile.java @@ -116,7 +116,7 @@ public class EntityDragonProjectile extends Entity { } if (isChaser && !worldObj.isRemote){ - double tDist = Utills.getDistance(target.posX, target.posY, target.posZ, posX, posY, posZ); + double tDist = Utills.getDistanceAtoB(target.posX, target.posY, target.posZ, posX, posY, posZ); if (tDist <= 0) tDist = 0.1; double x = (target.posX - posX) / tDist; @@ -139,7 +139,7 @@ public class EntityDragonProjectile extends Entity { private boolean checkTargetCondition(){ if (worldObj.isRemote) return false; - double targetDistance = Utills.getDistance(posX, posY, posZ, target.posX, target.posY, target.posZ); + double targetDistance = Utills.getDistanceAtoB(posX, posY, posZ, target.posX, target.posY, target.posZ); Entity entityHit = getHitEntity(); if (entityHit instanceof EntityDragonPart) entityHit = null; @@ -270,7 +270,7 @@ public class EntityDragonProjectile extends Entity { for (EntityLivingBase entityLivingBase : entities) { if (entityLivingBase == shooter) continue; entityLivingBase.hurtResistantTime = 0; - entityLivingBase.attackEntityFrom(source, damage / (float)(Utills.getDistance(entityLivingBase.posX, entityLivingBase.posY, entityLivingBase.posZ, posX, posY, posZ) / radius)); + entityLivingBase.attackEntityFrom(source, damage / (float)(Utills.getDistanceAtoB(entityLivingBase.posX, entityLivingBase.posY, entityLivingBase.posZ, posX, posY, posZ) / radius)); if (source == damageChaos && entityLivingBase instanceof EntityPlayer){ for (ItemStack stack : ((EntityPlayer) entityLivingBase).inventory.armorInventory) { if (stack != null && stack.getItem() instanceof IEnergyContainerItem){ diff --git a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java index 5da4f4c9..690c975e 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/entity/EntityEnderArrow.java @@ -414,7 +414,7 @@ public class EntityEnderArrow extends EntityDraconicArrow { int y = (int)Math.floor(posY); int z = (int)Math.floor(posZ); - double travelDist = Utills.getDistance(startX, startY, startZ, x, y, z); + double travelDist = Utills.getDistanceAtoB(startX, startY, startZ, x, y, z); float travelDmg = (float)(travelDist / 5D); EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, x+0.5, y+0.5, z+0.5, travelDmg); if (!MinecraftForge.EVENT_BUS.post(event)) diff --git a/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java index 33780180..1c4db701 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/handler/MinecraftForgeEventHandler.java @@ -419,7 +419,7 @@ public class MinecraftForgeEventHandler { public void entityJoinWorld(EntityJoinWorldEvent event){ if (!event.world.isRemote && event.entity instanceof EntityEnderCrystal && event.entity.dimension == 1){ DataUtills.XZPair location = ChaosWorldGenHandler.getClosestChaosSpawn((int)event.entity.posX/16, (int)event.entity.posZ/16); - if ((location.x != 0 || location.z != 0) && Utills.getDistance(event.entity.posX, event.entity.posZ, location.x, location.z) < 500){ + if ((location.x != 0 || location.z != 0) && Utills.getDistanceAtoB(event.entity.posX, event.entity.posZ, location.x, location.z) < 500){ ProcessHandler.addProcess(new ChaosWorldGenHandler.CrystalRemover(event.entity)); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java index 8da2f419..88bca472 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/TileTestBlock.java @@ -148,7 +148,7 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { super.readFromNBT(p_145839_1_); EntityPlayer player = null; if (worldObj != null) player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, -1); - if (player != null) LogHelper.info("Read: "+Utills.getDistance(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); + if (player != null) LogHelper.info("Read: "+Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); LogHelper.info(worldObj+" "+player); } @@ -157,6 +157,6 @@ public class TileTestBlock extends TileEntity implements IEnergyHandler { super.writeToNBT(p_145841_1_); EntityPlayer player = null; if (worldObj != null) player = worldObj.getClosestPlayer(xCoord, yCoord, zCoord, -1); - if (player != null) LogHelper.info("Write: "+Utills.getDistance(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); + if (player != null) LogHelper.info("Write: "+Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord, yCoord, zCoord)); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java index b84666d8..d28710c3 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileRemoteEnergyBase.java @@ -309,7 +309,7 @@ public abstract class TileRemoteEnergyBase extends TileObjectSync implements IRe if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.de.invalidTile.txt")); return false; } - else if (Utills.getDistance(xCoord, yCoord, zCoord, x, y, z) > range) + else if (Utills.getDistanceAtoB(xCoord, yCoord, zCoord, x, y, z) > range) { if (worldObj.isRemote) player.addChatComponentMessage(new ChatComponentTranslation("msg.de.outOfRange.txt")); return false; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileWirelessEnergyTransceiver.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileWirelessEnergyTransceiver.java index af923f2e..38c7687c 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileWirelessEnergyTransceiver.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/energynet/TileWirelessEnergyTransceiver.java @@ -126,7 +126,7 @@ public class TileWirelessEnergyTransceiver extends TileRemoteEnergyBase { return; } - if (Utills.getDistance(xCoord, yCoord, zCoord, x, y, z) > (powerTier == 0 ? 15 : 30)) + if (Utills.getDistanceAtoB(xCoord, yCoord, zCoord, x, y, z) > (powerTier == 0 ? 15 : 30)) { player.addChatComponentMessage(new ChatComponentTranslation("msg.de.outOfRange.txt")); return; diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java index 629385cf..d8b6068b 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TileEnergyStorageCore.java @@ -785,6 +785,11 @@ public class TileEnergyStorageCore extends TileObjectSync { return INFINITE_EXTENT_AABB; } + @Override + public double getMaxRenderDistanceSquared() { + return 40960.0D; + } + private void detectAndRendChanges(){ int diff = (int)Math.abs(lastTickCapacity - energy); if (diff > 1000) lastTickCapacity = (Long) sendObjectToClient(References.LONG_ID, 0, energy, new NetworkRegistry.TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 20)); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TilePortalBlock.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TilePortalBlock.java index ba0c7b54..c40ca916 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TilePortalBlock.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/TilePortalBlock.java @@ -28,7 +28,7 @@ public class TilePortalBlock extends TileEntity { @SideOnly(Side.CLIENT) public void updateEntity() { if (!worldObj.isRemote) return; - double distanceMod = Utills.getDistance(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, RenderManager.renderPosX, RenderManager.renderPosY, RenderManager.renderPosZ); + double distanceMod = Utills.getDistanceAtoB(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, RenderManager.renderPosX, RenderManager.renderPosY, RenderManager.renderPosZ); if (worldObj.rand.nextInt(Math.max((int)(distanceMod * (distanceMod/5D)), 1)) == 0) { if (blockMetadata == -1) blockMetadata = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosion.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosion.java index 6852cdcb..f931a798 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosion.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/ReactorExplosion.java @@ -42,7 +42,7 @@ public class ReactorExplosion implements IProcess { for (int x = xCoord - size; x < xCoord + size; x++){ for (int z = zCoord - size; z < zCoord + size; z++){ - double dist = Utills.getDistance(x, z, xCoord, zCoord); + double dist = Utills.getDistanceAtoB(x, z, xCoord, zCoord); if (dist < OD && dist >= ID) { float tracePower = power - (float)(expansion/10D); diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorCore.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorCore.java index 12a4c136..1888e367 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorCore.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorCore.java @@ -6,7 +6,7 @@ import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.gui.GuiHandler; import com.brandon3055.draconicevolution.client.render.particle.Particles; -import com.brandon3055.draconicevolution.common.blocks.multiblock.IIsSlave; +import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; import com.brandon3055.draconicevolution.common.handler.ConfigHandler; import com.brandon3055.draconicevolution.common.lib.References; @@ -114,7 +114,7 @@ public class TileReactorCore extends TileObjectSync { private void checkPlayerCollision(){ EntityPlayer player = BrandonsCore.proxy.getClientPlayer(); - double distance = Utills.getDistance(player.posX, player.posY, player.posZ, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); + double distance = Utills.getDistanceAtoB(player.posX, player.posY, player.posZ, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); if (distance < (getCoreDiameter()/2) + 0.5){ double dMod = 1D - (distance / Math.max(0.1, (getCoreDiameter()/2) + 0.5)); double offsetX = player.posX - xCoord; @@ -267,7 +267,7 @@ public class TileReactorCore extends TileObjectSync { } for (TileReactorStabilizer stabilizer : stabilizers){ - if (Utills.getDistance(stabilizer.xCoord, stabilizer.yCoord, stabilizer.zCoord, xCoord, yCoord, zCoord) < (getMaxCoreDiameter()/2)+1) { + if (Utills.getDistanceAtoB(stabilizer.xCoord, stabilizer.yCoord, stabilizer.zCoord, xCoord, yCoord, zCoord) < (getMaxCoreDiameter()/2)+1) { isStructureValid = false; break; } @@ -291,7 +291,7 @@ public class TileReactorCore extends TileObjectSync { for (int i = 1; i < MAX_SLAVE_RANGE && !flag; i++){ TileLocation location = new TileLocation(xCoord + direction.offsetX * i, yCoord + direction.offsetY * i, zCoord + direction.offsetZ * i); if (location.getTileEntity(worldObj) != null){ - if (location.getTileEntity(worldObj) instanceof IIsSlave && !((IIsSlave) location.getTileEntity(worldObj)).getMaster().initialized) ((IIsSlave) location.getTileEntity(worldObj)).checkForMaster(); + if (location.getTileEntity(worldObj) instanceof IReactorPart && !((IReactorPart) location.getTileEntity(worldObj)).getMaster().initialized) ((IReactorPart) location.getTileEntity(worldObj)).checkForMaster(); flag = true; } } @@ -303,7 +303,7 @@ public class TileReactorCore extends TileObjectSync { for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS){ for (int i = 1; i < MAX_SLAVE_RANGE; i++){ TileLocation location = new TileLocation(xCoord + direction.offsetX * i, yCoord + direction.offsetY * i, zCoord + direction.offsetZ * i); - if (location.getTileEntity(worldObj) instanceof IIsSlave && ((IIsSlave) location.getTileEntity(worldObj)).getMaster().compareTo(new TileLocation(xCoord, yCoord, zCoord)) == 0) ((IIsSlave)location.getTileEntity(worldObj)).shutDown(); + if (location.getTileEntity(worldObj) instanceof IReactorPart && ((IReactorPart) location.getTileEntity(worldObj)).getMaster().compareTo(new TileLocation(xCoord, yCoord, zCoord)) == 0) ((IReactorPart)location.getTileEntity(worldObj)).shutDown(); } } @@ -401,6 +401,41 @@ public class TileReactorCore extends TileObjectSync { if (maxFieldChargeCach != maxFieldCharge) maxFieldChargeCach = (Double) sendObjectToClient(References.DOUBLE_ID, 11, maxFieldCharge, tp); } + public int getComparatorOutput(int rsMode){ + switch (rsMode){ + case IReactorPart.RMODE_TEMP: return toRSStrength(reactionTemperature, maxReactTemperature, rsMode); + case IReactorPart.RMODE_TEMP_INV: return 15 - toRSStrength(reactionTemperature, maxReactTemperature, rsMode); + case IReactorPart.RMODE_FIELD: return toRSStrength(fieldCharge, maxFieldCharge, rsMode); + case IReactorPart.RMODE_FIELD_INV: return 15 - toRSStrength(fieldCharge, maxFieldCharge, rsMode); + case IReactorPart.RMODE_SAT: return toRSStrength(energySaturation, maxEnergySaturation, rsMode); + case IReactorPart.RMODE_SAT_INV: return 15 - toRSStrength(energySaturation, maxEnergySaturation, rsMode); + case IReactorPart.RMODE_FUEL: return toRSStrength(convertedFuel + conversionUnit, reactorFuel - conversionUnit, rsMode); + case IReactorPart.RMODE_FUEL_INV: return 15 - toRSStrength(convertedFuel + conversionUnit, reactorFuel - conversionUnit, rsMode); + } + return 0; + } + + private int toRSStrength(double value, double maxValue, int mode){ + if (maxValue == 0) return 0; + double d = value / maxValue; + int rs = (int)(d * 15D); + switch (mode){ + case IReactorPart.RMODE_FIELD: + case IReactorPart.RMODE_FIELD_INV: + { + if (d < 0.1) rs = 0; + break; + } + case IReactorPart.RMODE_FUEL: + case IReactorPart.RMODE_FUEL_INV: + { + if (d > 0.9) rs = 15; + break; + } + } + return rs; + } + @Override @SideOnly(Side.CLIENT) public void receiveObjectFromServer(int index, Object object) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorEnergyInjector.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorEnergyInjector.java index 187605ae..fa6dc174 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorEnergyInjector.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorEnergyInjector.java @@ -1,9 +1,10 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.reactor; import cofh.api.energy.IEnergyReceiver; +import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam; -import com.brandon3055.draconicevolution.common.blocks.multiblock.IIsSlave; +import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; @@ -11,12 +12,13 @@ import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; /** * Created by Brandon on 23/7/2015. */ -public class TileReactorEnergyInjector extends TileEntity implements IIsSlave, IEnergyReceiver{ +public class TileReactorEnergyInjector extends TileEntity implements IReactorPart, IEnergyReceiver{ public float modelIllumination = 1F; public int facingDirection = ForgeDirection.UP.ordinal(); @@ -25,12 +27,24 @@ public class TileReactorEnergyInjector extends TileEntity implements IIsSlave, I public int tick = 0; private ParticleReactorBeam beam = null; private TileReactorCore core = null; + private int redstoneMode = 0; + private int rs = -1; + private int rsCach = -1; @Override public void updateEntity() { if (worldObj.isRemote && isValid){ beam = DraconicEvolution.proxy.reactorBeam(this, beam, true); } + + TileEntity master = masterLocation.getTileEntity(worldObj); + if (!worldObj.isRemote && master instanceof TileReactorCore){ + rs = ((TileReactorCore) master).getComparatorOutput(redstoneMode); + if (rs != rsCach){ + rsCach = rs; + Utills.updateNeabourBlocks(worldObj, xCoord, yCoord, zCoord); + } + } } public void onPlaced() { @@ -67,6 +81,22 @@ public class TileReactorEnergyInjector extends TileEntity implements IIsSlave, I return isValid; } + @Override + public String getRedstoneModeString() { + return StatCollector.translateToLocal("msg.de.reactorRSMode."+redstoneMode+".txt"); + } + + @Override + public void changeRedstoneMode() { + if (redstoneMode == IReactorPart.RMODE_FUEL_INV) redstoneMode = 0; + else redstoneMode++; + } + + @Override + public int getRedstoneMode() { + return redstoneMode; + } + @Override public void shutDown() { masterLocation = new MultiblockHelper.TileLocation(); @@ -106,6 +136,7 @@ public class TileReactorEnergyInjector extends TileEntity implements IIsSlave, I masterLocation.writeToNBT(compound, "Master"); compound.setInteger("Facing", facingDirection); compound.setBoolean("IsValid", isValid); + compound.setInteger("RedstoneMode", redstoneMode); } @Override @@ -114,6 +145,7 @@ public class TileReactorEnergyInjector extends TileEntity implements IIsSlave, I masterLocation.readFromNBT(compound, "Master"); facingDirection = compound.getInteger("Facing"); isValid = compound.getBoolean("IsValid"); + redstoneMode = compound.getInteger("RedstoneMode"); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorStabilizer.java b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorStabilizer.java index 6a73d702..0fb06227 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorStabilizer.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/tileentities/multiblocktiles/reactor/TileReactorStabilizer.java @@ -2,21 +2,23 @@ package com.brandon3055.draconicevolution.common.tileentities.multiblocktiles.re import cofh.api.energy.IEnergyProvider; import cofh.api.energy.IEnergyReceiver; +import com.brandon3055.brandonscore.common.utills.Utills; import com.brandon3055.draconicevolution.DraconicEvolution; import com.brandon3055.draconicevolution.client.render.particle.ParticleReactorBeam; -import com.brandon3055.draconicevolution.common.blocks.multiblock.IIsSlave; +import com.brandon3055.draconicevolution.common.blocks.multiblock.IReactorPart; import com.brandon3055.draconicevolution.common.blocks.multiblock.MultiblockHelper.TileLocation; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; /** * Created by brandon3055 on 5/7/2015. */ -public class TileReactorStabilizer extends TileEntity implements IIsSlave , IEnergyProvider{ +public class TileReactorStabilizer extends TileEntity implements IReactorPart, IEnergyProvider{ public float coreRotation = 0F; public float ringRotation = 0F; @@ -27,7 +29,10 @@ public class TileReactorStabilizer extends TileEntity implements IIsSlave , IEne public TileLocation masterLocation = new TileLocation(); public boolean isValid = false; public int tick = 0; + private int redstoneMode = 0; private ParticleReactorBeam beam = null; + private int rs = -1; + private int rsCach = -1; @Override public void updateEntity() { @@ -61,6 +66,14 @@ public class TileReactorStabilizer extends TileEntity implements IIsSlave , IEne } } + if (!worldObj.isRemote && master instanceof TileReactorCore){ + rs = ((TileReactorCore) master).getComparatorOutput(redstoneMode); + if (rs != rsCach){ + rsCach = rs; + Utills.updateNeabourBlocks(worldObj, xCoord, yCoord, zCoord); + } + } + } public void onPlaced() { @@ -104,6 +117,22 @@ public class TileReactorStabilizer extends TileEntity implements IIsSlave , IEne return isValid; } + @Override + public String getRedstoneModeString() { + return StatCollector.translateToLocal("msg.de.reactorRSMode." + redstoneMode + ".txt"); + } + + @Override + public void changeRedstoneMode() { + if (redstoneMode == IReactorPart.RMODE_FUEL_INV) redstoneMode = 0; + else redstoneMode++; + } + + @Override + public int getRedstoneMode() { + return redstoneMode; + } + @Override public void shutDown(){ isValid = false; @@ -135,6 +164,7 @@ public class TileReactorStabilizer extends TileEntity implements IIsSlave , IEne masterLocation.writeToNBT(compound, "Master"); compound.setInteger("Facing", facingDirection); compound.setBoolean("IsValid", isValid); + compound.setInteger("RedstoneMode", redstoneMode); } @Override @@ -143,6 +173,7 @@ public class TileReactorStabilizer extends TileEntity implements IIsSlave , IEne masterLocation.readFromNBT(compound, "Master"); facingDirection = compound.getInteger("Facing"); isValid = compound.getBoolean("IsValid"); + redstoneMode = compound.getInteger("RedstoneMode"); } @Override diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java b/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java index 76394495..7e1f27e4 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/ChaosWorldGenHandler.java @@ -92,7 +92,7 @@ public class ChaosWorldGenHandler { //Gen Ring for (int x = islandCenter.x - outerRadius; x <= islandCenter.x + outerRadius; x++) { for (int z = islandCenter.z - outerRadius; z <= islandCenter.z + outerRadius; z++) { - int dist = (int) (Utills.getDistance(x, z, islandCenter.x, islandCenter.z)); + int dist = (int) (Utills.getDistanceAtoB(x, z, islandCenter.x, islandCenter.z)); for (int i = 0; i < rings; i++) { //if (dist < outerRadius1 && dist >= innerRadius1 || dist < outerRadius2 && dist >= innerRadius2) @@ -163,7 +163,7 @@ public class ChaosWorldGenHandler { int r = 3; for (int x = x1 - r; x <= x1 + r; x++) { for (int z = z1 - r; z <= z1 + r; z++) { - if (Utills.getDistance(x, z, x1, z1) <= r) { + if (Utills.getDistanceAtoB(x, z, x1, z1) <= r) { if (pct > rand.nextDouble()) world.setBlock(x, y, z, Blocks.obsidian, 0, 2); } } diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java b/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java index ff4b54a0..db7d50fc 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/DraconicWorldGenerator.java @@ -12,6 +12,9 @@ import net.minecraft.world.gen.feature.WorldGenMinable; import java.util.Random; public class DraconicWorldGenerator implements IWorldGenerator { + public static boolean chaosIslandsEnabled = true; + public static boolean cometsEnabled = true; + public static boolean oreEnabledInEnd = true; @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { @@ -44,9 +47,9 @@ public class DraconicWorldGenerator implements IWorldGenerator { int x1 = x + random.nextInt(16); int y = 20 + random.nextInt(170); int z1 = z + random.nextInt(16); - if (ConfigHandler.generateEnderComets && Math.sqrt(x*x + z*z) > 200 && random.nextInt(Math.max(1, ConfigHandler.cometRarity)) == 0) new WorldGenEnderComet().generate(world, random, x1, y , z1); - if (ConfigHandler.generateChaosIslands) ChaosWorldGenHandler.generateChunk(world, x/16, z/16, null, random); - if (!ConfigHandler.disableOreSpawnEnd) addOreSpawn(ModBlocks.draconiumOre, world, random, x, z, 4, 5, 10, 1, 70); + if (cometsEnabled && ConfigHandler.generateEnderComets && Math.sqrt(x*x + z*z) > 200 && random.nextInt(Math.max(1, ConfigHandler.cometRarity)) == 0) new WorldGenEnderComet().generate(world, random, x1, y , z1); + if (chaosIslandsEnabled && ConfigHandler.generateChaosIslands) ChaosWorldGenHandler.generateChunk(world, x/16, z/16, null, random); + if (oreEnabledInEnd && !ConfigHandler.disableOreSpawnEnd) addOreSpawn(ModBlocks.draconiumOre, world, random, x, z, 4, 5, 10, 1, 70); } public void generateNether(Random random, int chunkX, int chunkZ, World world) { diff --git a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenChaosIsland.java b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenChaosIsland.java index 346f7764..b03e4b45 100644 --- a/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenChaosIsland.java +++ b/src/main/java/com/brandon3055/draconicevolution/common/world/WorldGenChaosIsland.java @@ -348,7 +348,7 @@ public class WorldGenChaosIsland { // for (int x = spawnX - r; x <= spawnX + r; x++) { // for (int z = spawnZ - r; z <= spawnZ + r; z++) { // for (int y = spawnY - (r / 2); y <= spawnY + (r / 2); y++) { -// if ((int) (Utills.getDistance(x, y, z, spawnX, spawnY + offPoint + centreThikness, spawnZ)) >= offPoint && (int) (Utills.getDistance(x, y, z, spawnX, spawnY - offPoint - centreThikness, spawnZ)) >= offPoint && (int) (Utills.getDistance(x, y, z, spawnX, spawnY, spawnZ)) <= r) { +// if ((int) (Utills.getDistanceAtoB(x, y, z, spawnX, spawnY + offPoint + centreThikness, spawnZ)) >= offPoint && (int) (Utills.getDistanceAtoB(x, y, z, spawnX, spawnY - offPoint - centreThikness, spawnZ)) >= offPoint && (int) (Utills.getDistanceAtoB(x, y, z, spawnX, spawnY, spawnZ)) <= r) { // // int dist = (int) Math.sqrt((x-spawnX)*(x-spawnX) + (y-spawnY)*(y-spawnY) + (z-spawnZ)*(z-spawnZ)); // @@ -498,7 +498,7 @@ public class WorldGenChaosIsland { // int r = 3; // for (int x = x1 - r; x <= x1 + r; x++) { // for (int z = z1 - r; z <= z1 + r; z++) { -// if (Utills.getDistance(x, z, x1, z1) <= r) { +// if (Utills.getDistanceAtoB(x, z, x1, z1) <= r) { // if (pct > rand.nextDouble()) world.setBlock(x, y, z, Blocks.obsidian, 0, 2); // } // } @@ -532,7 +532,7 @@ public class WorldGenChaosIsland { // int r = outerRadius; // for (int x = spawnX - r; x <= spawnX + r; x++) { // for (int z = spawnZ - r; z <= spawnZ + r; z++) { -// int dist = (int) (Utills.getDistance(x, z, spawnX, spawnZ)); +// int dist = (int) (Utills.getDistanceAtoB(x, z, spawnX, spawnZ)); // if (dist < outerRadius && dist >= innerRadius) { // int y = spawnY + (int) ((double) (spawnX - x) * 0.2D) + (random.nextInt(10) - 5); // if (0.1F > random.nextFloat()) world.setBlock(x, y, z, Blocks.end_stone, 0, 2); diff --git a/src/main/resources/assets/draconicevolution/lang/en_US.lang b/src/main/resources/assets/draconicevolution/lang/en_US.lang index 76fc1d6e..dd57781a 100644 --- a/src/main/resources/assets/draconicevolution/lang/en_US.lang +++ b/src/main/resources/assets/draconicevolution/lang/en_US.lang @@ -166,6 +166,15 @@ msg.de.linked.txt=Devices Linked msg.de.unLinked.txt=Devices Un-Linked msg.de.wrongSide.txt=Can not connect to that side of the target device +//Reactor +msg.de.reactorRSMode.0.txt=Comparator Mode: Temperature +msg.de.reactorRSMode.1.txt=Comparator Mode: Temperature [Inverted] +msg.de.reactorRSMode.2.txt=Comparator Mode: Containment Field +msg.de.reactorRSMode.3.txt=Comparator Mode: Containment Field [Inverted] +msg.de.reactorRSMode.4.txt=Comparator Mode: Energy Saturation +msg.de.reactorRSMode.5.txt=Comparator Mode: Energy Saturation [Inverted] +msg.de.reactorRSMode.6.txt=Comparator Mode: Fuel Conversion +msg.de.reactorRSMode.7.txt=Comparator Mode: Fuel Conversion [Inverted] //Tool Tips/other localizations ---------------------------------------------------------------------------------------------------------------------------------------- info.teleporterInfUnset1.txt=Unbound