block cleanup #1

This commit is contained in:
Sen 2025-06-20 15:40:56 +02:00
parent 1713ca7f96
commit 54511912dd
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
23 changed files with 163 additions and 811 deletions

View file

@ -1,103 +1,43 @@
package common.block.artificial;
import java.util.List;
import common.block.Material;
import common.color.DyeColor;
import common.item.CheatTab;
import common.item.Item;
import common.item.ItemStack;
import common.model.BlockLayer;
import common.properties.IProperty;
import common.properties.PropertyEnum;
import common.world.State;
public class BlockStainedGlassPane extends BlockPane
{
public static final PropertyEnum<DyeColor> COLOR = PropertyEnum.<DyeColor>create("color", DyeColor.class);
private final DyeColor color;
public BlockStainedGlassPane()
public BlockStainedGlassPane(DyeColor color)
{
super(Material.TRANSLUCENT, false);
this.setDefaultState(this.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)).withProperty(COLOR, DyeColor.WHITE));
this.color = color;
this.setDefaultState(this.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
this.setTab(CheatTab.BLOCKS);
}
/**
* Gets the metadata of the item this Block can drop. This method is called when the block gets destroyed. It
* returns the metadata of the dropped item based on the old metadata of the block.
*/
public int damageDropped(State state)
{
return ((DyeColor)state.getValue(COLOR)).getMetadata();
public DyeColor getColor() {
return this.color;
}
/**
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
*/
public void getSubBlocks(Item itemIn, CheatTab tab, List<ItemStack> list)
{
for (int i = 0; i < DyeColor.values().length; ++i)
{
list.add(new ItemStack(itemIn, 1, i));
}
}
// /**
// * Get the MapColor for this Block and the given BlockState
// */
// public MapColor getMapColor(IBlockState state)
// {
// return ((EnumDyeColor)state.getValue(COLOR)).getMapColor();
// }
public BlockLayer getBlockLayer()
{
return BlockLayer.TRANSLUCENT;
}
/**
* Convert the given metadata into a BlockState for this Block
*/
public State getStateFromMeta(int meta)
{
return this.getState().withProperty(COLOR, DyeColor.byMetadata(meta));
}
/**
* Convert the BlockState into the correct metadata value
*/
public int getMetaFromState(State state)
{
return ((DyeColor)state.getValue(COLOR)).getMetadata();
}
protected IProperty[] getProperties()
{
return new IProperty[] {NORTH, EAST, WEST, SOUTH, COLOR};
return new IProperty[] {NORTH, EAST, WEST, SOUTH};
}
// public void onBlockAdded(IWorldServer worldIn, BlockPos pos, State state)
// {
// if (!worldIn.client)
// {
// BlockBeacon.updateColorAsync(worldIn, pos);
// }
// }
//
// public void onBlockRemoved(IWorldServer worldIn, BlockPos pos, State state)
// {
// if (!worldIn.client)
// {
// BlockBeacon.updateColorAsync(worldIn, pos);
// }
// }
protected String getPaneBase(State state) {
return state.getValue(COLOR).getName() + "_glass";
return this.color.getName() + "_glass";
}
protected String getPaneEdge(State state) {
return state.getValue(COLOR).getName() + "_glass_pane";
return this.color.getName() + "_glass_pane";
}
}