diff options
Diffstat (limited to 'src/Java')
13 files changed, 554 insertions, 127 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus_Secondary.java b/src/Java/gtPlusPlus/GTplusplus_Secondary.java index e3bdb89c3a..670f6d0fc8 100644 --- a/src/Java/gtPlusPlus/GTplusplus_Secondary.java +++ b/src/Java/gtPlusPlus/GTplusplus_Secondary.java @@ -14,15 +14,9 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.world.darkworld.Dimension_DarkWorld; import gtPlusPlus.core.world.darkworld.biome.Biome_DarkWorld; -import gtPlusPlus.core.world.darkworld.block.blockDarkWorldGround; -import gtPlusPlus.core.world.darkworld.block.blockDarkWorldPollutedDirt; -import gtPlusPlus.core.world.darkworld.block.blockDarkWorldPortal; -import gtPlusPlus.core.world.darkworld.block.blockDarkWorldPortalFrame; -import gtPlusPlus.core.world.darkworld.item.itemDarkWorldPortalTrigger; +import gtPlusPlus.core.world.darkworld.block.DarkWorldContentLoader; import gtPlusPlus.xmod.gregtech.HANDLER_GT; import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; @@ -80,17 +74,10 @@ public class GTplusplus_Secondary implements IFuelHandler, IWorldGenerator{ } void setVars(){ - Dimension_DarkWorld.DIMID = DimensionManager.getNextFreeDimId(); - Dimension_DarkWorld.portalBlock = new blockDarkWorldPortal(); - Dimension_DarkWorld.portalItem = (itemDarkWorldPortalTrigger) (new itemDarkWorldPortalTrigger().setUnlocalizedName("dimensionDarkWorld_trigger")); - Item.itemRegistry.addObject(423, "dimensionDarkWorld_trigger", Dimension_DarkWorld.portalItem); - Dimension_DarkWorld.blockTopLayer = new blockDarkWorldGround(); - Dimension_DarkWorld.blockSecondLayer = new blockDarkWorldPollutedDirt(); - GameRegistry.registerBlock(Dimension_DarkWorld.blockTopLayer, "blockDarkWorldGround"); - GameRegistry.registerBlock(Dimension_DarkWorld.blockSecondLayer, "blockDarkWorldGround2"); - Blocks.fire.setFireInfo(Dimension_DarkWorld.blockTopLayer, 30, 20); - Dimension_DarkWorld.blockPortalFrame = new blockDarkWorldPortalFrame(); - GameRegistry.registerBlock(Dimension_DarkWorld.blockPortalFrame, "blockDarkWorldPortalFrame"); + if (DimensionManager.isDimensionRegistered(Dimension_DarkWorld.DIMID)){ + Dimension_DarkWorld.DIMID = DimensionManager.getNextFreeDimId(); + } + DarkWorldContentLoader.run(); } @EventHandler @@ -111,19 +98,19 @@ public class GTplusplus_Secondary implements IFuelHandler, IWorldGenerator{ @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { chunkX = chunkX * 16; - chunkZ = chunkZ * 16; + chunkZ = chunkZ * 16; + + /*if (world.provider.dimensionId == Dimension_DarkWorld.DIMID) { + DarkWorld_Biome.generateSurface(world, random, chunkX, chunkZ); + }*/ + + //What does this even do? if (world.provider.dimensionId == -1) { DarkWorld_Biome.generateNether(world, random, chunkX, chunkZ); } if (world.provider.dimensionId == 0) { DarkWorld_Biome.generateSurface(world, random, chunkX, chunkZ); } - if (world.provider.dimensionId == -1) { - DarkWorld_Dimension.generateNether(world, random, chunkX, chunkZ); - } - if (world.provider.dimensionId == 0) { - - } } diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseFluid.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseFluid.java new file mode 100644 index 0000000000..6f837e8709 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseFluid.java @@ -0,0 +1,102 @@ +package gtPlusPlus.core.block.base; + +import java.util.Random; + +import cofh.lib.render.particle.EntityDropParticleFX; +import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.base.itemblock.ItemBlockMeta; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.BlockFluidClassic; +import net.minecraftforge.fluids.Fluid; + +public class BlockBaseFluid extends BlockFluidClassic { + + private final String name; + private final IIcon textureArray[] = new IIcon[6]; + + protected float particleRed = 1.0F; + protected float particleGreen = 1.0F; + protected float particleBlue = 1.0F; + + public BlockBaseFluid(String materialName, Fluid fluid, Material material) { + super(fluid, material); + this.setLightOpacity(2); + this.name = Utils.sanitizeString(materialName); + this.setBlockName("fluid"+this.name); + this.setCreativeTab(AddToCreativeTab.tabBlock); + GameRegistry.registerBlock(this, ItemBlockMeta.class, "fluid"+this.name); + } + + public BlockFluidClassic setParticleColor(int arg0) { + return this.setParticleColor((arg0 >> 16 & 255) / 255.0F, (arg0 >> 8 & 255) / 255.0F, + (arg0 >> 0 & 255) / 255.0F); + } + + public BlockFluidClassic setParticleColor(float arg0, float arg1, float arg2) { + this.particleRed = arg0; + this.particleGreen = arg1; + this.particleBlue = arg2; + return this; + } + + @Override + public boolean canCreatureSpawn(EnumCreatureType arg0, IBlockAccess arg1, int arg2, int arg3, int arg4) { + return false; + } + + public boolean preInit() { + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return side <= 1 ? this.textureArray[0] : this.textureArray[1]; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iicon) { + this.textureArray[0] = iicon.registerIcon(CORE.MODID + ":" + "fluid/" + "Fluid_" + this.name + "_Still"); + this.textureArray[1] = iicon.registerIcon(CORE.MODID + ":" + "fluid/" + "Fluid_" + this.name + "_Flow"); + //IconRegistry.addIcon("Fluid" + this.name, this.modName + ":fluid/Fluid_" + this.name + "_Still", arg0); + //IconRegistry.addIcon("Fluid" + this.name + "1", this.modName + ":fluid/Fluid_" + this.name + "_Flow", arg0); + } + + @Override + @Optional.Method(modid = "CoFHCore") + @SideOnly(Side.CLIENT) + public void randomDisplayTick(World arg0, int arg1, int arg2, int arg3, Random arg4) { + super.randomDisplayTick(arg0, arg1, arg2, arg3, arg4); + double arg5 = arg1 + arg4.nextFloat(); + double arg7 = arg2 - 1.05D; + double arg9 = arg3 + arg4.nextFloat(); + if (super.density < 0) { + arg7 = arg2 + 2.1D; + } + + if (arg4.nextInt(20) == 0 + && arg0.isSideSolid(arg1, arg2 + super.densityDir, arg3, + super.densityDir == -1 ? ForgeDirection.UP : ForgeDirection.DOWN) + && !arg0.getBlock(arg1, arg2 + 2 * super.densityDir, arg3).getMaterial().blocksMovement()) { + EntityDropParticleFX arg11 = new EntityDropParticleFX(arg0, arg5, arg7, arg9, this.particleRed, + this.particleGreen, this.particleBlue, super.densityDir); + FMLClientHandler.instance().getClient().effectRenderer.addEffect(arg11); + } + + } + +} diff --git a/src/Java/gtPlusPlus/core/config/ConfigHandler.java b/src/Java/gtPlusPlus/core/config/ConfigHandler.java index c86b12b51b..641a4c0956 100644 --- a/src/Java/gtPlusPlus/core/config/ConfigHandler.java +++ b/src/Java/gtPlusPlus/core/config/ConfigHandler.java @@ -1,8 +1,7 @@ package gtPlusPlus.core.config; import static gtPlusPlus.core.item.general.RF2EU_Battery.rfPerEU; -import static gtPlusPlus.core.lib.CORE.DARKBIOME_ID; -import static gtPlusPlus.core.lib.CORE.DEBUG; +import static gtPlusPlus.core.lib.CORE.*; import static gtPlusPlus.core.lib.CORE.ConfigSwitches.*; import static gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GT_MetaTileEntity_WorldAccelerator.BlacklistedTileEntiyClassNames; @@ -151,6 +150,7 @@ public class ConfigHandler { "Disables Zombie Reinforcement on hard difficutly."); //Biomes + DARKWORLD_ID = config.getInt("darkworld_ID", "worldgen", 227, 1, 254, "The ID of the Dark Dimension."); DARKBIOME_ID = config.getInt("darkbiome_ID", "worldgen", 238, 1, 254, "The biome within the Dark Dimension."); //Blacklisted Accelerator TileEntities diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java b/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java index e95ee5caf0..5a3e0348fe 100644 --- a/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java +++ b/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java @@ -1,13 +1,17 @@ package gtPlusPlus.core.entity.monster; +import java.lang.reflect.Field; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.*; import net.minecraft.entity.ai.*; +import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.monster.EntityIronGolem; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.player.EntityPlayer; @@ -18,26 +22,30 @@ import net.minecraft.village.Village; import net.minecraft.world.World; public class EntityStaballoyConstruct extends EntityIronGolem { - /** deincrements, and a distance-to-home check is done at 0 */ - private int homeCheckTimer; - Village villageObj; - private int attackTimer; - private int holdRoseTick; + + /* + * Determines whether or not the entity is in a fluid at all. + */ + private volatile boolean inFluid = false; + private volatile boolean mReflectFirstUpdate = true; + private volatile int attackTimer; public EntityStaballoyConstruct(World world) { super(world); this.setSize(1.4F, 2.9F); this.getNavigator().setAvoidsWater(true); + this.getNavigator().setBreakDoors(true); + this.getNavigator().setCanSwim(false); + this.getNavigator().setAvoidSun(false); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); - //this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); + this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); //this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true)); - this.tasks.addTask(2, new EntityAIMoveTowardsRestriction(this, 1.0D)); - this.tasks.addTask(3, new EntityAIWander(this, 0.6D)); - this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); - this.tasks.addTask(5, new EntityAILookIdle(this)); + this.tasks.addTask(3, new EntityAIMoveTowardsRestriction(this, 1.0D)); + this.tasks.addTask(4, new EntityAIWander(this, 0.6D)); + this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(6, new EntityAILookIdle(this)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); - //this.targetTasks.addTask(2, - //new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); } @Override @@ -59,11 +67,6 @@ public class EntityStaballoyConstruct extends EntityIronGolem { */ @Override protected void updateAITick() { - if (--this.homeCheckTimer <= 0) { - this.homeCheckTimer = 70 + this.rand.nextInt(50); - this.detachHome(); - } - super.updateAITick(); } @@ -79,7 +82,7 @@ public class EntityStaballoyConstruct extends EntityIronGolem { */ @Override protected int decreaseAirSupply(int p_70682_1_) { - return p_70682_1_; + return 0; } @Override @@ -104,10 +107,6 @@ public class EntityStaballoyConstruct extends EntityIronGolem { --this.attackTimer; } - if (this.holdRoseTick > 0) { - --this.holdRoseTick; - } - if (this.motionX * this.motionX + this.motionZ * this.motionZ > 2.500000277905201E-7D && this.rand.nextInt(5) == 0) { int i = MathHelper.floor_double(this.posX); @@ -115,8 +114,8 @@ public class EntityStaballoyConstruct extends EntityIronGolem { int k = MathHelper.floor_double(this.posZ); Block block = this.worldObj.getBlock(i, j, k); - - + + if (block.getMaterial() != Material.air) { this.worldObj.spawnParticle( "blockcrack_" + Block.getIdFromBlock(block) + "_" + this.worldObj.getBlockMetadata(i, j, k), @@ -133,9 +132,8 @@ public class EntityStaballoyConstruct extends EntityIronGolem { * Returns true if this entity can attack entities of the specified class. */ @Override - public boolean canAttackClass(Class p_70686_1_) { - return this.isPlayerCreated() && EntityPlayer.class.isAssignableFrom(p_70686_1_) ? false - : super.canAttackClass(p_70686_1_); + public boolean canAttackClass(Class clazz) { + return clazz.equals(this.getClass()) ? false : true; } /** @@ -178,9 +176,6 @@ public class EntityStaballoyConstruct extends EntityIronGolem { this.attackTimer = 10; this.playSound("mob.irongolem.throw", 1.0F, 1.0F); } - else if (p_70103_1_ == 11) { - this.holdRoseTick = 400; - } else { super.handleHealthUpdate(p_70103_1_); } @@ -197,12 +192,6 @@ public class EntityStaballoyConstruct extends EntityIronGolem { return this.attackTimer; } - @Override - public void setHoldingRose(boolean p_70851_1_) { - this.holdRoseTick = p_70851_1_ ? 400 : 0; - this.worldObj.setEntityState(this, (byte) 11); - } - /** * Returns the sound this mob makes when it is hurt. */ @@ -221,7 +210,7 @@ public class EntityStaballoyConstruct extends EntityIronGolem { @Override protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) { - //this.playSound("mob.irongolem.walk", 1.0F, 1.0F); + this.playSound("mob.irongolem.walk", 1.0F, 1.0F); } /** @@ -250,11 +239,6 @@ public class EntityStaballoyConstruct extends EntityIronGolem { } @Override - public int getHoldRoseTick() { - return this.holdRoseTick; - } - - @Override public boolean isPlayerCreated() { return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0; } @@ -278,4 +262,188 @@ public class EntityStaballoyConstruct extends EntityIronGolem { public void onDeath(DamageSource p_70645_1_) { super.onDeath(p_70645_1_); } + + @Override + protected String getLivingSound() { //TODO + return super.getLivingSound(); + } + + @Override + public int getTalkInterval() { + return 0; + } + + @Override + protected boolean canDespawn() { + return true; + } + + @Override + public void onEntityUpdate() { + //Set Fire Immunity + if (!this.isImmuneToFire){ + this.isImmuneToFire = true; + } + + //Handle Exploding + if (isReadyToExplode){ + if (this.fuse-- <= 0){ + this.setDead(); + + if (!this.worldObj.isRemote) + { + this.explode(); + } + } + else + { + this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); + } + } + + //Get a private field from a super class if it exists. + if (ReflectionUtils.getField(this, "firstUpdate") != null && mReflectFirstUpdate == true){ + Field x = ReflectionUtils.getField(this, "firstUpdate"); + try { + this.mReflectFirstUpdate = (boolean) x.get(this); + } + catch (IllegalArgumentException | IllegalAccessException e) {} + } + super.onEntityUpdate(); + } + + @Override + public int getMaxSpawnedInChunk() { + return 1; + } + + @Override + public boolean canBreatheUnderwater() { + return true; + } + + @Override + public void knockBack(Entity p_70653_1_, float p_70653_2_, double p_70653_3_, double p_70653_5_) { + // Do Nothing because he weighs metric shittonnes. + } + + @Override + protected void setOnFireFromLava() { + extinguish(); + } + + @Override + public void setFire(int p_70015_1_) { + extinguish(); + } + + @Override + protected void dealFireDamage(int p_70081_1_) { + + } + + @Override + public boolean isInWater() { + if (super.isInWater()){ + return true; + } + else { + this.moveForward *= 0.98F; + return false; + } + } + + @Override + public boolean handleWaterMovement() { + this.moveForward *= 0.74F; + return handleFluidMovement(Material.water); + } + + @Override + public boolean handleLavaMovement() { + this.moveForward *= 0.74F; + return handleFluidMovement(Material.lava); + } + + /** + * Returns if this entity is in water and will end up adding the waters velocity to the entity + */ + public boolean handleFluidMovement(Material fluid){ + + + + if (this.worldObj.handleMaterialAcceleration(this.boundingBox.expand(0.0D, -0.4000000059604645D, 0.0D).contract(0.001D, 0.001D, 0.001D), fluid, this)) + { + if (!this.inFluid && !this.mReflectFirstUpdate) + { + float f = MathHelper.sqrt_double(this.motionX * this.motionX * 0.20000000298023224D + this.motionY * this.motionY + this.motionZ * this.motionZ * 0.20000000298023224D) * 0.2F; + + if (f > 1.0F) + { + f = 1.0F; + } + + this.playSound(this.getSplashSound(), f, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F); + float f1 = MathHelper.floor_double(this.boundingBox.minY); + int i; + float f2; + float f3; + + for (i = 0; i < 1.0F + this.width * 20.0F; ++i) + { + f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + f3 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle("bubble", this.posX + f2, f1 + 1.0F, this.posZ + f3, this.motionX, this.motionY - this.rand.nextFloat() * 0.2F, this.motionZ); + } + + for (i = 0; i < 1.0F + this.width * 20.0F; ++i) + { + f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + f3 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width; + this.worldObj.spawnParticle("splash", this.posX + f2, f1 + 1.0F, this.posZ + f3, this.motionX, this.motionY, this.motionZ); + } + } + this.fallDistance = 0.0F; + this.inFluid = true; + } + else + { + this.inFluid = false; + } + return this.inFluid; + } + + @Override + public void onChunkLoad() { + // TODO Auto-generated method stub + super.onChunkLoad(); + } + + private int fuse = 60; + private boolean isReadyToExplode = false; + @Override + public void onStruckByLightning(EntityLightningBolt p_70077_1_) { + this.isReadyToExplode = true; + this.fuse = 20; + } + + private void explode(){ + float f = 12.0F; + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true); + } + + @Override + public boolean canAttackWithItem() { + return true; + } + + @Override + public boolean canRenderOnFire() { + return false; + } + + @Override + public boolean isPushedByWater() { + return false; + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index cc6fade7ce..5de70b467a 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -53,6 +53,7 @@ public class CORE { //Tweakables public static int DARKBIOME_ID = 238; + public static int DARKWORLD_ID = 227; //GT Vars; public static final int GREG_FIRST_ID = 760; diff --git a/src/Java/gtPlusPlus/core/world/darkworld/Dimension_DarkWorld.java b/src/Java/gtPlusPlus/core/world/darkworld/Dimension_DarkWorld.java index 71d0e59492..22b8973cdb 100644 --- a/src/Java/gtPlusPlus/core/world/darkworld/Dimension_DarkWorld.java +++ b/src/Java/gtPlusPlus/core/world/darkworld/Dimension_DarkWorld.java @@ -5,23 +5,20 @@ import java.util.Random; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.world.darkworld.block.*; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.world.darkworld.block.blockDarkWorldPortal; import gtPlusPlus.core.world.darkworld.item.itemDarkWorldPortalTrigger; import gtPlusPlus.core.world.darkworld.world.WorldProviderMod; import net.minecraft.block.Block; import net.minecraft.init.Blocks; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; -@SuppressWarnings("unchecked") public class Dimension_DarkWorld { public Object instance; - public static int DIMID = 227; + public static int DIMID = CORE.DARKWORLD_ID; public static blockDarkWorldPortal portalBlock; public static itemDarkWorldPortalTrigger portalItem; @@ -29,7 +26,7 @@ public class Dimension_DarkWorld { public static Block blockSecondLayer; public static Block blockMainFiller = Blocks.stone; public static Block blockSecondaryFiller; - public static Block blockFluidLakes = ModBlocks.blockFluidSludge; + public static Block blockFluidLakes; public static Block blockPortalFrame; diff --git a/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java b/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java index f90966714e..2970a2c3de 100644 --- a/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java +++ b/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.world.darkworld.biome; +import java.lang.reflect.Field; import java.util.Random; import cpw.mods.fml.common.event.FMLPreInitializationEvent; @@ -10,16 +11,10 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.entity.monster.EntitySickBlaze; import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.core.world.darkworld.Dimension_DarkWorld; -import net.minecraft.entity.monster.EntityBlaze; -import net.minecraft.entity.monster.EntityCaveSpider; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.monster.EntityEnderman; -import net.minecraft.entity.monster.EntityGhast; -import net.minecraft.entity.monster.EntitySkeleton; -import net.minecraft.entity.monster.EntitySpider; -import net.minecraft.entity.monster.EntityZombie; -import net.minecraft.entity.passive.*; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.entity.passive.EntitySquid; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; @@ -28,7 +23,7 @@ import net.minecraftforge.common.BiomeManager; public class Biome_DarkWorld { - public static BiomeGenbiomeDarkWorld biome = new BiomeGenbiomeDarkWorld(); + public static BiomeGenDarkWorld biome = new BiomeGenDarkWorld(); public Object instance; @@ -38,8 +33,6 @@ public class Biome_DarkWorld { public void load() { BiomeDictionary.registerBiomeType(biome, BiomeDictionary.Type.DEAD); BiomeManager.addSpawnBiome(biome); - // BiomeManager.desertBiomes.add(new BiomeManager.BiomeEntry(biome, - // 10)); } public void generateNether(World world, Random random, int chunkX, int chunkZ) { @@ -61,10 +54,11 @@ public class Biome_DarkWorld { public void preInit(FMLPreInitializationEvent event) { } - static class BiomeGenbiomeDarkWorld extends BiomeGenBase { + static class BiomeGenDarkWorld extends BiomeGenBase { @SuppressWarnings("unchecked") - public BiomeGenbiomeDarkWorld() { + public BiomeGenDarkWorld() { super(CORE.DARKBIOME_ID); + this.setBiomeID(); this.theBiomeDecorator = new BiomeGenerator_Custom(); Logger.INFO("Dark World Temperature Category: "+getTempCategory()); this.setBiomeName("Dark World"); @@ -82,29 +76,41 @@ public class Biome_DarkWorld { this.spawnableCreatureList.clear(); this.spawnableWaterCreatureList.clear(); this.spawnableCaveCreatureList.clear(); - - //Enemies - this.spawnableMonsterList.add(new SpawnListEntry(EntitySickBlaze.class, 10, 4, 10)); - this.spawnableMonsterList.add(new SpawnListEntry(EntitySickBlaze.class, 60, 1, 2)); - this.spawnableMonsterList.add(new SpawnListEntry(EntityStaballoyConstruct.class, 30, 1, 2)); - //this.spawnableMonsterList.add(new SpawnListEntry(EntityStaballoyConstruct.class, 5, 1, 5)); - - addToMonsterSpawnLists(EntityBlaze.class, 5, 1, 5); - addToMonsterSpawnLists(EntityCaveSpider.class, 5, 1, 5); - addToMonsterSpawnLists(EntityCreeper.class, 4, 1, 2); - addToMonsterSpawnLists(EntityEnderman.class, 5, 1, 5); - addToMonsterSpawnLists(EntitySkeleton.class, 5, 1, 5); - addToMonsterSpawnLists(EntitySpider.class, 5, 1, 5); - addToMonsterSpawnLists(EntityZombie.class, 5, 1, 5); - - //Passive - this.spawnableCreatureList.add(new SpawnListEntry(EntityCow.class, 5, 5, 10)); - this.spawnableCreatureList.add(new SpawnListEntry(EntityBat.class, 4, 4, 8)); - this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 5, 4, 10)); - - //Water - this.spawnableWaterCreatureList.add(new SpawnListEntry(EntitySquid.class, 5, 1, 10)); - + + //Enemies + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySickBlaze.class, 100, 4, 4)); + this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityStaballoyConstruct.class, 80, 1, 2)); + + //Animals + this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4)); + this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8)); + + } + + private synchronized boolean setBiomeID() { + BiomeGenBase[] mTempList; + try { + Field mInternalBiomeList = ReflectionUtils.getField(BiomeGenBase.class, "biomeList"); + Field mClone = mInternalBiomeList; + mTempList = (BiomeGenBase[]) mInternalBiomeList.get(null); + if (mTempList != null){ + mTempList[CORE.DARKBIOME_ID] = this; + mInternalBiomeList.set(null, mTempList); + if (mClone != mInternalBiomeList && mClone.hashCode() != mInternalBiomeList.hashCode()){ + ReflectionUtils.setFinalStatic(mInternalBiomeList, mTempList); + Logger.REFLECTION("Set Biome ID for Dark World Biome internally in 'biomeList' field from "+BiomeGenBase.class.getCanonicalName()+"."); + return true; + } + else { + Logger.REFLECTION("Failed to set Biome ID for Dark World Biome internally in 'biomeList' field from "+BiomeGenBase.class.getCanonicalName()+"."); + } + } + return false; + } + catch (Exception e) { + Logger.REFLECTION("Could not access 'biomeList' field in "+BiomeGenBase.class.getCanonicalName()+"."); + return false; + } } @SideOnly(Side.CLIENT) @@ -122,8 +128,8 @@ public class Biome_DarkWorld { public int getSkyColorByTemp(float par1) { return 0xF67A14; } - - @SuppressWarnings("unchecked") + + @SuppressWarnings({ "unchecked", "unused" }) private boolean addToMonsterSpawnLists(Class<?> EntityClass, int a, int b, int c){ //this.spawnableMonsterList.add(new SpawnListEntry(EntityClass, a, b, c)); this.spawnableCaveCreatureList.add(new SpawnListEntry(EntityClass, a, b, c)); diff --git a/src/Java/gtPlusPlus/core/world/darkworld/block/DarkWorldContentLoader.java b/src/Java/gtPlusPlus/core/world/darkworld/block/DarkWorldContentLoader.java new file mode 100644 index 0000000000..1af92c0d3f --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/block/DarkWorldContentLoader.java @@ -0,0 +1,68 @@ +package gtPlusPlus.core.world.darkworld.block; + +import static gtPlusPlus.core.world.darkworld.Dimension_DarkWorld.*; + +import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.core.block.base.BlockBaseFluid; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.world.darkworld.item.itemDarkWorldPortalTrigger; +import net.minecraft.init.Blocks; +import net.minecraftforge.fluids.FluidRegistry; + +public class DarkWorldContentLoader { + + //Static Vars + public static blockDarkWorldSludgeFluid SLUDGE; + + + public synchronized static void run() { + initMisc(); + initItems(); + initBlocks(); + } + + public synchronized static boolean initMisc(){ + + //Fluids + SLUDGE = (blockDarkWorldSludgeFluid) new blockDarkWorldSludgeFluid( + "sludge", + Utils.rgbtoHexValue(30, 130, 30)) + .setDensity(1800) + .setGaseous(false) + .setLuminosity(2) + .setViscosity(25000) + .setTemperature(300); + FluidRegistry.registerFluid(SLUDGE); + + return true; + } + + public synchronized static boolean initItems(){ + portalItem = (itemDarkWorldPortalTrigger) (new itemDarkWorldPortalTrigger().setUnlocalizedName("dimensionDarkWorld_trigger")); + GameRegistry.registerItem(portalItem, "dimensionDarkWorld_trigger"); + + return true; + } + + public synchronized static boolean initBlocks(){ + + //Create Block Instances + blockFluidLakes = new BlockBaseFluid("Sludge", SLUDGE, blockDarkWorldSludgeFluid.SLUDGE).setLightLevel(2f).setLightOpacity(1); + portalBlock = new blockDarkWorldPortal(); + blockTopLayer = new blockDarkWorldGround(); + blockSecondLayer = new blockDarkWorldPollutedDirt(); + blockPortalFrame = new blockDarkWorldPortalFrame(); + + //Registry + GameRegistry.registerBlock(blockTopLayer, "blockDarkWorldGround"); + GameRegistry.registerBlock(blockSecondLayer, "blockDarkWorldGround2"); + GameRegistry.registerBlock(blockPortalFrame, "blockDarkWorldPortalFrame"); + + //Make Flammable + Blocks.fire.setFireInfo(blockTopLayer, 30, 20); + + return true; + } + + +} diff --git a/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldSludgeFluid.java b/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldSludgeFluid.java new file mode 100644 index 0000000000..c3c9beddc8 --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldSludgeFluid.java @@ -0,0 +1,98 @@ +package gtPlusPlus.core.world.darkworld.block; + +import net.minecraft.block.material.*; +import net.minecraftforge.fluids.Fluid; + +public class blockDarkWorldSludgeFluid extends Fluid { + + + public static final Material SLUDGE = new MaterialLiquid(MapColor.dirtColor); + + protected static int mapColor = 0xFFFFFFFF; + protected static float overlayAlpha = 0.2F; + //protected static SoundEvent emptySound = SoundEvents.ITEM_BUCKET_EMPTY; + //protected static SoundEvent fillSound = SoundEvents.ITEM_BUCKET_FILL; + protected static Material material = SLUDGE; + + + public blockDarkWorldSludgeFluid(String fluidName, int rgbColour) { + this(fluidName, rgbColour, null); + } + + public blockDarkWorldSludgeFluid(String fluidName, int rgbColour, Float overlayAlpha) { + super(fluidName); + setColor(rgbColour); + if (overlayAlpha != null){ + setAlpha(overlayAlpha.floatValue()); + } + else { + setAlpha(0); + } + } + + @Override + public int getColor() + { + return mapColor; + } + + public blockDarkWorldSludgeFluid setColor(int parColor) + { + mapColor = parColor; + return this; + } + + public float getAlpha() + { + return overlayAlpha; + } + + public blockDarkWorldSludgeFluid setAlpha(float parOverlayAlpha) + { + overlayAlpha = parOverlayAlpha; + return this; + } + + /*public blockDarkWorldSludgeFluid setEmptySound(SoundEvent parSound) + { + emptySound = parSound; + return this; + } + + public SoundEvent getEmptySound() + { + return emptySound; + } + + @Override + public blockDarkWorldSludgeFluid setFillSound(SoundEvent parSound) + { + fillSound = parSound; + return this; + } + + @Override + public SoundEvent getFillSound() + { + return fillSound; + }*/ + + public blockDarkWorldSludgeFluid setMaterial(Material parMaterial) + { + material = parMaterial; + return this; + } + + public Material getMaterial() + { + return material; + } + + /*@Override + public boolean doesVaporize(FluidStack fluidStack) + { + if (block == null) + return false; + return block.getDefaultState().getMaterial() == getMaterial(); + }*/ +} diff --git a/src/Java/gtPlusPlus/core/world/darkworld/chunk/ChunkProviderModded.java b/src/Java/gtPlusPlus/core/world/darkworld/chunk/ChunkProviderModded.java index 1695714eff..82b21d7c0d 100644 --- a/src/Java/gtPlusPlus/core/world/darkworld/chunk/ChunkProviderModded.java +++ b/src/Java/gtPlusPlus/core/world/darkworld/chunk/ChunkProviderModded.java @@ -171,7 +171,12 @@ public class ChunkProviderModded implements IChunkProvider { p_147424_3_[j3 += short1] = Dimension_DarkWorld.blockMainFiller; } else if (k2 * 8 + l2 < b0) { - p_147424_3_[j3 += short1] = Blocks.water; //River Fluid + try { + p_147424_3_[j3 += short1] = Dimension_DarkWorld.blockFluidLakes; //River Fluid . + } + catch (Throwable t){ + p_147424_3_[j3 += short1] = Blocks.water; //River Fluid Fallback + } } else { p_147424_3_[j3 += short1] = null; diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java b/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java index 9e24eb5a53..37e479efd2 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java @@ -1,7 +1,5 @@ package gtPlusPlus.xmod.forestry.bees.custom; -import static gtPlusPlus.GTplusplus.mGregMatLoader; - import java.lang.reflect.*; import org.apache.commons.lang3.reflect.FieldUtils; @@ -76,7 +74,7 @@ public class GTPP_Bees { private void setCustomItems() { dropForceGem = new BaseItemMisc("Force", new short[]{250, 250, 20}, 64, MiscTypes.GEM, null); - mGregMatLoader.enableMaterial(Materials.Force); + //mGregMatLoader.enableMaterial(Materials.Force); //MaterialUtils.tryEnableMaterial(Materials.Force); //MaterialUtils.tryEnableMaterialPart(OrePrefixes.dust, Materials.Force); //MaterialUtils.tryEnableMaterialPart(OrePrefixes.ingot, Materials.Force); @@ -85,8 +83,8 @@ public class GTPP_Bees { //Nikolite may not exist, so lets make it. dropNikoliteDust = ItemUtils.generateSpecialUseDusts("Nikolite", "Nikolite", Utils.rgbtoHexValue(60, 180, 200))[2]; - mGregMatLoader.enableMaterial(Materials.BlueAlloy); - mGregMatLoader.enableMaterial(Materials.Nikolite); + //mGregMatLoader.enableMaterial(Materials.BlueAlloy); + //mGregMatLoader.enableMaterial(Materials.Nikolite); //MaterialUtils.tryEnableMaterial(Materials.Nikolite); //MaterialUtils.tryEnableMaterialPart(OrePrefixes.dust, Materials.Nikolite); //MaterialUtils.tryEnableMaterialPart(OrePrefixes.ingot, Materials.Nikolite); diff --git a/src/Java/gtPlusPlus/xmod/forestry/trees/TreefarmManager.java b/src/Java/gtPlusPlus/xmod/forestry/trees/TreefarmManager.java index 9aea37e0d4..155feae83c 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/trees/TreefarmManager.java +++ b/src/Java/gtPlusPlus/xmod/forestry/trees/TreefarmManager.java @@ -100,10 +100,10 @@ public class TreefarmManager { public static boolean isSapling(final Block log){ if (log != null){ if (OrePrefixes.sapling.contains(new ItemStack(log, 1))){ - Logger.INFO(""+log.getLocalizedName()); + Logger.WARNING(""+log.getLocalizedName()); } if (log.getLocalizedName().toLowerCase().contains("sapling")){ - Logger.INFO(""+log.getLocalizedName()); + Logger.WARNING(""+log.getLocalizedName()); return true; } } diff --git a/src/Java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java b/src/Java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java index 0480641e32..fe9a82c6b5 100644 --- a/src/Java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java +++ b/src/Java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java @@ -1,8 +1,5 @@ package gtPlusPlus.xmod.thermalfoundation; -import static gtPlusPlus.GTplusplus.mGregMatLoader; - -import gregtech.api.enums.Materials; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.xmod.thermalfoundation.block.TF_Blocks; @@ -19,7 +16,7 @@ public class HANDLER_TF{ TF_Blocks.preInit(); if (LoadedMods.Gregtech){ if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - mGregMatLoader.enableMaterial(Materials.Enderium); + //mGregMatLoader.enableMaterial(Materials.Enderium); } } } |