diff --git a/gradle.properties b/gradle.properties index be0a373..3b59893 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,10 @@ # Basic Properties mod_id = ChinaCraft +<<<<<<< HEAD +mod_version = 0.3.202 +======= mod_version = 0.4.206 +>>>>>>> dev mod_group = unstudio.chinacraft # Minecraft & Forge diff --git a/src/main/java/unstudio/chinacraft/block/decoration/BlockCCDoor.java b/src/main/java/unstudio/chinacraft/block/decoration/BlockCCDoor.java new file mode 100644 index 0000000..4461ab7 --- /dev/null +++ b/src/main/java/unstudio/chinacraft/block/decoration/BlockCCDoor.java @@ -0,0 +1,19 @@ +package unstudio.chinacraft.block.decoration; + +import net.minecraft.block.BlockDoor; +import net.minecraft.block.material.Material; +import net.minecraft.item.Item; + +/** + * Created by trychen on 17/7/17. + */ +public class BlockCCDoor extends BlockDoor { + private Item item; + public BlockCCDoor(Material material) { + super(material); + } + + public Item getItem() { + return item; + } +} diff --git a/src/main/java/unstudio/chinacraft/block/decoration/BlockLatticeDoor.java b/src/main/java/unstudio/chinacraft/block/decoration/BlockLatticeDoor.java new file mode 100644 index 0000000..f6c7a6e --- /dev/null +++ b/src/main/java/unstudio/chinacraft/block/decoration/BlockLatticeDoor.java @@ -0,0 +1,356 @@ +package unstudio.chinacraft.block.decoration; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDoor; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +import java.util.Random; + +/** + * Created by trychen on 17/7/17. + */ +public class BlockLatticeDoor extends Block { + public BlockLatticeDoor() { + super(Material.wood); + float f = 0.5F; + float f1 = 1.0F; + this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); + } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + public boolean getBlocksMovement(IBlockAccess p_149655_1_, int p_149655_2_, int p_149655_3_, int p_149655_4_) + { + int l = this.func_150012_g(p_149655_1_, p_149655_2_, p_149655_3_, p_149655_4_); + return (l & 4) != 0; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return 7; + } + + /** + * Returns the bounding box of the wired rectangular prism to render. + */ + @SideOnly(Side.CLIENT) + public AxisAlignedBB getSelectedBoundingBoxFromPool(World p_149633_1_, int p_149633_2_, int p_149633_3_, int p_149633_4_) + { + this.setBlockBoundsBasedOnState(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_); + return super.getSelectedBoundingBoxFromPool(p_149633_1_, p_149633_2_, p_149633_3_, p_149633_4_); + } + + /** + * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been + * cleared to be reused) + */ + public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) + { + this.setBlockBoundsBasedOnState(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_); + return super.getCollisionBoundingBoxFromPool(p_149668_1_, p_149668_2_, p_149668_3_, p_149668_4_); + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) + { + this.func_150011_b(this.func_150012_g(world, x, y, z)); + } + + private void func_150011_b(int p_150011_1_) + { + float f = 0.1875F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); + int j = p_150011_1_ & 3; + boolean flag = (p_150011_1_ & 4) != 0; + boolean flag1 = (p_150011_1_ & 16) != 0; + + if (j == 0) + { + if (flag) + { + if (!flag1) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); + } + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); + } + } + else if (j == 1) + { + if (flag) + { + if (!flag1) + { + this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); + } + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); + } + } + else if (j == 2) + { + if (flag) + { + if (!flag1) + { + this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); + } + } + else + { + this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + } + else if (j == 3) + { + if (flag) + { + if (!flag1) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); + } + else + { + this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + } + else + { + this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); + } + } + } + + /** + * Called when a player hits the block. Args: world, x, y, z, player + */ + public void onBlockClicked(World p_149699_1_, int p_149699_2_, int p_149699_3_, int p_149699_4_, EntityPlayer p_149699_5_) {} + + /** + * Called upon block activation (right click on the block.) + */ + public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + int i1 = this.func_150012_g(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_); + int j1 = i1 & 7; + j1 ^= 4; + + if ((i1 & 8) == 0) + { + p_149727_1_.setBlockMetadataWithNotify(p_149727_2_, p_149727_3_, p_149727_4_, j1, 2); + p_149727_1_.markBlockRangeForRenderUpdate(p_149727_2_, p_149727_3_, p_149727_4_, p_149727_2_, p_149727_3_, p_149727_4_); + } else { + p_149727_1_.setBlockMetadataWithNotify(p_149727_2_, p_149727_3_ - 1, p_149727_4_, j1, 2); + p_149727_1_.markBlockRangeForRenderUpdate(p_149727_2_, p_149727_3_ - 1, p_149727_4_, p_149727_2_, p_149727_3_, p_149727_4_); + } + + p_149727_1_.playAuxSFXAtEntity(p_149727_5_, 1003, p_149727_2_, p_149727_3_, p_149727_4_, 0); + return true; + } + + public void func_150014_a(World p_150014_1_, int p_150014_2_, int p_150014_3_, int p_150014_4_, boolean p_150014_5_) + { + int l = this.func_150012_g(p_150014_1_, p_150014_2_, p_150014_3_, p_150014_4_); + boolean flag1 = (l & 4) != 0; + + if (flag1 != p_150014_5_) + { + int i1 = l & 7; + i1 ^= 4; + + if ((l & 8) == 0) + { + p_150014_1_.setBlockMetadataWithNotify(p_150014_2_, p_150014_3_, p_150014_4_, i1, 2); + p_150014_1_.markBlockRangeForRenderUpdate(p_150014_2_, p_150014_3_, p_150014_4_, p_150014_2_, p_150014_3_, p_150014_4_); + } + else + { + p_150014_1_.setBlockMetadataWithNotify(p_150014_2_, p_150014_3_ - 1, p_150014_4_, i1, 2); + p_150014_1_.markBlockRangeForRenderUpdate(p_150014_2_, p_150014_3_ - 1, p_150014_4_, p_150014_2_, p_150014_3_, p_150014_4_); + } + + p_150014_1_.playAuxSFXAtEntity(null, 1003, p_150014_2_, p_150014_3_, p_150014_4_, 0); + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are + * their own) Args: x, y, z, neighbor Block + */ + public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) + { + int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_); + + if ((l & 8) == 0) + { + boolean flag = false; + + if (p_149695_1_.getBlock(p_149695_2_, p_149695_3_ + 1, p_149695_4_) != this) + { + p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_); + flag = true; + } + + if (!World.doesBlockHaveSolidTopSurface(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_)) + { + p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_); + flag = true; + + if (p_149695_1_.getBlock(p_149695_2_, p_149695_3_ + 1, p_149695_4_) == this) + { + p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_ + 1, p_149695_4_); + } + } + + if (flag) + { + if (!p_149695_1_.isRemote) + { + this.dropBlockAsItem(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, l, 0); + } + } + else + { + boolean flag1 = p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_, p_149695_4_) || p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_ + 1, p_149695_4_); + + if ((flag1 || p_149695_5_.canProvidePower()) && p_149695_5_ != this) + { + this.func_150014_a(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, flag1); + } + } + } + else + { + if (p_149695_1_.getBlock(p_149695_2_, p_149695_3_ - 1, p_149695_4_) != this) + { + p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_); + } + + if (p_149695_5_ != this) + { + this.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_, p_149695_5_); + } + } + } + + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) + { + return (p_149650_1_ & 8) != 0 ? null : (this.blockMaterial == Material.iron ? Items.iron_door : Items.wooden_door); + } + + /** + * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. Args: world, + * x, y, z, startVec, endVec + */ + public MovingObjectPosition collisionRayTrace(World p_149731_1_, int p_149731_2_, int p_149731_3_, int p_149731_4_, Vec3 p_149731_5_, Vec3 p_149731_6_) + { + this.setBlockBoundsBasedOnState(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_); + return super.collisionRayTrace(p_149731_1_, p_149731_2_, p_149731_3_, p_149731_4_, p_149731_5_, p_149731_6_); + } + + /** + * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z + */ + public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) + { + return p_149742_3_ >= p_149742_1_.getHeight() - 2 ? false : World.doesBlockHaveSolidTopSurface(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) && super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_ + 1, p_149742_4_) && super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_ + 2, p_149742_4_); + } + + /** + * Returns the mobility information of the block, 0 = free, 1 = can't push but can move over, 2 = total immobility + * and stop pistons + */ + public int getMobilityFlag() + { + return 1; + } + + public int func_150012_g(IBlockAccess world, int x, int y, int z) + { + int l = world.getBlockMetadata(x, y, z); + boolean flag = (l & 8) != 0; + int i1; + int j1; + + if (flag) + { + i1 = world.getBlockMetadata(x, y - 1, z); + j1 = l; + } + else + { + i1 = l; + j1 = world.getBlockMetadata(x, y + 1, z); + } + + boolean flag1 = (j1 & 1) != 0; + return i1 & 7 | (flag ? 8 : 0) | (flag1 ? 16 : 0); + } + + /** + * Gets an item for the block being called on. Args: world, x, y, z + */ + @SideOnly(Side.CLIENT) + public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) + { + return this.blockMaterial == Material.iron ? Items.iron_door : Items.wooden_door; + } + + /** + * Called when the block is attempted to be harvested + */ + public void onBlockHarvested(World w, int x, int y, int z, int p_149681_5_, EntityPlayer p_149681_6_) + { + if (p_149681_6_.capabilities.isCreativeMode && (p_149681_5_ & 8) != 0 && w.getBlock(x, y - 1, z) == this && w.getBlock(x, y - 2, z) == this) + { + w.setBlockToAir(x, y - 1, z); + w.setBlockToAir(x, y - 2, z); + } + } +} diff --git a/src/main/java/unstudio/chinacraft/client/model/block/ModelLatticeDoor.java b/src/main/java/unstudio/chinacraft/client/model/block/ModelLatticeDoor.java new file mode 100644 index 0000000..f5a74b5 --- /dev/null +++ b/src/main/java/unstudio/chinacraft/client/model/block/ModelLatticeDoor.java @@ -0,0 +1,197 @@ +package unstudio.chinacraft.client.model.block; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +/** + * Created by trychen on 17/7/17. + */ +public class ModelLatticeDoor extends ModelBase { + //fields + ModelRenderer Shape1; + ModelRenderer Shape2; + ModelRenderer Shape3; + ModelRenderer Shape4; + ModelRenderer Shape5; + ModelRenderer Shape6; + ModelRenderer Shape7; + ModelRenderer Shape8; + ModelRenderer Shape9; + ModelRenderer Shape10; + ModelRenderer Shape11; + ModelRenderer Shape12; + ModelRenderer Shape14; + ModelRenderer Shape15; + ModelRenderer Shape16; + ModelRenderer Shape17; + ModelRenderer Shape18; + ModelRenderer Shape19; + ModelRenderer Shape13; + ModelRenderer Shape20; + + public ModelLatticeDoor() { + textureWidth = 256; + textureHeight = 256; + + Shape1 = new ModelRenderer(this, 0, 0); + Shape1.addBox(0F, 0F, 0F, 14, 2, 2); + Shape1.setRotationPoint(-6F, 21F, -7F); + Shape1.setTextureSize(256, 256); + Shape1.mirror = true; + setRotation(Shape1, 0F, -1.570796F, 0F); + Shape2 = new ModelRenderer(this, 0, 6); + Shape2.addBox(0F, 0F, 0F, 1, 47, 2); + Shape2.setRotationPoint(-6F, -24F, -8F); + Shape2.setTextureSize(256, 256); + Shape2.mirror = true; + setRotation(Shape2, 0F, -1.570796F, 0F); + Shape3 = new ModelRenderer(this, 7, 6); + Shape3.addBox(0F, 0F, -2F, 1, 47, 2); + Shape3.setRotationPoint(-7.9F, -24F, 7F); + Shape3.setTextureSize(256, 256); + Shape3.mirror = true; + setRotation(Shape3, 0F, -1.58825F, 0F); + Shape4 = new ModelRenderer(this, 34, 0); + Shape4.addBox(0F, 0F, 0F, 14, 1, 2); + Shape4.setRotationPoint(-6F, -24F, -7F); + Shape4.setTextureSize(256, 256); + Shape4.mirror = true; + setRotation(Shape4, 0F, -1.570796F, 0F); + Shape5 = new ModelRenderer(this, 15, 6); + Shape5.addBox(0F, 0F, 0F, 14, 15, 1); + Shape5.setRotationPoint(-6.5F, 6F, -7F); + Shape5.setTextureSize(256, 256); + Shape5.mirror = true; + setRotation(Shape5, 0F, -1.570796F, 0F); + Shape6 = new ModelRenderer(this, 0, 0); + Shape6.addBox(0F, 0F, 0F, 14, 2, 2); + Shape6.setRotationPoint(-6F, 4F, -7F); + Shape6.setTextureSize(256, 256); + Shape6.mirror = true; + setRotation(Shape6, 0F, -1.570796F, 0F); + Shape7 = new ModelRenderer(this, 16, 24); + Shape7.addBox(0F, 0F, 0F, 1, 27, 1); + Shape7.setRotationPoint(-7.5F, -23F, -5.5F); + Shape7.setTextureSize(256, 256); + Shape7.mirror = true; + setRotation(Shape7, 0F, 0F, 0F); + Shape8 = new ModelRenderer(this, 16, 24); + Shape8.addBox(0F, 0F, 0F, 1, 27, 1); + Shape8.setRotationPoint(-7.5F, -23F, -3.5F); + Shape8.setTextureSize(256, 256); + Shape8.mirror = true; + setRotation(Shape8, 0F, 0F, 0F); + Shape9 = new ModelRenderer(this, 16, 24); + Shape9.addBox(0F, 0F, 0F, 1, 27, 1); + Shape9.setRotationPoint(-7.5F, -23F, -1.5F); + Shape9.setTextureSize(256, 256); + Shape9.mirror = true; + setRotation(Shape9, 0F, 0F, 0F); + Shape10 = new ModelRenderer(this, 16, 24); + Shape10.addBox(0F, 0F, 0F, 1, 27, 1); + Shape10.setRotationPoint(-7.5F, -23F, 4.5F); + Shape10.setTextureSize(256, 256); + Shape10.mirror = true; + setRotation(Shape10, 0F, 0F, 0F); + Shape11 = new ModelRenderer(this, 16, 24); + Shape11.addBox(0F, 0F, 0F, 1, 27, 1); + Shape11.setRotationPoint(-7.5F, -23F, 2.5F); + Shape11.setTextureSize(256, 256); + Shape11.mirror = true; + setRotation(Shape11, 0F, 0F, 0F); + Shape12 = new ModelRenderer(this, 16, 24); + Shape12.addBox(0F, 0F, 0F, 1, 27, 1); + Shape12.setRotationPoint(-7.5F, -23F, 0.5F); + Shape12.setTextureSize(256, 256); + Shape12.mirror = true; + setRotation(Shape12, 0F, 0F, 0F); + Shape14 = new ModelRenderer(this, 23, 24); + Shape14.addBox(0F, 0F, 0F, 14, 1, 1); + Shape14.setRotationPoint(-6.5F, -21F, -7F); + Shape14.setTextureSize(256, 256); + Shape14.mirror = true; + setRotation(Shape14, 0F, -1.570796F, 0F); + Shape15 = new ModelRenderer(this, 23, 24); + Shape15.addBox(0F, 0F, 0F, 14, 1, 1); + Shape15.setRotationPoint(-6.5F, -1F, -7F); + Shape15.setTextureSize(256, 256); + Shape15.mirror = true; + setRotation(Shape15, 0F, -1.570796F, 0F); + Shape16 = new ModelRenderer(this, 23, 24); + Shape16.addBox(0F, 0F, 0F, 14, 1, 1); + Shape16.setRotationPoint(-6.5F, -19F, -7F); + Shape16.setTextureSize(256, 256); + Shape16.mirror = true; + setRotation(Shape16, 0F, -1.570796F, 0F); + Shape17 = new ModelRenderer(this, 23, 24); + Shape17.addBox(0F, 0F, 0F, 14, 1, 1); + Shape17.setRotationPoint(-6.5F, -11.5F, -7F); + Shape17.setTextureSize(256, 256); + Shape17.mirror = true; + setRotation(Shape17, 0F, -1.570796F, 0F); + Shape18 = new ModelRenderer(this, 23, 24); + Shape18.addBox(0F, 0F, 0F, 14, 1, 1); + Shape18.setRotationPoint(-6.5F, -9.5F, -7F); + Shape18.setTextureSize(256, 256); + Shape18.mirror = true; + setRotation(Shape18, 0F, -1.570796F, 0F); + Shape19 = new ModelRenderer(this, 23, 30); + Shape19.addBox(0F, 0F, 0F, 14, 27, 0); + Shape19.setRotationPoint(-7F, -23F, -7F); + Shape19.setTextureSize(256, 256); + Shape19.mirror = true; + setRotation(Shape19, 0F, -1.570796F, 0F); + Shape13 = new ModelRenderer(this, 23, 26); + Shape13.addBox(0F, 0F, 0F, 14, 1, 1); + Shape13.setRotationPoint(-6.5F, 1F, -7F); + Shape13.setTextureSize(256, 256); + Shape13.mirror = true; + setRotation(Shape13, 0F, -1.570796F, 0F); + Shape20 = new ModelRenderer(this, 46, 12); + Shape20.addBox(0F, 0F, 0F, 16, 1, 2); + Shape20.setRotationPoint(-8F, 23F, -8F); + Shape20.setTextureSize(256, 256); + Shape20.mirror = true; + setRotation(Shape20, 0F, 0F, 0F); + } + + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) + { + super.render(entity, f, f1, f2, f3, f4, f5); + setRotationAngles(f, f1, f2, f3, f4, f5, entity); + Shape1.render(f5); + Shape2.render(f5); + Shape3.render(f5); + Shape4.render(f5); + Shape5.render(f5); + Shape6.render(f5); + Shape7.render(f5); + Shape8.render(f5); + Shape9.render(f5); + Shape10.render(f5); + Shape11.render(f5); + Shape12.render(f5); + Shape14.render(f5); + Shape15.render(f5); + Shape16.render(f5); + Shape17.render(f5); + Shape18.render(f5); + Shape19.render(f5); + Shape13.render(f5); + Shape20.render(f5); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) + { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) + { + super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); + } +} + diff --git a/src/main/java/unstudio/chinacraft/common/ChinaCraft.java b/src/main/java/unstudio/chinacraft/common/ChinaCraft.java index 2ab9ae0..05a9c0b 100644 --- a/src/main/java/unstudio/chinacraft/common/ChinaCraft.java +++ b/src/main/java/unstudio/chinacraft/common/ChinaCraft.java @@ -59,7 +59,7 @@ public class ChinaCraft implements ICollection { public static final String MODID = "chinacraft"; public static final String NAME = "ChinaCraft"; - public static final String VERSION = "0.4.206"; + public static final String VERSION = "0.4.207"; public static final int PROJECT_ID = 1; public static SimpleNetworkWrapper Network; @@ -279,6 +279,10 @@ public Item getTabIconItem() { public static final BlockCCDing ding = new BlockCCDing(); @Register("Ding") public static final ItemCCDing itemDing = new ItemCCDing(); +// @Register("BlockLatticeDoor") +// public static BlockLatticeDoor latticeDoor = new BlockLatticeDoor(); +// @Register("LatticeDoor") +// public static CCItemLatticeDoor itemLatticeDoor = new CCItemLatticeDoor(); @Register("BlockWoodenBucket") public static final BlockWoodenBucket blockWoodenBucket = new BlockWoodenBucket(); // 木桶 @Register("CookingBenchOff") @@ -490,8 +494,6 @@ public Item getTabIconItem() { public static final CCMusicDisc three_stanzas = new CCMusicDisc("three_stanzas_of_plum-blossoms"); @Register("mountain_stream") public static final CCMusicDisc mountain_stream = new CCMusicDisc("mountain_stream"); - @Register("the_march_of_the_volunteers") - public static final CCMusicDisc the_march_of_the_volunteers = new CCMusicDisc("the_march_of_the_volunteers"); @Register("spring_festival_overture") public static final CCMusicDisc spring_festival_overture = new CCMusicDisc("spring_festival_overture"); diff --git a/src/main/java/unstudio/chinacraft/item/CCItemLatticeDoor.java b/src/main/java/unstudio/chinacraft/item/CCItemLatticeDoor.java new file mode 100644 index 0000000..77b7175 --- /dev/null +++ b/src/main/java/unstudio/chinacraft/item/CCItemLatticeDoor.java @@ -0,0 +1,78 @@ +package unstudio.chinacraft.item; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import unstudio.chinacraft.common.ChinaCraft; + +public class CCItemLatticeDoor extends Item { + + /** + * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return + * True if something happen and false if it don't. This is for ITEMS, not BLOCKS + */ + public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World w, int x, int y, int z, int meta, float p_77648_8_, float p_77648_9_, float p_77648_10_) { + if (meta != 1) { + return false; + } else { + ++y; + Block block = ChinaCraft.latticeDoor; + + if (player.canPlayerEdit(x, y, z, meta, itemStack) && player.canPlayerEdit(x, y + 1, z, meta, itemStack)) { + if (!block.canPlaceBlockAt(w, x, y, z)) { + return false; + } else { + int i1 = MathHelper.floor_double((double) ((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; + placeDoorBlock(w, x, y, z, i1, block); + --itemStack.stackSize; + return true; + } + } else { + return false; + } + } + } + + public static void placeDoorBlock(World world, int x, int y, int z, int meta, Block block) { + byte b0 = 0; + byte b1 = 0; + + if (meta == 0) { + b1 = 1; + } + + if (meta == 1) { + b0 = -1; + } + + if (meta == 2) { + b1 = -1; + } + + if (meta == 3) { + b0 = 1; + } + + int i1 = (world.getBlock(x - b0, y, z - b1).isNormalCube() ? 1 : 0) + (world.getBlock(x - b0, y + 2, z - b1).isNormalCube() ? 1 : 0); + int j1 = (world.getBlock(x + b0, y, z + b1).isNormalCube() ? 1 : 0) + (world.getBlock(x + b0, y + 2, z + b1).isNormalCube() ? 1 : 0); + boolean flag = world.getBlock(x - b0, y, z - b1) == block || world.getBlock(x - b0, y + 2, z - b1) == block; + boolean flag1 = world.getBlock(x + b0, y, z + b1) == block || world.getBlock(x + b0, y + 2, z + b1) == block; + boolean flag2 = false; + + if (flag && !flag1) { + flag2 = true; + } else if (j1 > i1) { + flag2 = true; + } + + world.setBlock(x, y, z, block, meta, 2); + world.setBlock(x, y + 1, z, block, meta, 2); + world.setBlock(x, y + 2, z, block, 8 | (flag2 ? 1 : 0), 2); + world.notifyBlocksOfNeighborChange(x, y, z, block); + world.notifyBlocksOfNeighborChange(x, y + 1, z, block); + world.notifyBlocksOfNeighborChange(x, y + 2, z, block); + } +} diff --git a/src/main/java/unstudio/chinacraft/world/gen/WorldGenCCFlower.java b/src/main/java/unstudio/chinacraft/world/gen/WorldGenCCFlower.java index 958a106..e6b9bb3 100644 --- a/src/main/java/unstudio/chinacraft/world/gen/WorldGenCCFlower.java +++ b/src/main/java/unstudio/chinacraft/world/gen/WorldGenCCFlower.java @@ -15,7 +15,7 @@ private void gen(Random random, int blockX, int blockZ, World world, Block block int z = blockZ + random.nextInt(16); int y = world.getHeightValue(x, z) +1; - if (world.isAirBlock(x, y, z) && block.canBlockStay(world, x, y, z)) + if (world.isAirBlock(x, y, z) && (!world.provider.hasNoSky || y < 255) && block.canBlockStay(world, x, y, z)) world.setBlock(x, y, z, block, 0, 3); } diff --git a/src/main/java/unstudio/chinacraft/world/gen/WorldGenListener.java b/src/main/java/unstudio/chinacraft/world/gen/WorldGenListener.java index bcbe0bd..464b648 100644 --- a/src/main/java/unstudio/chinacraft/world/gen/WorldGenListener.java +++ b/src/main/java/unstudio/chinacraft/world/gen/WorldGenListener.java @@ -25,12 +25,15 @@ public WorldGenListener() @SubscribeEvent public void onOreGenPost(OreGenEvent.Post event){ - WORLD_GEN_COPPER_ORE.generate(event.world,event.rand,event.worldX,0,event.worldZ); - WORLD_GEN_TIN_ORE.generate(event.world,event.rand,event.worldX,0,event.worldZ); - WORLD_GEN_SILVER_ORE.generate(event.world,event.rand,event.worldX,0,event.worldZ); - WORLD_GEN_JADE_ORE.generate(event.world,event.rand,event.worldX,0,event.worldZ); - WORLD_GEN_MARBLE_ORE.generate(event.world,event.rand,event.worldX,0,event.worldZ); - WORLD_GEN_CC_FLOWER.generate(event.world,event.rand,event.worldX,0,event.worldZ); - WORLD_GEN_BAMBOO_SHOOT.generate(event.world,event.rand,event.worldX,0,event.worldZ); + try { + WORLD_GEN_COPPER_ORE.generate(event.world, event.rand, event.worldX, 0, event.worldZ); + WORLD_GEN_TIN_ORE.generate(event.world, event.rand, event.worldX, 0, event.worldZ); + WORLD_GEN_SILVER_ORE.generate(event.world, event.rand, event.worldX, 0, event.worldZ); + WORLD_GEN_JADE_ORE.generate(event.world, event.rand, event.worldX, 0, event.worldZ); + WORLD_GEN_MARBLE_ORE.generate(event.world, event.rand, event.worldX, 0, event.worldZ); + WORLD_GEN_BAMBOO_SHOOT.generate(event.world, event.rand, event.worldX, 0, event.worldZ); + WORLD_GEN_CC_FLOWER.generate(event.world, event.rand, event.worldX, 0, event.worldZ); + } finally { + } } } diff --git a/src/main/resources/assets/chinacraft/lang/en_US.lang b/src/main/resources/assets/chinacraft/lang/en_US.lang index c8cdff9..1516c32 100644 --- a/src/main/resources/assets/chinacraft/lang/en_US.lang +++ b/src/main/resources/assets/chinacraft/lang/en_US.lang @@ -273,7 +273,6 @@ item.debug.lore=Use item with block to output debug information record.three_stanzas_of_plum-blossoms=Plum-blossom in Three Movements record.mountain_stream=Mountain Stream -record.the_march_of_the_volunteers=March of the Volunteers record.spring_festival_overture=Spring festival Overture splashText.spring.1=Happy Spring Festival! diff --git a/src/main/resources/assets/chinacraft/lang/zh_CN.lang b/src/main/resources/assets/chinacraft/lang/zh_CN.lang index e9a8822..6fe31cb 100644 --- a/src/main/resources/assets/chinacraft/lang/zh_CN.lang +++ b/src/main/resources/assets/chinacraft/lang/zh_CN.lang @@ -280,7 +280,6 @@ item.debug.lore=拿着本物品对方块右键即可输出调试信息 record.three_stanzas_of_plum-blossoms=梅花三弄 record.mountain_stream=高山流水 -record.the_march_of_the_volunteers=义勇军进行曲 record.spring_festival_overture=春节序曲 splashText.spring.1=春节快乐! diff --git a/src/main/resources/assets/chinacraft/lang/zh_TW.lang b/src/main/resources/assets/chinacraft/lang/zh_TW.lang index 978d9d9..3c2e51b 100644 --- a/src/main/resources/assets/chinacraft/lang/zh_TW.lang +++ b/src/main/resources/assets/chinacraft/lang/zh_TW.lang @@ -280,7 +280,6 @@ item.debug.lore=拿著本物品對方塊右鍵即可輸出調試資訊 record.three_stanzas_of_plum-blossoms=梅花三弄 record.mountain_stream=高山流水 -record.the_march_of_the_volunteers=義勇軍進行曲 record.spring_festival_overture=春節序曲 splashText.spring.1=春節快樂! diff --git a/src/main/resources/assets/chinacraft/sounds.json b/src/main/resources/assets/chinacraft/sounds.json index c4706d1..29e8471 100644 --- a/src/main/resources/assets/chinacraft/sounds.json +++ b/src/main/resources/assets/chinacraft/sounds.json @@ -33,14 +33,6 @@ "stream": true } ]}, - "records.the_march_of_the_volunteers": { - "category": "record", - "sounds": [ - { - "name": "records/the_march_of_the_volunteers", - "stream": true - } - ]}, "records.spring_festival_overture": { "category": "record", "sounds": [ diff --git a/src/main/resources/assets/chinacraft/sounds/records/the_march_of_the_volunteers.ogg b/src/main/resources/assets/chinacraft/sounds/records/the_march_of_the_volunteers.ogg deleted file mode 100644 index 4d402d1..0000000 Binary files a/src/main/resources/assets/chinacraft/sounds/records/the_march_of_the_volunteers.ogg and /dev/null differ diff --git a/src/main/resources/assets/chinacraft/textures/items/record_the_march_of_the_volunteers.png b/src/main/resources/assets/chinacraft/textures/items/record_the_march_of_the_volunteers.png deleted file mode 100644 index 522b677..0000000 Binary files a/src/main/resources/assets/chinacraft/textures/items/record_the_march_of_the_volunteers.png and /dev/null differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 2c90a16..f2204e1 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "chinacraft", "name": "ChinaCraft", "description": "A mod with Chinese features.", - "version": "Beta 0.4.206", + "version": "Beta 0.4.207", "mcversion": "1.7.10", "url": "http://mccraft.cn/project/chinacraft", "updateUrl": "",