diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 1a9438c41..e745ad561 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -495,11 +495,13 @@ public class ModBlocks { public static Block glass_ash; public static Block glass_quartz; - public static Block mush; public static Block mush_block; public static Block mush_block_stem; + public static Block glyphid_base; + public static Block glyphid_spawner; + public static Block plant_flower; public static Block plant_tall; public static Block plant_dead; @@ -1695,6 +1697,8 @@ public class ModBlocks { mush = new BlockMush(Material.plants).setBlockName("mush").setCreativeTab(MainRegistry.blockTab).setLightLevel(0.5F).setStepSound(Block.soundTypeGrass).setBlockTextureName(RefStrings.MODID + ":mush"); mush_block = new BlockMushHuge(Material.plants).setBlockName("mush_block").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_skin"); mush_block_stem = new BlockMushHuge(Material.plants).setBlockName("mush_block_stem").setLightLevel(1.0F).setStepSound(Block.soundTypeGrass).setHardness(0.2F).setBlockTextureName(RefStrings.MODID + ":mush_block_stem"); + glyphid_base = new BlockBase(Material.coral).setBlockName("glyphid_base").setStepSound(Block.soundTypeCloth).setHardness(0.5F); + glyphid_spawner = new BlockGlyphidSpawner(Material.coral).setBlockName("glyphid_spawner").setStepSound(Block.soundTypeCloth).setHardness(0.5F).setBlockTextureName(RefStrings.MODID + ":glyphid_base"); plant_flower = new BlockNTMFlower().setBlockName("plant_flower").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGrass).setHardness(0.0F); plant_tall = new BlockTallPlant().setBlockName("plant_tall").setCreativeTab(MainRegistry.blockTab).setStepSound(Block.soundTypeGrass).setHardness(0.0F); @@ -2836,6 +2840,8 @@ public class ModBlocks { GameRegistry.registerBlock(mush, mush.getUnlocalizedName()); GameRegistry.registerBlock(mush_block, mush_block.getUnlocalizedName()); GameRegistry.registerBlock(mush_block_stem, mush_block_stem.getUnlocalizedName()); + GameRegistry.registerBlock(glyphid_base, glyphid_base.getUnlocalizedName()); + GameRegistry.registerBlock(glyphid_spawner, glyphid_spawner.getUnlocalizedName()); GameRegistry.registerBlock(moon_turf, moon_turf.getUnlocalizedName()); //Waste diff --git a/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java b/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java new file mode 100644 index 000000000..155b256fc --- /dev/null +++ b/src/main/java/com/hbm/blocks/generic/BlockGlyphidSpawner.java @@ -0,0 +1,49 @@ +package com.hbm.blocks.generic; + +import java.util.List; + +import com.hbm.entity.mob.EntityGlyphid; +import com.hbm.entity.mob.EntityGlyphidScout; + +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public class BlockGlyphidSpawner extends BlockContainer { + + public BlockGlyphidSpawner(Material p_i45386_1_) { + super(p_i45386_1_); + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) { + return new TileEntityGlpyhidSpawner(); + } + + public static class TileEntityGlpyhidSpawner extends TileEntity { + + @Override + public void updateEntity() { + + if(!worldObj.isRemote && worldObj.getTotalWorldTime() % 60 == 0 && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL) { + + List list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 4, yCoord + 1, zCoord - 4, xCoord + 5, yCoord + 4, zCoord + 5)); + + if(list.size() < 3) { + EntityGlyphid glyphid = new EntityGlyphid(worldObj); + glyphid.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F); + this.worldObj.spawnEntityInWorld(glyphid); + } + + if(worldObj.rand.nextInt(20) == 0) { + EntityGlyphidScout scout = new EntityGlyphidScout(worldObj); + scout.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F); + this.worldObj.spawnEntityInWorld(scout); + } + } + } + } +} diff --git a/src/main/java/com/hbm/entity/EntityMappings.java b/src/main/java/com/hbm/entity/EntityMappings.java index c50d13566..d231fa8b6 100644 --- a/src/main/java/com/hbm/entity/EntityMappings.java +++ b/src/main/java/com/hbm/entity/EntityMappings.java @@ -245,6 +245,7 @@ public class EntityMappings { addMob(EntityGlyphidBrenda.class, "entity_glyphid_brenda", 0x4FC0C0, 0xA0A0A0); addMob(EntityGlyphidBombardier.class, "entity_glyphid_bombardier", 0xDDD919, 0xDBB79D); addMob(EntityGlyphidBlaster.class, "entity_glyphid_blaster", 0xD83737, 0xDBB79D); + addMob(EntityGlyphidScout.class, "entity_glyphid_scout", 0x273038, 0xB9E36B); addSpawn(EntityCreeperPhosgene.class, 5, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray()); addSpawn(EntityCreeperVolatile.class, 10, 1, 1, EnumCreatureType.monster, BiomeGenBase.getBiomeGenArray()); diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java index 92fd49785..230fd56c2 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphid.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphid.java @@ -19,6 +19,7 @@ import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -197,4 +198,16 @@ public class EntityGlyphid extends EntityMob { public EnumCreatureAttribute getCreatureAttribute() { return EnumCreatureAttribute.ARTHROPOD; } + + @Override + public void writeEntityToNBT(NBTTagCompound nbt) { + super.writeEntityToNBT(nbt); + nbt.setByte("armor", this.dataWatcher.getWatchableObjectByte(17)); + } + + @Override + public void readEntityFromNBT(NBTTagCompound nbt) { + super.readEntityFromNBT(nbt); + this.dataWatcher.updateObject(17, nbt.getByte("armor")); + } } diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java index 309ac38fb..bdce3e7bc 100644 --- a/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidBrenda.java @@ -12,7 +12,7 @@ public class EntityGlyphidBrenda extends EntityGlyphid { public EntityGlyphidBrenda(World world) { super(world); - this.setSize(2.5F, 2F); + this.setSize(2.5F, 1.75F); this.isImmuneToFire = true; } diff --git a/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java new file mode 100644 index 000000000..ae20a35a8 --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/EntityGlyphidScout.java @@ -0,0 +1,102 @@ +package com.hbm.entity.mob; + +import com.hbm.blocks.ModBlocks; +import com.hbm.main.ResourceManager; +import com.hbm.world.feature.GlyphidHive; + +import net.minecraft.block.Block; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class EntityGlyphidScout extends EntityGlyphid { + + public boolean hasHome = false; + public double homeX; + public double homeY; + public double homeZ; + + public EntityGlyphidScout(World world) { + super(world); + this.setSize(1.25F, 0.75F); + } + + @Override + public float getDamageThreshold() { + return 0.0F; + } + + @Override + public ResourceLocation getSkin() { + return ResourceManager.glyphid_scout_tex; + } + + @Override + public double getScale() { + return 0.75D; + } + + @Override + public int getArmorBreakChance(float amount) { + return 1; + } + + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(16D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.5D); + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2D); + } + + @Override + protected boolean canDespawn() { + return true; + } + + @Override + public void onUpdate() { + super.onUpdate(); + + if(!worldObj.isRemote) { + + if(!this.hasHome) { + this.homeX = posX; + this.homeY = posY; + this.homeZ = posZ; + this.hasHome = true; + } + + if(this.ticksExisted > 0 && this.ticksExisted % 1200 == 0 && Vec3.createVectorHelper(posX - homeX, posY - homeY, posZ - homeZ).lengthVector() > 16) { + + Block b = worldObj.getBlock((int) Math.floor(posX), (int) Math.floor(posY - 1), (int) Math.floor(posZ)); + + if(b.isNormalCube() && b != ModBlocks.glyphid_base) { + this.setDead(); + worldObj.newExplosion(this, posX, posY, posZ, 5F, false, false); + GlyphidHive.generate(worldObj, (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), rand); + } + } + } + } + + @Override + public void writeEntityToNBT(NBTTagCompound nbt) { + super.writeEntityToNBT(nbt); + nbt.setBoolean("hasHome", hasHome); + nbt.setDouble("homeX", homeX); + nbt.setDouble("homeY", homeY); + nbt.setDouble("homeZ", homeZ); + } + + @Override + public void readEntityFromNBT(NBTTagCompound nbt) { + super.readEntityFromNBT(nbt); + this.hasHome = nbt.getBoolean("hasHome"); + this.homeX = nbt.getDouble("homeX"); + this.homeY = nbt.getDouble("homeY"); + this.homeZ = nbt.getDouble("homeZ"); + } +} diff --git a/src/main/java/com/hbm/lib/HbmWorldGen.java b/src/main/java/com/hbm/lib/HbmWorldGen.java index 2d1bd69c5..04c41da43 100644 --- a/src/main/java/com/hbm/lib/HbmWorldGen.java +++ b/src/main/java/com/hbm/lib/HbmWorldGen.java @@ -34,6 +34,7 @@ import com.hbm.world.feature.DepthDeposit; import com.hbm.world.feature.Dud; import com.hbm.world.feature.Geyser; import com.hbm.world.feature.GeyserLarge; +import com.hbm.world.feature.GlyphidHive; import com.hbm.world.feature.Meteorite; import com.hbm.world.feature.OilBubble; import com.hbm.world.feature.OilSandBubble; @@ -216,6 +217,13 @@ public class HbmWorldGen implements IWorldGenerator { } if(GeneralConfig.enableDungeons && world.provider.isSurfaceWorld()) { + + if(rand.nextInt(1000) == 0) { + int x = i + rand.nextInt(16) + 8; + int z = j + rand.nextInt(16) + 8; + int y = world.getHeightValue(x, z); + GlyphidHive.generate(world, x, y, z, rand); + } if(biome == BiomeGenBase.plains || biome == BiomeGenBase.desert) { if(WorldConfig.radioStructure > 0 && rand.nextInt(WorldConfig.radioStructure) == 0) { diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index f171c9f71..8f491ea8d 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -729,6 +729,7 @@ public class ClientProxy extends ServerProxy { RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBrenda.class, new RenderGlyphid()); RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBombardier.class, new RenderGlyphid()); RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidBlaster.class, new RenderGlyphid()); + RenderingRegistry.registerEntityRenderingHandler(EntityGlyphidScout.class, new RenderGlyphid()); //"particles" RenderingRegistry.registerEntityRenderingHandler(EntitySmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.smoke1, ModItems.smoke2, ModItems.smoke3, ModItems.smoke4, ModItems.smoke5, ModItems.smoke6, ModItems.smoke7, ModItems.smoke8 })); RenderingRegistry.registerEntityRenderingHandler(EntityBSmokeFX.class, new MultiCloudRenderer(new Item[] { ModItems.b_smoke1, ModItems.b_smoke2, ModItems.b_smoke3, ModItems.b_smoke4, ModItems.b_smoke5, ModItems.b_smoke6, ModItems.b_smoke7, ModItems.b_smoke8 })); diff --git a/src/main/java/com/hbm/main/ResourceManager.java b/src/main/java/com/hbm/main/ResourceManager.java index 9f3b71fdb..1f9716a94 100644 --- a/src/main/java/com/hbm/main/ResourceManager.java +++ b/src/main/java/com/hbm/main/ResourceManager.java @@ -665,6 +665,7 @@ public class ResourceManager { public static final ResourceLocation glyphid_brenda_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_brenda.png"); public static final ResourceLocation glyphid_bombardier_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_bombardier.png"); public static final ResourceLocation glyphid_blaster_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_blaster.png"); + public static final ResourceLocation glyphid_scout_tex = new ResourceLocation(RefStrings.MODID, "textures/entity/glyphid_scout.png"); //ZIRNOX public static final ResourceLocation zirnox_tex = new ResourceLocation(RefStrings.MODID, "textures/models/zirnox.png"); diff --git a/src/main/java/com/hbm/tileentity/TileMappings.java b/src/main/java/com/hbm/tileentity/TileMappings.java index f7098e052..e9ba74599 100644 --- a/src/main/java/com/hbm/tileentity/TileMappings.java +++ b/src/main/java/com/hbm/tileentity/TileMappings.java @@ -9,6 +9,7 @@ import com.hbm.blocks.generic.BlockBedrockOreTE.TileEntityBedrockOre; import com.hbm.blocks.generic.BlockBobble.TileEntityBobble; import com.hbm.blocks.generic.BlockDynamicSlag.TileEntitySlag; import com.hbm.blocks.generic.BlockEmitter.TileEntityEmitter; +import com.hbm.blocks.generic.BlockGlyphidSpawner.TileEntityGlpyhidSpawner; import com.hbm.blocks.generic.BlockLoot.TileEntityLoot; import com.hbm.blocks.generic.BlockMotherOfAllOres.TileEntityRandomOre; import com.hbm.blocks.generic.BlockSnowglobe.TileEntitySnowglobe; @@ -193,6 +194,7 @@ public class TileMappings { put(TileEntityPipeGauge.class, "tileentity_pipe_gauge"); put(TileEntityMachineBAT9000.class, "tileentity_bat9000"); put(TileEntityMachineOrbus.class, "tileentity_orbus"); + put(TileEntityGlpyhidSpawner.class, "tileentity_glyphid_spawner"); put(TileEntityLoot.class, "tileentity_ntm_loot"); put(TileEntityBobble.class, "tileentity_ntm_bobblehead"); diff --git a/src/main/java/com/hbm/world/feature/GlyphidHive.java b/src/main/java/com/hbm/world/feature/GlyphidHive.java new file mode 100644 index 000000000..5c60e3ff2 --- /dev/null +++ b/src/main/java/com/hbm/world/feature/GlyphidHive.java @@ -0,0 +1,128 @@ +package com.hbm.world.feature; + +import java.util.Random; + +import com.hbm.blocks.ModBlocks; + +import net.minecraft.init.Blocks; +import net.minecraft.world.World; + +public class GlyphidHive { + + public static final int[][][] schematic = new int[][][] { + { + {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,1,1,1,0,0,0,0}, + {0,0,0,1,1,1,1,1,0,0,0}, + {0,0,0,1,1,1,1,1,0,0,0}, + {0,0,0,1,1,1,1,1,0,0,0}, + {0,0,0,0,1,1,1,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + }, + { + {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,1,1,1,0,0,0,0}, + {0,0,0,1,1,9,1,1,0,0,0}, + {0,0,1,1,9,9,9,1,1,0,0}, + {0,0,1,9,9,9,9,9,1,0,0}, + {0,0,1,1,9,9,9,1,1,0,0}, + {0,0,0,1,1,9,1,1,0,0,0}, + {0,0,0,0,1,1,1,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + }, + { + {0,0,0,0,0,0,0,0,0,0,0}, + {0,0,0,0,4,4,4,0,0,0,0}, + {0,0,0,1,1,9,1,1,0,0,0}, + {0,0,1,1,9,9,9,1,1,0,0}, + {0,3,1,9,9,9,9,9,1,5,0}, + {0,3,9,9,9,9,9,9,9,5,0}, + {0,3,1,9,9,9,9,9,1,5,0}, + {0,0,1,1,9,9,9,1,1,0,0}, + {0,0,0,1,1,9,1,1,0,0,0}, + {0,0,0,0,2,2,2,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + }, + { + {0,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,1,1,1,0,0}, + {0,0,0,1,1,1,1,1,0,0,0}, + {0,0,0,0,1,1,1,0,0,0,0}, + {0,0,0,0,0,0,0,0,0,0,0}, + } + }; + + public static void generate(World world, int x, int y, int z, Random rand) { + + int orientation = rand.nextInt(4) + 2; + + for(int i = 0; i < 11; i++) { + for(int j = 0; j < 7; j++) { + for(int k = 0; k < 11; k++) { + + int block = schematic[6 - j][i][k]; + + if(block == 1 || (block != orientation && block > 1 && block < 6)) { + world.setBlock(x + i - 5, y + j - 2, z + k - 5, ModBlocks.glyphid_base); + } + if(block == 9) { + world.setBlock(x + i - 5, y + j - 2, z + k - 5, Blocks.air); + } + } + } + } + + world.setBlock(x, y - 1, z, ModBlocks.glyphid_spawner); + } +} diff --git a/src/main/resources/assets/hbm/textures/blocks/glyphid_base.png b/src/main/resources/assets/hbm/textures/blocks/glyphid_base.png new file mode 100644 index 000000000..ef6bca815 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/glyphid_base.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/glyphid_base_2.png b/src/main/resources/assets/hbm/textures/blocks/glyphid_base_2.png new file mode 100644 index 000000000..541a53c5f Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/glyphid_base_2.png differ diff --git a/src/main/resources/assets/hbm/textures/entity/glyphid_scout.png b/src/main/resources/assets/hbm/textures/entity/glyphid_scout.png new file mode 100644 index 000000000..23a2eee98 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/entity/glyphid_scout.png differ