From 49698581778bf856beeaf37e44ec4144d5902b7b Mon Sep 17 00:00:00 2001 From: Flan Date: Thu, 1 Mar 2018 16:57:39 +0000 Subject: [PATCH] Lots of apoc fixes --- .../client/ClientProxyApocalypse.java | 13 +- .../common/CommonProxyApocalypse.java | 4 +- .../apocalypse/common/FlansModApocalypse.java | 30 ++++- .../common/FlansModLootGenerator.java | 14 ++- .../common/blocks/BlockPowerCube.java | 26 +--- .../common/blocks/BlockSulphuricAcid.java | 111 ++---------------- .../common/entity/EntityFlyByPlane.java | 5 + .../common/entity/EntityTeleporter.java | 9 +- .../common/world/ChunkProviderApocalypse.java | 4 +- .../world/buildings/WorldGenRunway.java | 4 +- .../client/model/RenderItemHolder.java | 6 + .../com/flansmod/common/BlockItemHolder.java | 33 ++---- .../flansmod/common/TileEntityItemHolder.java | 31 ++++- .../flansmod/common/teams/BlockSpawner.java | 37 +----- .../flansmod/common/teams/TeamsManager.java | 2 +- .../common/teams/TeamsManagerRanked.java | 6 + .../models/item/teamsspawner_items.json | 4 +- .../flansmodapocalypse/blockstates/fluid.json | 50 -------- .../blockstates/sulphuricacid.json | 12 ++ .../{labstone.json => itemblocklabstone.json} | 0 ...powercube.json => itemblockpowercube.json} | 0 .../models/item/itemblocksulphur.json | 10 ++ 22 files changed, 159 insertions(+), 252 deletions(-) delete mode 100644 src/main/resources/assets/flansmodapocalypse/blockstates/fluid.json create mode 100644 src/main/resources/assets/flansmodapocalypse/blockstates/sulphuricacid.json rename src/main/resources/assets/flansmodapocalypse/models/item/{labstone.json => itemblocklabstone.json} (100%) rename src/main/resources/assets/flansmodapocalypse/models/item/{powercube.json => itemblockpowercube.json} (100%) create mode 100644 src/main/resources/assets/flansmodapocalypse/models/item/itemblocksulphur.json diff --git a/src/main/java/com/flansmod/apocalypse/client/ClientProxyApocalypse.java b/src/main/java/com/flansmod/apocalypse/client/ClientProxyApocalypse.java index 3cb40c175..49dc3e564 100644 --- a/src/main/java/com/flansmod/apocalypse/client/ClientProxyApocalypse.java +++ b/src/main/java/com/flansmod/apocalypse/client/ClientProxyApocalypse.java @@ -15,6 +15,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; @@ -39,6 +40,7 @@ import com.flansmod.apocalypse.client.model.RenderTeleporter; import com.flansmod.apocalypse.common.CommonProxyApocalypse; import com.flansmod.apocalypse.common.FlansModApocalypse; +import com.flansmod.apocalypse.common.blocks.BlockSulphuricAcid; import com.flansmod.apocalypse.common.blocks.TileEntityPowerCube; import com.flansmod.apocalypse.common.entity.EntityAIMecha; import com.flansmod.apocalypse.common.entity.EntityFakePlayer; @@ -68,6 +70,10 @@ public class ClientProxyApocalypse extends CommonProxyApocalypse public void preInit(FMLPreInitializationEvent event) { super.preInit(event); + + MinecraftForge.EVENT_BUS.register(this); + + ((BlockSulphuricAcid)FlansModApocalypse.blockSulphuricAcid).registerRenderer(); } public void init(FMLInitializationEvent event) @@ -99,8 +105,9 @@ public static void updateApocalypseCountdownTimer(int i) } @SubscribeEvent - public static void registerModels(ModelRegistryEvent event) + public void registerModels(ModelRegistryEvent event) { + /* Item item = Item.getItemFromBlock(FlansModApocalypse.blockSulphuricAcid); ModelBakery.registerItemVariants(item); final ModelResourceLocation modelResourceLocation = new ModelResourceLocation(FLUID_MODEL_PATH, FlansModApocalypse.sulphuricAcid.getName()); @@ -119,6 +126,10 @@ protected ModelResourceLocation getModelResourceLocation(IBlockState state) { return modelResourceLocation; } }); + */ + + ModelLoader.setCustomModelResourceLocation(FlansModApocalypse.itemBlockLabStone, 0, new ModelResourceLocation("flansmodapocalypse:itemblocklabstone", "inventory")); + ModelLoader.registerItemVariants(FlansModApocalypse.itemBlockLabStone, new ResourceLocation[] { new ResourceLocation("flansmodapocalypse:itemblocklabstone")}); } /** Tick hook for client logic */ diff --git a/src/main/java/com/flansmod/apocalypse/common/CommonProxyApocalypse.java b/src/main/java/com/flansmod/apocalypse/common/CommonProxyApocalypse.java index f8f2d3c31..cbea85630 100644 --- a/src/main/java/com/flansmod/apocalypse/common/CommonProxyApocalypse.java +++ b/src/main/java/com/flansmod/apocalypse/common/CommonProxyApocalypse.java @@ -102,12 +102,14 @@ public void registerEntities(RegistryEvent.Register event) event.getRegistry().register(new EntityEntry(EntityAIMecha.class, "AIMecha").setRegistryName("AIMecha")); event.getRegistry().register(new EntityEntry(EntityFakePlayer.class, "FakePlayer").setRegistryName("FakePlayer")); event.getRegistry().register(new EntityEntry(EntityNukeDrop.class, "NukeDrop").setRegistryName("NukeDrop")); + event.getRegistry().register(new EntityEntry(EntityFlyByPlane.class, "FlyByPlane").setRegistryName("FlyByPlane")); - //EntityRegistry.registerModEntity(new ResourceLocation("flansmodapocalypse:Survivor"), EntitySurvivor.class, "Survivor", 89, FlansModApocalypse.INSTANCE, 100, 20, true, 0, 0); + //EntityRegistry.registerModEntity(new ResourceLocation("flansmodapocalypse:Survivor"), EntitySurvivor.class, "Survivor", 112, FlansModApocalypse.INSTANCE, 100, 20, true, 0, 0); EntityRegistry.registerModEntity(new ResourceLocation("flansmodapocalypse:Teleporter"), EntityTeleporter.class, "Teleporter", 113, FlansModApocalypse.INSTANCE, 100, 20, true); EntityRegistry.registerModEntity(new ResourceLocation("flansmodapocalypse:AIMecha"), EntityAIMecha.class, "AIMecha", 114, FlansModApocalypse.INSTANCE, 250, 20, false); EntityRegistry.registerModEntity(new ResourceLocation("flansmodapocalypse:FakePlayer"), EntityFakePlayer.class, "FakePlayer", 115, FlansModApocalypse.INSTANCE, 250, 20, false); EntityRegistry.registerModEntity(new ResourceLocation("flansmodapocalypse:NukeDrop"), EntityNukeDrop.class, "NukeDrop", 116, FlansModApocalypse.INSTANCE, 250, 20, false); + EntityRegistry.registerModEntity(new ResourceLocation("flansmodapocalypse:FlyByPlane"), EntityFlyByPlane.class, "FlyByPlane", 117, FlansModApocalypse.INSTANCE, 250, 20, false); } /** Tick hook for server */ diff --git a/src/main/java/com/flansmod/apocalypse/common/FlansModApocalypse.java b/src/main/java/com/flansmod/apocalypse/common/FlansModApocalypse.java index 400258f9b..2758cc041 100644 --- a/src/main/java/com/flansmod/apocalypse/common/FlansModApocalypse.java +++ b/src/main/java/com/flansmod/apocalypse/common/FlansModApocalypse.java @@ -23,6 +23,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.Ingredient; @@ -93,15 +94,25 @@ public class FlansModApocalypse public static Block blockLabStone; public static Block blockPowerCube; + public static Item itemBlockPowerCube, itemBlockLabStone, itemBlockSulphur; + public static CreativeTabFlan tabApocalypse = new CreativeTabFlan(5); //References to apocalypse specific items and blocks: public static BlockItemHolder skeleton, slumpedSkeleton, gunRack; + + static + { + FluidRegistry.enableUniversalBucket(); + } @SubscribeEvent public void registerItems(RegistryEvent.Register event) { event.getRegistry().register(sulphur); + event.getRegistry().register(itemBlockLabStone); + event.getRegistry().register(itemBlockSulphur); + event.getRegistry().register(itemBlockPowerCube); } @SubscribeEvent @@ -151,6 +162,8 @@ public void preInit(FMLPreInitializationEvent event) blockSulphur = new BlockSulphur().setUnlocalizedName("blockSulphur").setRegistryName("blockSulphur").setCreativeTab(tabApocalypse); sulphur = new Item().setUnlocalizedName("flanSulphur").setRegistryName("flanSulphur").setCreativeTab(tabApocalypse); + itemBlockSulphur = new ItemBlock(blockSulphur).setUnlocalizedName("blockSulphur").setRegistryName("itemBlockSulphur").setCreativeTab(tabApocalypse); + //Sulphuric acid sulphuricAcid = new Fluid("sulphuricAcid", sulphuricAcidStill, sulphuricAcidFlowing).setTemperature(300).setViscosity(800); if(FluidRegistry.registerFluid(sulphuricAcid)) @@ -158,6 +171,7 @@ public void preInit(FMLPreInitializationEvent event) blockSulphuricAcid = new BlockSulphuricAcid(sulphuricAcid, Material.WATER).setUnlocalizedName("blockSulphuricAcid").setRegistryName("blockSulphuricAcid").setCreativeTab(tabApocalypse); sulphuricAcid.setBlock(blockSulphuricAcid); sulphuricAcid.setUnlocalizedName(blockSulphuricAcid.getUnlocalizedName()); + FluidRegistry.addBucketForFluid(sulphuricAcid); } else { @@ -167,9 +181,11 @@ public void preInit(FMLPreInitializationEvent event) //Laboratory Stone blockLabStone = new BlockStatic(Material.ROCK).setHardness(3F).setResistance(5F).setUnlocalizedName("labStone").setRegistryName("labStone").setCreativeTab(tabApocalypse); - + itemBlockLabStone = new ItemBlock(blockLabStone).setUnlocalizedName("labStone").setRegistryName("itemBlockLabStone").setCreativeTab(tabApocalypse); + //Power Cube blockPowerCube = new BlockPowerCube(Material.CIRCUITS).setUnlocalizedName("powerCube").setRegistryName("powerCube").setHardness(3F).setResistance(5F).setCreativeTab(tabApocalypse); + itemBlockPowerCube = new ItemBlock(blockPowerCube).setUnlocalizedName("powerCube").setRegistryName("itemBlockPowerCube").setCreativeTab(tabApocalypse); GameRegistry.registerTileEntity(TileEntityPowerCube.class, "powerCube"); proxy.preInit(event); @@ -189,15 +205,27 @@ public void init(FMLInitializationEvent event) skeleton = ItemHolderType.getItemHolder("flanSkeleton").block; skeleton.setCreativeTab(tabApocalypse); } + else + { + FlansMod.log("Could not find skeleton item holder!"); + } if(ItemHolderType.getItemHolder("flanSkeleton2") != null) { slumpedSkeleton = ItemHolderType.getItemHolder("flanSkeleton2").block; slumpedSkeleton.setCreativeTab(tabApocalypse); + } + else + { + FlansMod.log("Could not find skeleton2 item holder!"); } if(ItemHolderType.getItemHolder("flanGunRack") != null) { gunRack = ItemHolderType.getItemHolder("flanGunRack").block; gunRack.setCreativeTab(tabApocalypse); + } + else + { + FlansMod.log("Could not find gun rack item holder!"); } //Put ai chip in apocalypse tab diff --git a/src/main/java/com/flansmod/apocalypse/common/FlansModLootGenerator.java b/src/main/java/com/flansmod/apocalypse/common/FlansModLootGenerator.java index c05de9fd8..70ff038c7 100644 --- a/src/main/java/com/flansmod/apocalypse/common/FlansModLootGenerator.java +++ b/src/main/java/com/flansmod/apocalypse/common/FlansModLootGenerator.java @@ -128,6 +128,8 @@ public ItemStack getRandomLoadedGun(Random rand, boolean explosivesAllowed) } stack.getTagCompound().setTag("ammo", ammoTagsList); } + if(gunType.paintjobs.size() > 1) + stack.setItemDamage(rand.nextInt(gunType.paintjobs.size())); return stack; } @@ -351,11 +353,19 @@ public void fillWeaponChest(Random rand, TileEntityChest chest) { for(int i = 0; i < 3 + rand.nextInt(3); i++) { - chest.setInventorySlotContents(rand.nextInt(chest.getSizeInventory()), getRandomAmmo(rand)); + ItemStack stack = getRandomAmmo(rand); + if(stack != null) + { + chest.setInventorySlotContents(rand.nextInt(chest.getSizeInventory()), stack); + } } for(int i = 0; i < 1 + rand.nextInt(1); i++) { - chest.setInventorySlotContents(rand.nextInt(chest.getSizeInventory()), getRandomAttachment(rand)); + ItemStack stack = getRandomAttachment(rand); + if(stack != null) + { + chest.setInventorySlotContents(rand.nextInt(chest.getSizeInventory()), stack); + } } } diff --git a/src/main/java/com/flansmod/apocalypse/common/blocks/BlockPowerCube.java b/src/main/java/com/flansmod/apocalypse/common/blocks/BlockPowerCube.java index 38dec0076..075fe13d9 100644 --- a/src/main/java/com/flansmod/apocalypse/common/blocks/BlockPowerCube.java +++ b/src/main/java/com/flansmod/apocalypse/common/blocks/BlockPowerCube.java @@ -53,36 +53,20 @@ public boolean canPlaceBlockAt(World world, BlockPos pos) return world.getBlockState(pos.add(0, -1, 0)).isSideSolid(world, pos.add(0, -1, 0), EnumFacing.UP); } - /* + @Override - public boolean isOpaqueCube() + public boolean isOpaqueCube(IBlockState state) { return false; } - - - @Override - public void onEntityCollidedWithBlock(World par1World, BlockPos pos, Entity par5Entity) - { - } - + protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); @Override - public void setBlockBoundsBasedOnState(IBlockAccess access, BlockPos pos) + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { - setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1F, 1.0F); + return AABB; } - @Override - public void setBlockBoundsForItemRender() - { - float var1 = 0.5F; - float var2 = 0.5F; - float var3 = 0.5F; - this.setBlockBounds(0.0F, 0.5F - var2, 0.0F, 1F, 0.5F + var2, 1F); - } - */ - @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { diff --git a/src/main/java/com/flansmod/apocalypse/common/blocks/BlockSulphuricAcid.java b/src/main/java/com/flansmod/apocalypse/common/blocks/BlockSulphuricAcid.java index 545cabbdd..27d5bb29a 100644 --- a/src/main/java/com/flansmod/apocalypse/common/blocks/BlockSulphuricAcid.java +++ b/src/main/java/com/flansmod/apocalypse/common/blocks/BlockSulphuricAcid.java @@ -8,12 +8,14 @@ import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.block.statemap.StateMap; import net.minecraft.entity.Entity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; @@ -21,12 +23,11 @@ import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.IFluidBlock; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; public class BlockSulphuricAcid extends BlockFluidClassic { - public static final PropertyFloat HEIGHT_NW = new PropertyFloat("height_nw", 0F, 1F), HEIGHT_SW = new PropertyFloat("height_sw", 0F, 1F), - HEIGHT_SE = new PropertyFloat("height_se", 0F, 1F), HEIGHT_NE = new PropertyFloat("height_ne", 0F, 1F); - //public static final PropertyFloat FLOW_DIRECTION = new PropertyFloat("flow_direction"); public static final DamageSource acidDamage = new DamageSource("sulphuricAcid"); public BlockSulphuricAcid(Fluid fluid, Material material) @@ -41,107 +42,9 @@ public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState sta entity.attackEntityFrom(acidDamage, 5.0F); } - @Override - protected BlockStateContainer createBlockState() - { - return new ExtendedBlockState(this, new IProperty[] {LEVEL}, new IUnlistedProperty[] {HEIGHT_SW, HEIGHT_NW, HEIGHT_SE, HEIGHT_NE, FLOW_DIRECTION, LEVEL_CORNERS[0], LEVEL_CORNERS[1], LEVEL_CORNERS[2], LEVEL_CORNERS[3]}); - } - - @Override - public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) + @SideOnly(Side.CLIENT) + public void registerRenderer() { - state = super.getExtendedState(state, world, pos); - - float heightNW, heightSW, heightSE, heightNE; - float flow11 = getFluidHeightForRender(world, pos); - - if (flow11 != 1) - { - float flow00 = getFluidHeightForRender(world, pos.add(-1, 0, -1)); - float flow01 = getFluidHeightForRender(world, pos.add(-1, 0, 0)); - float flow02 = getFluidHeightForRender(world, pos.add(-1, 0, 1)); - float flow10 = getFluidHeightForRender(world, pos.add( 0, 0, -1)); - float flow12 = getFluidHeightForRender(world, pos.add( 0, 0, 1)); - float flow20 = getFluidHeightForRender(world, pos.add( 1, 0, -1)); - float flow21 = getFluidHeightForRender(world, pos.add( 1, 0, 0)); - float flow22 = getFluidHeightForRender(world, pos.add( 1, 0, 1)); - - heightNW = getFluidHeightAverage(new float[]{ flow00, flow01, flow10, flow11 }); - heightSW = getFluidHeightAverage(new float[]{ flow01, flow02, flow12, flow11 }); - heightSE = getFluidHeightAverage(new float[]{ flow12, flow21, flow22, flow11 }); - heightNE = getFluidHeightAverage(new float[]{ flow10, flow20, flow21, flow11 }); - } - else - { - heightNW = flow11; - heightSW = flow11; - heightSE = flow11; - heightNE = flow11; - } - - IExtendedBlockState extState = (IExtendedBlockState) state; - extState = extState.withProperty(HEIGHT_NW, heightNW).withProperty(HEIGHT_SW, heightSW); - extState = extState.withProperty(HEIGHT_SE, heightSE).withProperty(HEIGHT_NE, heightNE); - extState = extState.withProperty(FLOW_DIRECTION, (float) BlockFluidBase.getFlowDirection(world, pos)); - - return extState; + ModelLoader.setCustomStateMapper(this, new StateMap.Builder().ignore(LEVEL).build()); } - - /* - // TODO : [1.12] Fluids? - @Override - public boolean shouldSideBeRendered(IBlockAccess world, BlockPos pos, EnumFacing side) - { - if(side == EnumFacing.UP) - return world.getBlockState(pos).getBlock() != this; - else return super.shouldSideBeRendered(world, pos, side); - } - */ - - public float getFluidHeightForRender(IBlockAccess world, BlockPos pos) - { - IBlockState state = world.getBlockState(pos); - Block verticalOrigin = world.getBlockState(pos.down(this.densityDir)).getBlock(); - if (state.getBlock() == this) - { - if (state.getMaterial().isLiquid() || verticalOrigin instanceof IFluidBlock) - { - return 1; - } - - if ((Integer) state.getValue(LEVEL) == this.getMaxRenderHeightMeta()) - { - return 0.875F; - } - } - return !state.getMaterial().isSolid() && verticalOrigin == this ? 1 : this.getQuantaPercentage(world, pos) * 0.875F; - } - - @Override - public float getFluidHeightAverage(float... height) - { - float total = 0; - int count = 0; - - float end = 0; - - for (int i = 0; i < height.length; i++) - { - if (height[i] >= 0.875F && end != 1F) - { - end = height[i]; - } - - if (height[i] >= 0) - { - total += height[i]; - count++; - } - } - - if (end == 0) - end = total / count; - - return end; - } } \ No newline at end of file diff --git a/src/main/java/com/flansmod/apocalypse/common/entity/EntityFlyByPlane.java b/src/main/java/com/flansmod/apocalypse/common/entity/EntityFlyByPlane.java index 4c697e2e2..8ab404141 100644 --- a/src/main/java/com/flansmod/apocalypse/common/entity/EntityFlyByPlane.java +++ b/src/main/java/com/flansmod/apocalypse/common/entity/EntityFlyByPlane.java @@ -12,6 +12,11 @@ public class EntityFlyByPlane extends EntityPlane { + public EntityFlyByPlane(World world) + { + super(world); + } + public EntityFlyByPlane(World world, double x, double y, double z, PlaneType type, DriveableData data) { super(world, x, y, z, type, data); diff --git a/src/main/java/com/flansmod/apocalypse/common/entity/EntityTeleporter.java b/src/main/java/com/flansmod/apocalypse/common/entity/EntityTeleporter.java index 808e1d830..b4198aa64 100644 --- a/src/main/java/com/flansmod/apocalypse/common/entity/EntityTeleporter.java +++ b/src/main/java/com/flansmod/apocalypse/common/entity/EntityTeleporter.java @@ -196,9 +196,12 @@ protected void writeEntityToNBT(NBTTagCompound tags) tags.setInteger("X", lowerLeftCornerPowerCube.getX()); tags.setInteger("Y", lowerLeftCornerPowerCube.getY()); tags.setInteger("Z", lowerLeftCornerPowerCube.getZ()); - tags.setInteger("targetX", targetTeleporter.getX()); - tags.setInteger("targetY", targetTeleporter.getY()); - tags.setInteger("targetZ", targetTeleporter.getZ()); + if(targetTeleporter != null) + { + tags.setInteger("targetX", targetTeleporter.getX()); + tags.setInteger("targetY", targetTeleporter.getY()); + tags.setInteger("targetZ", targetTeleporter.getZ()); + } } } diff --git a/src/main/java/com/flansmod/apocalypse/common/world/ChunkProviderApocalypse.java b/src/main/java/com/flansmod/apocalypse/common/world/ChunkProviderApocalypse.java index 35f3c4c17..87785f5ea 100644 --- a/src/main/java/com/flansmod/apocalypse/common/world/ChunkProviderApocalypse.java +++ b/src/main/java/com/flansmod/apocalypse/common/world/ChunkProviderApocalypse.java @@ -225,7 +225,7 @@ public Chunk generateChunk(int x, int z) this.biomesForGeneration = this.world.getBiomeProvider().getBiomes(this.biomesForGeneration, x * 16, z * 16, 16, 16); this.replaceBiomeBlocks(x, z, chunkprimer, this.biomesForGeneration); - this.ravineGenerator.generate(this.world, x, z, chunkprimer); + //this.ravineGenerator.generate(this.world, x, z, chunkprimer); this.mineshaftGenerator.generate(this.world, x, z, chunkprimer); this.villageGenerator.generate(this.world, x, z, chunkprimer); @@ -446,7 +446,7 @@ public void populate(int x, int z) } //Generate runway section xOffset at chunk x if(canSpawn) - runwayGenerator.generate(world, rand, new BlockPos(xOrigin * 4 * 16, 0, z * 16)); + runwayGenerator.generate(world, rand, new BlockPos(x * 16, 0, z * 16)); } xOrigin = ModuloHelper.divide(x, 3); diff --git a/src/main/java/com/flansmod/apocalypse/common/world/buildings/WorldGenRunway.java b/src/main/java/com/flansmod/apocalypse/common/world/buildings/WorldGenRunway.java index 2459c16d9..aea19c78e 100644 --- a/src/main/java/com/flansmod/apocalypse/common/world/buildings/WorldGenRunway.java +++ b/src/main/java/com/flansmod/apocalypse/common/world/buildings/WorldGenRunway.java @@ -49,7 +49,7 @@ public boolean generate(World world, Random rand, BlockPos pos) fillArea(world, x, yHeight + 1, z, x + 16, yHeight + 11, z + 16, Blocks.AIR.getDefaultState()); - if(ModuloHelper.modulo(chunkX, 4) == 0) + if(ModuloHelper.modulo(chunkX, 4) == 1) { //Create hangar fillArea(world, x, yHeight + 1, z, x + 16, yHeight + 5, z + 1, Blocks.WOOL.getStateFromMeta(13)); @@ -100,7 +100,7 @@ public boolean generate(World world, Random rand, BlockPos pos) } - if(ModuloHelper.modulo(chunkX, 4) == 1) + if(ModuloHelper.modulo(chunkX, 4) == 0) { //Spawn a plane DriveableType type = FlansModApocalypse.getLootGenerator().getRandomPlane(rand); diff --git a/src/main/java/com/flansmod/client/model/RenderItemHolder.java b/src/main/java/com/flansmod/client/model/RenderItemHolder.java index c60320efa..eca9910a8 100644 --- a/src/main/java/com/flansmod/client/model/RenderItemHolder.java +++ b/src/main/java/com/flansmod/client/model/RenderItemHolder.java @@ -4,6 +4,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.entity.Render; @@ -51,6 +52,9 @@ public void render(TileEntity te, double posX, double posY, double posZ, float p GlStateManager.pushMatrix(); GlStateManager.translate((float)posX, (float)posY, (float)posZ); GlStateManager.rotate(180F, 0F, 0F, 1F); + GlStateManager.disableLighting(); + RenderHelper.enableStandardItemLighting(); + GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); switch(EnumFacing.HORIZONTALS[holder.getBlockMetadata()]) { @@ -93,6 +97,8 @@ public void render(TileEntity te, double posX, double posY, double posZ, float p else Minecraft.getMinecraft().getRenderItem().renderItem(stack, TransformType.NONE); } + RenderHelper.disableStandardItemLighting(); + GlStateManager.enableLighting(); GlStateManager.popMatrix(); } } diff --git a/src/main/java/com/flansmod/common/BlockItemHolder.java b/src/main/java/com/flansmod/common/BlockItemHolder.java index 145b1552e..67e1dc565 100644 --- a/src/main/java/com/flansmod/common/BlockItemHolder.java +++ b/src/main/java/com/flansmod/common/BlockItemHolder.java @@ -55,11 +55,7 @@ public BlockItemHolder(ItemHolderType type) setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH)); type.block = this; //type.item = Item.getItemFromBlock(this); - } - - public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l) - { - return false; + this.lightOpacity = 0; } @Override @@ -107,28 +103,25 @@ public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState s { } - /* - * TODO: [1.12] Reimplement this in JSONS? + protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D); + @Override - public void setBlockBoundsBasedOnState(IBlockAccess access, BlockPos pos) + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { - setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + return AABB; } @Override - public void setBlockBoundsForItemRender() + public boolean isOpaqueCube(IBlockState state) { - float var1 = 0.5F; - float var2 = 0.015625F; - float var3 = 0.5F; - this.setBlockBounds(0.0F, 0.5F - var2, 0.0F, 1F, 0.5F + var2, 1F); + return false; + } + + @Override + public boolean isFullCube(IBlockState state) + { + return false; } - @Override - public int getMobilityFlag() - { - return 1; - } - */ @Override public TileEntity createNewTileEntity(World var1, int i) diff --git a/src/main/java/com/flansmod/common/TileEntityItemHolder.java b/src/main/java/com/flansmod/common/TileEntityItemHolder.java index 8af9fa4c8..7ab690551 100644 --- a/src/main/java/com/flansmod/common/TileEntityItemHolder.java +++ b/src/main/java/com/flansmod/common/TileEntityItemHolder.java @@ -18,10 +18,12 @@ import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.ITextComponent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; public class TileEntityItemHolder extends TileEntity implements IInventory { - private ItemStack stack; + private ItemStack stack = ItemStack.EMPTY.copy(); public ItemHolderType type; public TileEntityItemHolder() @@ -52,12 +54,13 @@ public TileEntityItemHolder(ItemHolderType type) @Override public ItemStack decrStackSize(int index, int count) { - if(getStack() != null) + if(getStack() != null && !getStack().isEmpty()) { getStack().setCount(getStack().getCount() - count); if(getStack().getCount() <= 0) setStack(ItemStack.EMPTY.copy()); } + updateToClients(); return getStack(); } @@ -97,8 +100,7 @@ public NBTTagCompound writeToNBT(NBTTagCompound nbt) super.writeToNBT(nbt); NBTTagCompound stackNBT = new NBTTagCompound(); - if(getStack() != null) - getStack().writeToNBT(stackNBT); + getStack().writeToNBT(stackNBT); nbt.setTag("stack", stackNBT); nbt.setString("type", type.shortName); @@ -110,8 +112,9 @@ public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - setStack(new ItemStack(nbt.getCompoundTag("stack"))); - type = ItemHolderType.getItemHolder(nbt.getString("type")); + stack = new ItemStack(nbt.getCompoundTag("stack")); + if(type == null) + type = ItemHolderType.getItemHolder(nbt.getString("type")); } @Override @@ -127,6 +130,12 @@ public void onDataPacket(net.minecraft.network.NetworkManager net, SPacketUpdate { readFromNBT(packet.getNbtCompound()); } + + @Override + public NBTTagCompound getUpdateTag() + { + return writeToNBT(new NBTTagCompound()); + } public ItemStack getStack() { @@ -136,6 +145,7 @@ public ItemStack getStack() public void setStack(ItemStack stack) { this.stack = stack; + updateToClients(); } @Override @@ -149,6 +159,15 @@ public ItemStack removeStackFromSlot(int index) { ItemStack temp = stack; stack = ItemStack.EMPTY.copy(); + updateToClients(); return temp; } + + private void updateToClients() + { + world.markBlockRangeForRenderUpdate(pos, pos); + world.notifyBlockUpdate(pos, world.getBlockState(pos), world.getBlockState(pos), 3); + world.scheduleBlockUpdate(pos,this.getBlockType(),0,0); + markDirty(); + } } diff --git a/src/main/java/com/flansmod/common/teams/BlockSpawner.java b/src/main/java/com/flansmod/common/teams/BlockSpawner.java index e8293d789..baae4d597 100644 --- a/src/main/java/com/flansmod/common/teams/BlockSpawner.java +++ b/src/main/java/com/flansmod/common/teams/BlockSpawner.java @@ -75,42 +75,7 @@ public boolean isOpaqueCube(IBlockState state) public boolean isFullCube(IBlockState state) { return false; - } - - /* - * - * TODO: [1.12] Collision boxes... - @Override - public AxisAlignedBB getCollisionBoundingBox(World par1World, BlockPos pos, IBlockState state) - { - return null; - } - - @Override - public boolean isFullCube() - { - return false; - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - @Override - public void setBlockBoundsBasedOnState(IBlockAccess access, BlockPos pos) - { - setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); - } - - @Override - public int getMobilityFlag() - { - return 1; - } - */ - + } @Override public boolean canPlaceBlockAt(World world, BlockPos pos) diff --git a/src/main/java/com/flansmod/common/teams/TeamsManager.java b/src/main/java/com/flansmod/common/teams/TeamsManager.java index 62176141e..2452a7afd 100644 --- a/src/main/java/com/flansmod/common/teams/TeamsManager.java +++ b/src/main/java/com/flansmod/common/teams/TeamsManager.java @@ -826,7 +826,7 @@ public void respawnPlayer(EntityPlayer player, boolean firstSpawn) if(spawnPoint != null) { //player.setPositionAndUpdate(spawnPoint.x, spawnPoint.y, spawnPoint.z); - playerMP.startRiding((Entity)null); + playerMP.dismountRidingEntity(); EnumSet enumset = EnumSet.noneOf(SPacketPlayerPosLook.EnumFlags.class); playerMP.connection.setPlayerLocation(spawnPoint.x, spawnPoint.y, spawnPoint.z, 0F, 0F, enumset); //playerMP.setRotationYawHead(f); diff --git a/src/main/java/com/flansmod/common/teams/TeamsManagerRanked.java b/src/main/java/com/flansmod/common/teams/TeamsManagerRanked.java index 49c7ebedc..44a05512f 100644 --- a/src/main/java/com/flansmod/common/teams/TeamsManagerRanked.java +++ b/src/main/java/com/flansmod/common/teams/TeamsManagerRanked.java @@ -68,6 +68,12 @@ public TeamsManagerRanked() @Override public void startRound() { + if(currentPool == null) + { + + return; + } + for(EntityPlayer player : getPlayers()) { ProcessRankData((EntityPlayerMP)player); diff --git a/src/main/resources/assets/flansmod/models/item/teamsspawner_items.json b/src/main/resources/assets/flansmod/models/item/teamsspawner_items.json index 2bef580ee..3e47d224f 100644 --- a/src/main/resources/assets/flansmod/models/item/teamsspawner_items.json +++ b/src/main/resources/assets/flansmod/models/item/teamsspawner_items.json @@ -1,10 +1,10 @@ { "parent": "flansmod:block/teamsspawner_items", "display": { - "thirdperson": { + "thirdperson_lefthand": { "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], - "scale": [ 0.375, 0.375, 0.375 ] + "scale": [ 0.375, 10.375, 0.375 ] } } } diff --git a/src/main/resources/assets/flansmodapocalypse/blockstates/fluid.json b/src/main/resources/assets/flansmodapocalypse/blockstates/fluid.json deleted file mode 100644 index 45af03ccd..000000000 --- a/src/main/resources/assets/flansmodapocalypse/blockstates/fluid.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "forge_marker": 1, - "defaults": { - "model": "forge:fluid" - }, - "variants": { - "normal": [ - { - "custom": { - "fluid": "normal" - } - } - ], - "normal_gas": [ - { - "custom": { - "fluid": "normal_gas" - } - } - ], - "static": [ - { - "custom": { - "fluid": "static" - } - } - ], - "static_gas": [ - { - "custom": { - "fluid": "static_gas" - } - } - ], - "finite": [ - { - "custom": { - "fluid": "finite" - } - } - ], - "portal_displacement": [ - { - "custom": { - "fluid": "portal_displacement" - } - } - ] - } -} \ No newline at end of file diff --git a/src/main/resources/assets/flansmodapocalypse/blockstates/sulphuricacid.json b/src/main/resources/assets/flansmodapocalypse/blockstates/sulphuricacid.json new file mode 100644 index 000000000..effdc216a --- /dev/null +++ b/src/main/resources/assets/flansmodapocalypse/blockstates/sulphuricacid.json @@ -0,0 +1,12 @@ +{ + "forge_marker": 1, + "variants": { + "normal": [{ + "model": "forge:fluid", + "transform": "forge:default-item", + "custom": { + "fluid": "sulphuricAcid" + } + }] + } +} \ No newline at end of file diff --git a/src/main/resources/assets/flansmodapocalypse/models/item/labstone.json b/src/main/resources/assets/flansmodapocalypse/models/item/itemblocklabstone.json similarity index 100% rename from src/main/resources/assets/flansmodapocalypse/models/item/labstone.json rename to src/main/resources/assets/flansmodapocalypse/models/item/itemblocklabstone.json diff --git a/src/main/resources/assets/flansmodapocalypse/models/item/powercube.json b/src/main/resources/assets/flansmodapocalypse/models/item/itemblockpowercube.json similarity index 100% rename from src/main/resources/assets/flansmodapocalypse/models/item/powercube.json rename to src/main/resources/assets/flansmodapocalypse/models/item/itemblockpowercube.json diff --git a/src/main/resources/assets/flansmodapocalypse/models/item/itemblocksulphur.json b/src/main/resources/assets/flansmodapocalypse/models/item/itemblocksulphur.json new file mode 100644 index 000000000..9d434cfef --- /dev/null +++ b/src/main/resources/assets/flansmodapocalypse/models/item/itemblocksulphur.json @@ -0,0 +1,10 @@ +{ + "parent": "flansmodapocalypse:block/blockSulphur", + "display": { + "thirdperson": { + "rotation": [ 10, -45, 170 ], + "translation": [ 0, 1.5, -2.75 ], + "scale": [ 0.375, 0.375, 0.375 ] + } + } +}