mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-16 10:45:02 +00:00
Fixed wonky Chests/Presents. We still need textures for later, when it won't be christmas
This commit is contained in:
1 parent
510c3a7bbf
commit
341822b74e
3 files changed
+8
-238
No files matched your search
@@ -1,6 +1,5 @@
|
||||
package com.cricketcraft.chisel.block;
|
||||
|
||||
import com.cricketcraft.chisel.Chisel;
|
||||
import com.cricketcraft.chisel.api.ICarvable;
|
||||
import com.cricketcraft.chisel.block.tileentity.TileEntityPresent;
|
||||
import com.cricketcraft.chisel.carving.CarvableHelper;
|
||||
@@ -16,7 +15,6 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.EntityOcelot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -48,15 +46,15 @@ public class BlockPresent extends BlockChest implements ICarvable {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
if (calendar.get(2) + 1 == 12 || calendar.get(2) + 1 == 1) {
|
||||
isChristmas = true;//The Christmas Season lasts for december and january
|
||||
isChristmas = true; //The Christmas Season lasts for december and january
|
||||
} else {
|
||||
isChristmas = false;
|
||||
isChristmas = false; //TODO: THESE NEED TO EXIST
|
||||
}
|
||||
}
|
||||
|
||||
public String getKindOfChest(int type){
|
||||
switch (type){
|
||||
case 0:
|
||||
case 0: //TODO: |----------these are fine-------------| |------these are missing-------|
|
||||
return isChristmas? "textures/blocks/present/presentChest0" : "textures/blocks/present/chest0";
|
||||
case 1:
|
||||
return isChristmas? "textures/blocks/present/presentChest1" : "textures/blocks/present/chest1";
|
||||
@@ -162,7 +160,7 @@ public class BlockPresent extends BlockChest implements ICarvable {
|
||||
world.setBlockMetadataWithNotify(x, y, z, metadata, 3);
|
||||
}
|
||||
|
||||
if ((left == this || right == this) && (metadata == 4 || metadata == 5)) {
|
||||
if ((left == this || right == this) && (metadata == 2 || metadata == 3)) {
|
||||
if (left == this) {
|
||||
world.setBlockMetadataWithNotify(x - 1, y, z, metadata, 3);
|
||||
} else {
|
||||
@@ -251,119 +249,6 @@ public class BlockPresent extends BlockChest implements ICarvable {
|
||||
super.breakBlock(world, x, y, z, this, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int meta, float x1, float y1, float z1) {
|
||||
if (!world.isRemote) {
|
||||
player.openGui(Chisel.instance, 2, world, x, y, z);
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z - 1) == this) {
|
||||
this.setBlockBounds(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F);
|
||||
} else if (world.getBlock(x, y, z + 1) == this) {
|
||||
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
||||
} else if (world.getBlock(x - 1, y, z) == this) {
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F);
|
||||
} else if (world.getBlock(x + 1, y, z) == this) {
|
||||
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F);
|
||||
} else {
|
||||
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
this.changeMetadataBasedOffSpecs(world, x, y, z);
|
||||
Block back = world.getBlock(x, y, z - 1);
|
||||
Block front = world.getBlock(x, y, z + 1);
|
||||
Block left = world.getBlock(x - 1, y, z);
|
||||
Block right = world.getBlock(x + 1, y, z);
|
||||
|
||||
if (back == this) {
|
||||
this.changeMetadataBasedOffSpecs(world, x, y, z - 1);
|
||||
}
|
||||
|
||||
if (front == this) {
|
||||
this.changeMetadataBasedOffSpecs(world, x, y, z + 1);
|
||||
}
|
||||
|
||||
if (left == this) {
|
||||
this.changeMetadataBasedOffSpecs(world, x - 1, y, z);
|
||||
}
|
||||
|
||||
if (right == this) {
|
||||
this.changeMetadataBasedOffSpecs(world, x + 1, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
public void changeMetadataBasedOffSpecs(World world, int x, int y, int z) {
|
||||
if (!world.isRemote) {
|
||||
Block back = world.getBlock(x, y, z - 1);
|
||||
Block front = world.getBlock(x, y, z + 1);
|
||||
Block left = world.getBlock(x - 1, y, z);
|
||||
Block right = world.getBlock(x + 1, y, z);
|
||||
boolean flag = true, flag1;
|
||||
byte metadata;
|
||||
int x1, blockMeta, z1;
|
||||
Block backLeft, frontRight;
|
||||
|
||||
if (front != this && back != this) {
|
||||
if (left != this && right != this) {
|
||||
metadata = 3;
|
||||
|
||||
if (front.func_149730_j() && !back.func_149730_j()) {
|
||||
metadata = 3;
|
||||
}
|
||||
|
||||
if (back.func_149730_j() && !front.func_149730_j()) {
|
||||
metadata = 2;
|
||||
}
|
||||
|
||||
if (left.func_149730_j() && !right.func_149730_j()) {
|
||||
metadata = 5;
|
||||
}
|
||||
|
||||
if (right.func_149730_j() && !left.func_149730_j()) {
|
||||
metadata = 4;
|
||||
}
|
||||
} else {
|
||||
x1 = back == this ? x - 1 : x + 1;
|
||||
backLeft = world.getBlock(x1, y, z - 1);
|
||||
z1 = back == this ? z - 1 : z + 1;
|
||||
frontRight = world.getBlock(x + 1, y, z1);
|
||||
metadata = 5;
|
||||
flag1 = true;
|
||||
|
||||
if (back == this) {
|
||||
blockMeta = world.getBlockMetadata(x, y, z - 1);
|
||||
} else {
|
||||
blockMeta = world.getBlockMetadata(x, y, z + 1);
|
||||
}
|
||||
|
||||
if (blockMeta == 4) {
|
||||
metadata = 4;
|
||||
}
|
||||
|
||||
if ((left.func_149730_j() || backLeft.func_149730_j()) && !right.func_149730_j() && !frontRight.func_149730_j()) {
|
||||
metadata = 5;
|
||||
}
|
||||
|
||||
if ((right.func_149730_j() || frontRight.func_149730_j()) && !left.func_149730_j() && !backLeft.func_149730_j()) {
|
||||
metadata = 4;
|
||||
}
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, metadata, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2) {
|
||||
return new TileEntityPresent(type);
|
||||
@@ -400,7 +285,7 @@ public class BlockPresent extends BlockChest implements ICarvable {
|
||||
}
|
||||
|
||||
public IInventory getInventory(World world, int x, int y, int z) {
|
||||
Object object = (TileEntityPresent) world.getTileEntity(x, y, z);
|
||||
Object object = world.getTileEntity(x, y, z);
|
||||
|
||||
if (object == null) {
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user