remove banners
|
@ -1,142 +0,0 @@
|
|||
package client.renderer.tileentity;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import client.Client;
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.model.ModelBanner;
|
||||
import client.renderer.texture.LayeredColorMaskTexture;
|
||||
import common.block.tile.BlockBannerStanding;
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.color.DyeColor;
|
||||
import common.init.Blocks;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.world.State;
|
||||
|
||||
public class TileEntityBannerRenderer extends TileEntitySpecialRenderer<TileEntityBanner> {
|
||||
private static class TimedTexture {
|
||||
public long time;
|
||||
public String texture;
|
||||
|
||||
private TimedTexture() {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<String, TimedTexture> DESIGNS = Maps.<String, TimedTexture>newHashMap();
|
||||
private static final String BANNERTEXTURES = "textures/blocks/banner.png";
|
||||
private ModelBanner bannerModel = new ModelBanner();
|
||||
|
||||
public void renderTileEntityAt(TileEntityBanner te, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
boolean flag = te.getWorld() != null;
|
||||
boolean flag1 = !flag || te.getBlockType() == Blocks.banner;
|
||||
int i = 0;
|
||||
if(flag) {
|
||||
State state = te.getBlockState();
|
||||
if(state.getBlock() == Blocks.banner)
|
||||
i = state.getValue(BlockBannerStanding.ROTATION);
|
||||
}
|
||||
// long j = flag ? te.getWorld().getTime() : 0L;
|
||||
double j = flag ? (double)(System.nanoTime() / 1000L) / 50000.0 /* te.getWorld().getTime() */ : (double)partialTicks;
|
||||
GL11.glPushMatrix();
|
||||
float f = 0.6666667F;
|
||||
|
||||
if(flag1) {
|
||||
GL11.glTranslatef((float)x + 0.5F, (float)y + 0.75F * f, (float)z + 0.5F);
|
||||
float f1 = (float)(i * 360) / 16.0F;
|
||||
GL11.glRotatef(-f1, 0.0F, 1.0F, 0.0F);
|
||||
this.bannerModel.bannerStand.showModel = true;
|
||||
}
|
||||
else {
|
||||
float f2 = 0.0F;
|
||||
|
||||
if(i == 2) {
|
||||
f2 = 180.0F;
|
||||
}
|
||||
|
||||
if(i == 4) {
|
||||
f2 = 90.0F;
|
||||
}
|
||||
|
||||
if(i == 5) {
|
||||
f2 = -90.0F;
|
||||
}
|
||||
|
||||
GL11.glTranslatef((float)x + 0.5F, (float)y - 0.25F * f, (float)z + 0.5F);
|
||||
GL11.glRotatef(-f2, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, -0.3125F, -0.4375F);
|
||||
this.bannerModel.bannerStand.showModel = false;
|
||||
}
|
||||
|
||||
BlockPos blockpos = te.getPos();
|
||||
float f3 = (float)(blockpos.getX() * 7 + blockpos.getY() * 9 + blockpos.getZ() * 13) + (float)j; // + partialTicks;
|
||||
this.bannerModel.bannerSlate.rotateAngleX = (-0.0125F + 0.01F * ExtMath.cos(f3 * (float)Math.PI * 0.02F)) * (float)Math.PI;
|
||||
GlState.enableRescaleNormal();
|
||||
String resourcelocation = this.getTexture(te);
|
||||
|
||||
if(resourcelocation != null) {
|
||||
this.bindTexture(resourcelocation);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(f, -f, -f);
|
||||
this.bannerModel.renderBanner();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private String getTexture(TileEntityBanner te) {
|
||||
String s = te.getPatternResourceLocation();
|
||||
|
||||
if(s.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
TimedTexture tex = (TimedTexture)DESIGNS.get(s);
|
||||
|
||||
if(tex == null) {
|
||||
if(DESIGNS.size() >= 256) {
|
||||
long i = System.currentTimeMillis();
|
||||
Iterator<String> iterator = DESIGNS.keySet().iterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
String s1 = (String)iterator.next();
|
||||
TimedTexture tileentitybannerrenderer$timedbannertexture1 = (TimedTexture)DESIGNS.get(s1);
|
||||
|
||||
if(i - tileentitybannerrenderer$timedbannertexture1.time > 60000L) {
|
||||
Client.CLIENT.getTextureManager().deleteTexture(tileentitybannerrenderer$timedbannertexture1.texture);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if(DESIGNS.size() >= 256) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
List<TileEntityBanner.EnumBannerPattern> list1 = te.getPatternList();
|
||||
List<DyeColor> list = te.getColorList();
|
||||
List<String> list2 = Lists.<String>newArrayList();
|
||||
|
||||
for(TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern : list1) {
|
||||
list2.add("textures/blocks/banner_" + tileentitybanner$enumbannerpattern.getPatternName() + ".png");
|
||||
}
|
||||
|
||||
tex = new TimedTexture();
|
||||
tex.texture = s;
|
||||
Client.CLIENT.getTextureManager().loadTexture(tex.texture, new LayeredColorMaskTexture(BANNERTEXTURES, list2, list));
|
||||
DESIGNS.put(s, tex);
|
||||
}
|
||||
|
||||
tex.time = System.currentTimeMillis();
|
||||
return tex.texture;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ package client.renderer.tileentity;
|
|||
|
||||
import common.init.Items;
|
||||
import common.item.ItemStack;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
import common.tileentity.TileEntityChest;
|
||||
|
||||
public class TileEntityItemStackRenderer {
|
||||
|
@ -10,14 +9,9 @@ public class TileEntityItemStackRenderer {
|
|||
|
||||
private final TileEntityChest chest = new TileEntityChest(0);
|
||||
private final TileEntityChest trapChest = new TileEntityChest(1);
|
||||
private final TileEntityBanner banner = new TileEntityBanner();
|
||||
|
||||
public void renderByItem(ItemStack stack) {
|
||||
if(stack.getItem() == Items.banner) {
|
||||
this.banner.setItemValues(stack);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
}
|
||||
else if(stack.getItem() == Items.trapped_chest) {
|
||||
if(stack.getItem() == Items.trapped_chest) {
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.trapChest, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
}
|
||||
else if(stack.getItem() == Items.chest) {
|
||||
|
|
|
@ -9,7 +9,6 @@ import client.renderer.texture.TextureManager;
|
|||
import common.collect.Maps;
|
||||
import common.entity.Entity;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
import common.tileentity.TileEntityChest;
|
||||
import common.tileentity.TileEntityDisplay;
|
||||
import common.tileentity.TileEntityPiston;
|
||||
|
@ -50,7 +49,6 @@ public class TileEntityRendererDispatcher
|
|||
this.mapSpecialRenderers.put(TileEntityDisplay.class, new TileEntityDisplayRenderer());
|
||||
this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer());
|
||||
this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer());
|
||||
this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer());
|
||||
|
||||
for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
|
||||
{
|
||||
|
|
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 852 B |
Before Width: | Height: | Size: 903 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 956 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 996 B |
Before Width: | Height: | Size: 1,020 B |
Before Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 1,014 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 873 B |
Before Width: | Height: | Size: 931 B |
Before Width: | Height: | Size: 880 B |
Before Width: | Height: | Size: 904 B |
Before Width: | Height: | Size: 983 B |
Before Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 888 B |
Before Width: | Height: | Size: 907 B |
Before Width: | Height: | Size: 898 B |
Before Width: | Height: | Size: 892 B |
Before Width: | Height: | Size: 895 B |
Before Width: | Height: | Size: 961 B |
Before Width: | Height: | Size: 882 B |
Before Width: | Height: | Size: 890 B |
Before Width: | Height: | Size: 1,017 B |
Before Width: | Height: | Size: 1,020 B |
Before Width: | Height: | Size: 883 B |
Before Width: | Height: | Size: 878 B |
Before Width: | Height: | Size: 883 B |
Before Width: | Height: | Size: 873 B |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 980 B |
Before Width: | Height: | Size: 996 B |
Before Width: | Height: | Size: 978 B |
|
@ -11,7 +11,6 @@ import common.init.Items;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBanner;
|
||||
import common.item.block.ItemSmallBlock;
|
||||
import common.item.tool.ItemArmor;
|
||||
import common.model.Model;
|
||||
|
@ -19,7 +18,6 @@ import common.model.ModelProvider;
|
|||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.ExtMath;
|
||||
|
@ -553,46 +551,7 @@ public class BlockCauldron extends Block
|
|||
}
|
||||
}
|
||||
|
||||
if (i > 0 && item instanceof ItemBanner && TileEntityBanner.getPatterns(itemstack) > 0)
|
||||
{
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
itemstack1.size = 1;
|
||||
TileEntityBanner.removeBannerData(itemstack1);
|
||||
|
||||
if (itemstack.size <= 1) // && !playerIn.creative)
|
||||
{
|
||||
playerIn.inventory.setInventorySlotContents(playerIn.inventory.currentItem, itemstack1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!playerIn.inventory.addItemStackToInventory(itemstack1))
|
||||
{
|
||||
worldIn.spawnEntityInWorld(new EntityItem(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.5D, (double)pos.getZ() + 0.5D, itemstack1));
|
||||
}
|
||||
else
|
||||
{
|
||||
playerIn.connection.sendContainerToPlayer(playerIn.inventoryContainer);
|
||||
}
|
||||
|
||||
// playerIn.triggerAchievement(StatRegistry.bannerCleanedStat);
|
||||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--itemstack.size;
|
||||
// }
|
||||
}
|
||||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
this.setWaterLevel(worldIn, pos, state, i - 1);
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,144 +0,0 @@
|
|||
package common.block.tile;
|
||||
|
||||
import common.block.BlockContainer;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Transforms;
|
||||
import common.rng.Random;
|
||||
import common.tags.TagObject;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.world.IBlockAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockBanner extends BlockContainer implements Rotatable
|
||||
{
|
||||
public BlockBanner()
|
||||
{
|
||||
super(Material.WOOD);
|
||||
float f = 0.25F;
|
||||
float f1 = 1.0F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
|
||||
}
|
||||
|
||||
public boolean isPickStrict()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public BoundingBox getSelectedBoundingBox(World worldIn, BlockPos pos)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(worldIn, pos);
|
||||
return super.getSelectedBoundingBox(worldIn, pos);
|
||||
}
|
||||
|
||||
public boolean isFullCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
||||
*/
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if an entity can be spawned inside the block (used to get the player's bed spawn location)
|
||||
*/
|
||||
public boolean canSpawnInBlock()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
||||
*/
|
||||
public TileEntity createNewTileEntity()
|
||||
{
|
||||
return new TileEntityBanner();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return Items.banner;
|
||||
}
|
||||
|
||||
public Item getItem(World worldIn, BlockPos pos)
|
||||
{
|
||||
return Items.banner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns this Block's drops into the World as EntityItems.
|
||||
*/
|
||||
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune)
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntityBanner)
|
||||
{
|
||||
ItemStack itemstack = new ItemStack(Items.banner);
|
||||
TagObject tag = new TagObject();
|
||||
tileentity.writeTags(tag);
|
||||
itemstack.setTagInfo("BlockEntityTag", tag);
|
||||
spawnAsEntity(worldIn, pos, itemstack);
|
||||
}
|
||||
else
|
||||
{
|
||||
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
|
||||
{
|
||||
return !this.hasInvalidNeighbor(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos);
|
||||
}
|
||||
|
||||
public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te)
|
||||
{
|
||||
if (te instanceof TileEntityBanner)
|
||||
{
|
||||
TileEntityBanner tileentitybanner = (TileEntityBanner)te;
|
||||
ItemStack itemstack = new ItemStack(Items.banner);
|
||||
TagObject tag = new TagObject();
|
||||
TileEntityBanner.setBaseColorAndPatterns(tag, tileentitybanner.getBaseColor(), tileentitybanner.getPatterns());
|
||||
itemstack.setTagInfo("BlockEntityTag", tag);
|
||||
spawnAsEntity(worldIn, pos, itemstack);
|
||||
}
|
||||
else
|
||||
{
|
||||
super.harvestBlock(worldIn, player, pos, state, (TileEntity)null);
|
||||
}
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.BANNER;
|
||||
}
|
||||
|
||||
public String getFallbackTexture() {
|
||||
return "oak_planks";
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package common.block.tile;
|
||||
|
||||
import common.block.Block;
|
||||
import common.item.Item;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockBannerHanging extends BlockBanner
|
||||
{
|
||||
public BlockBannerHanging()
|
||||
{
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING);
|
||||
float f = 0.0F;
|
||||
float f1 = 0.78125F;
|
||||
float f2 = 0.0F;
|
||||
float f3 = 1.0F;
|
||||
float f4 = 0.125F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
switch (enumfacing)
|
||||
{
|
||||
case NORTH:
|
||||
default:
|
||||
this.setBlockBounds(f2, f, 1.0F - f4, f3, f1, 1.0F);
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
this.setBlockBounds(f2, f, 0.0F, f3, f1, f4);
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
this.setBlockBounds(1.0F - f4, f, f2, 1.0F, f1, f3);
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
this.setBlockBounds(0.0F, f, f2, f4, f1, f3);
|
||||
}
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock)
|
||||
{
|
||||
Facing enumfacing = (Facing)state.getValue(FACING);
|
||||
|
||||
if (!worldIn.getState(pos.offset(enumfacing.getOpposite())).getBlock().getMaterial().isSolid())
|
||||
{
|
||||
this.dropBlockAsItem(worldIn, pos, state, 0);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
super.onNeighborBlockChange(worldIn, pos, state, neighborBlock);
|
||||
}
|
||||
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package common.block.tile;
|
||||
|
||||
import common.block.Block;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemBanner;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.util.BlockPos;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockBannerStanding extends BlockBanner
|
||||
{
|
||||
public static final PropertyInteger ROTATION = PropertyInteger.create("rotation", 0, 15);
|
||||
|
||||
public BlockBannerStanding()
|
||||
{
|
||||
this.setDefaultState(this.getBaseState().withProperty(ROTATION, Integer.valueOf(0)));
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock)
|
||||
{
|
||||
if (!worldIn.getState(pos.down()).getBlock().getMaterial().isSolid())
|
||||
{
|
||||
this.dropBlockAsItem(worldIn, pos, state, 0);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
super.onNeighborBlockChange(worldIn, pos, state, neighborBlock);
|
||||
}
|
||||
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new Property[] {ROTATION};
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemBanner(this).setDisplay("Banner");
|
||||
}
|
||||
}
|
|
@ -132,8 +132,6 @@ import common.block.tech.BlockTripWire;
|
|||
import common.block.tech.BlockTripWireHook;
|
||||
import common.block.tech.BlockWarpChest;
|
||||
import common.block.tech.BlockWorkbench;
|
||||
import common.block.tile.BlockBannerHanging;
|
||||
import common.block.tile.BlockBannerStanding;
|
||||
import common.block.tile.BlockStandingSign;
|
||||
import common.block.tile.BlockWallSign;
|
||||
import common.collect.BiMap;
|
||||
|
@ -470,8 +468,6 @@ public abstract class BlockRegistry {
|
|||
register("display" + (density == 1 ? "" : density) + "_on", new BlockActiveDisplay(display).setHardness(1.0F).setStepSound(SoundType.STONE).setDisplay("Displaymodul (" + (density * 16) +
|
||||
"x" + (density * 16) + ")"));
|
||||
}
|
||||
register("banner", (new BlockBannerStanding()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Banner"));
|
||||
register("wall_banner", (new BlockBannerHanging()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Banner"));
|
||||
|
||||
register("portal", (new BlockPortal()).setHardness(0.0F).setStepSound(SoundType.GLASS).setLightLevel(0.75F).setDisplay("Portal"));
|
||||
register("floor_portal", (new BlockFloorPortal(Material.PORTAL)).setHardness(0.0F).setDisplay("Portal"));
|
||||
|
|
|
@ -50,7 +50,6 @@ public abstract class Blocks {
|
|||
public static final BlockOre arsenic_ore = get("arsenic_ore");
|
||||
public static final Block ash = get("ash");
|
||||
public static final BlockWorkbench assembly_unit = get("assembly_unit");
|
||||
public static final BlockBannerStanding banner = get("banner");
|
||||
public static final BlockBeacon beacon = get("beacon");
|
||||
public static final BlockBedrock bedrock = get("bedrock");
|
||||
public static final BlockDoor birch_door = get("birch_door");
|
||||
|
@ -554,7 +553,6 @@ public abstract class Blocks {
|
|||
public static final Block vanadium_block = get("vanadium_block");
|
||||
public static final BlockOre vanadium_ore = get("vanadium_ore");
|
||||
public static final BlockVine vine = get("vine");
|
||||
public static final BlockBannerHanging wall_banner = get("wall_banner");
|
||||
public static final BlockWallSign wall_sign = get("wall_sign");
|
||||
public static final BlockWarpChest warp_chest = get("warp_chest");
|
||||
public static final BlockStaticLiquid water = get("water");
|
||||
|
|
|
@ -19,11 +19,9 @@ import common.entity.animal.EntitySheep;
|
|||
import common.inventory.InventoryCrafting;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBanner;
|
||||
import common.item.material.ItemDye;
|
||||
import common.item.tool.ItemArmor;
|
||||
import common.tags.TagObject;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
|
||||
public abstract class CraftingRegistry
|
||||
{
|
||||
|
@ -212,15 +210,7 @@ public abstract class CraftingRegistry
|
|||
recipes.add(new RecipesArmorDyes());
|
||||
recipes.add(new RecipeFireworks());
|
||||
recipes.add(new RecipeRepairItem());
|
||||
|
||||
for (DyeColor color : DyeColor.values())
|
||||
{
|
||||
add(ItemBanner.getColoredBanner(color), "###", "###", " | ", '#', BlockWool.getByColor(color).getItem(), '|', Items.stick);
|
||||
}
|
||||
|
||||
recipes.add(new RecipeDuplicatePattern());
|
||||
recipes.add(new RecipeAddPattern());
|
||||
|
||||
add(new ItemStack(Items.paper, 3), "###", '#', Items.reeds);
|
||||
addShapeless(new ItemStack(Items.book, 1), Items.paper, Items.paper, Items.paper, Items.leather);
|
||||
addShapeless(new ItemStack(Items.writable_book, 1), Items.book, Items.ink_sack, Items.feather);
|
||||
|
@ -519,347 +509,6 @@ public abstract class CraftingRegistry
|
|||
ItemStack[] getRemainingItems(InventoryCrafting inv);
|
||||
}
|
||||
|
||||
private static class RecipeAddPattern implements IRecipe
|
||||
{
|
||||
public boolean matches(InventoryCrafting inv)
|
||||
{
|
||||
boolean flag = false;
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i)
|
||||
{
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null && itemstack.getItem() == Items.banner)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TileEntityBanner.getPatterns(itemstack) >= 6)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.getBannerPattern(inv) != null;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv)
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i)
|
||||
{
|
||||
ItemStack itemstack1 = inv.getStackInSlot(i);
|
||||
|
||||
if (itemstack1 != null && itemstack1.getItem() == Items.banner)
|
||||
{
|
||||
itemstack = itemstack1.copy();
|
||||
itemstack.size = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TileEntityBanner.EnumBannerPattern type = this.getBannerPattern(inv);
|
||||
|
||||
if (type != null)
|
||||
{
|
||||
String k = DyeColor.WHITE.getName();
|
||||
|
||||
for (int j = 0; j < inv.getSizeInventory(); ++j)
|
||||
{
|
||||
ItemStack itemstack2 = inv.getStackInSlot(j);
|
||||
|
||||
if (itemstack2 != null && itemstack2.getItem() instanceof ItemDye dye)
|
||||
{
|
||||
k = dye.getColor().getName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TagObject tag = itemstack.getSubTag("BlockEntityTag", true);
|
||||
List<TagObject> list = null;
|
||||
|
||||
if (tag.hasList("Patterns"))
|
||||
{
|
||||
list = tag.getList("Patterns");
|
||||
}
|
||||
else
|
||||
{
|
||||
list = Lists.newArrayList();
|
||||
tag.setList("Patterns", list);
|
||||
}
|
||||
|
||||
TagObject pattern = new TagObject();
|
||||
pattern.setString("Pattern", type.getPatternID());
|
||||
pattern.setString("Color", k);
|
||||
list.add(pattern);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack[] getRemainingItems(InventoryCrafting inv)
|
||||
{
|
||||
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < aitemstack.length; ++i)
|
||||
{
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null && itemstack.getItem().hasContainerItem())
|
||||
{
|
||||
aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem());
|
||||
}
|
||||
}
|
||||
|
||||
return aitemstack;
|
||||
}
|
||||
|
||||
private TileEntityBanner.EnumBannerPattern getBannerPattern(InventoryCrafting p_179533_1_)
|
||||
{
|
||||
for (TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern : TileEntityBanner.EnumBannerPattern.values())
|
||||
{
|
||||
if (tileentitybanner$enumbannerpattern.hasValidCrafting())
|
||||
{
|
||||
boolean flag = true;
|
||||
|
||||
if (tileentitybanner$enumbannerpattern.hasCraftingStack())
|
||||
{
|
||||
boolean flag1 = false;
|
||||
boolean flag2 = false;
|
||||
|
||||
for (int i = 0; i < p_179533_1_.getSizeInventory() && flag; ++i)
|
||||
{
|
||||
ItemStack itemstack = p_179533_1_.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null && itemstack.getItem() != Items.banner)
|
||||
{
|
||||
if (itemstack.getItem() instanceof ItemDye)
|
||||
{
|
||||
if (flag2)
|
||||
{
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
|
||||
flag2 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (flag1 || !itemstack.isItemEqual(tileentitybanner$enumbannerpattern.getCraftingStack()))
|
||||
{
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag1)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
else if (p_179533_1_.getSizeInventory() == tileentitybanner$enumbannerpattern.getCraftingLayers().length * tileentitybanner$enumbannerpattern.getCraftingLayers()[0].length())
|
||||
{
|
||||
DyeColor j = null;
|
||||
|
||||
for (int k = 0; k < p_179533_1_.getSizeInventory() && flag; ++k)
|
||||
{
|
||||
int l = k / 3;
|
||||
int i1 = k % 3;
|
||||
ItemStack itemstack1 = p_179533_1_.getStackInSlot(k);
|
||||
|
||||
if (itemstack1 != null && itemstack1.getItem() != Items.banner)
|
||||
{
|
||||
if (!(itemstack1.getItem() instanceof ItemDye dye))
|
||||
{
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (j != null && j != dye.getColor())
|
||||
{
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (tileentitybanner$enumbannerpattern.getCraftingLayers()[l].charAt(i1) == 32)
|
||||
{
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
|
||||
j = dye.getColor();
|
||||
}
|
||||
else if (tileentitybanner$enumbannerpattern.getCraftingLayers()[l].charAt(i1) != 32)
|
||||
{
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
return tileentitybanner$enumbannerpattern;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class RecipeDuplicatePattern implements IRecipe
|
||||
{
|
||||
public boolean matches(InventoryCrafting inv)
|
||||
{
|
||||
ItemStack itemstack = null;
|
||||
ItemStack itemstack1 = null;
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i)
|
||||
{
|
||||
ItemStack itemstack2 = inv.getStackInSlot(i);
|
||||
|
||||
if (itemstack2 != null)
|
||||
{
|
||||
if (itemstack2.getItem() != Items.banner)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemstack != null && itemstack1 != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DyeColor j = TileEntityBanner.getBaseColor(itemstack2);
|
||||
boolean flag = TileEntityBanner.getPatterns(itemstack2) > 0;
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (j != TileEntityBanner.getBaseColor(itemstack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
itemstack1 = itemstack2;
|
||||
}
|
||||
else if (itemstack1 != null)
|
||||
{
|
||||
if (!flag)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (j != TileEntityBanner.getBaseColor(itemstack1))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
itemstack = itemstack2;
|
||||
}
|
||||
else if (flag)
|
||||
{
|
||||
itemstack = itemstack2;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemstack1 = itemstack2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return itemstack != null && itemstack1 != null;
|
||||
}
|
||||
|
||||
public ItemStack getCraftingResult(InventoryCrafting inv)
|
||||
{
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i)
|
||||
{
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null && TileEntityBanner.getPatterns(itemstack) > 0)
|
||||
{
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
itemstack1.size = 1;
|
||||
return itemstack1;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public ItemStack[] getRemainingItems(InventoryCrafting inv)
|
||||
{
|
||||
ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];
|
||||
|
||||
for (int i = 0; i < aitemstack.length; ++i)
|
||||
{
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack.getItem().hasContainerItem())
|
||||
{
|
||||
aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem());
|
||||
}
|
||||
else if (itemstack.hasTag() && TileEntityBanner.getPatterns(itemstack) > 0)
|
||||
{
|
||||
aitemstack[i] = itemstack.copy();
|
||||
aitemstack[i].size = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return aitemstack;
|
||||
}
|
||||
}
|
||||
|
||||
private static class RecipeFireworks implements IRecipe
|
||||
{
|
||||
private ItemStack field_92102_a;
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.util.Set;
|
|||
import common.collect.Lists;
|
||||
import common.collect.Sets;
|
||||
import common.item.*;
|
||||
import common.item.block.ItemBanner;
|
||||
import common.item.block.ItemBed;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.item.block.ItemButton;
|
||||
|
@ -134,7 +133,6 @@ public abstract class Items {
|
|||
public static final ItemBlock assembly_unit = get("assembly_unit");
|
||||
public static final ItemFood baked_potato = get("baked_potato");
|
||||
public static final ItemBanHammer banhammer = get("banhammer");
|
||||
public static final ItemBanner banner = get("banner");
|
||||
public static final ItemBlock beacon = get("beacon");
|
||||
public static final ItemBlock bedrock = get("bedrock");
|
||||
public static final ItemFood beef = get("beef");
|
||||
|
|
|
@ -7,7 +7,6 @@ public abstract class Registry {
|
|||
SpeciesRegistry.register();
|
||||
EntityRegistry.registerEggs();
|
||||
ItemRegistry.register();
|
||||
TileRegistry.register();
|
||||
CraftingRegistry.register();
|
||||
SmeltingRegistry.register();
|
||||
EntityRegistry.register();
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
package common.init;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import common.collect.Maps;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
import common.tileentity.TileEntityBeacon;
|
||||
import common.tileentity.TileEntityBrewingStand;
|
||||
import common.tileentity.TileEntityChest;
|
||||
import common.tileentity.TileEntityComparator;
|
||||
import common.tileentity.TileEntityDaylightDetector;
|
||||
import common.tileentity.TileEntityDispenser;
|
||||
import common.tileentity.TileEntityDisplay;
|
||||
import common.tileentity.TileEntityDropper;
|
||||
import common.tileentity.TileEntityEnchantmentTable;
|
||||
import common.tileentity.TileEntityFurnace;
|
||||
import common.tileentity.TileEntityHopper;
|
||||
import common.tileentity.TileEntityMobSpawner;
|
||||
import common.tileentity.TileEntityPiston;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.tileentity.TileEntityTianReactor;
|
||||
|
||||
public abstract class TileRegistry {
|
||||
public static final Map<String, Class<? extends TileEntity>> NAME_TO_CLASS = Maps.<String, Class<? extends TileEntity>>newHashMap();
|
||||
public static final Map<Class<? extends TileEntity>, String> CLASS_TO_NAME = Maps.<Class<? extends TileEntity>, String>newHashMap();
|
||||
public static final Map<Class<? extends TileEntity>, Integer> CLASS_TO_ID = Maps.<Class<? extends TileEntity>, Integer>newHashMap();
|
||||
|
||||
private static int nextId;
|
||||
|
||||
private static void addMapping(Class<? extends TileEntity> cl, String id) {
|
||||
if(NAME_TO_CLASS.containsKey(id))
|
||||
throw new IllegalArgumentException("Duplicate id: " + id);
|
||||
NAME_TO_CLASS.put(id, cl);
|
||||
CLASS_TO_NAME.put(cl, id);
|
||||
CLASS_TO_ID.put(cl, ++nextId);
|
||||
}
|
||||
|
||||
static void register() {
|
||||
addMapping(TileEntityFurnace.class, "Furnace");
|
||||
addMapping(TileEntityChest.class, "Chest");
|
||||
addMapping(TileEntityDispenser.class, "Trap");
|
||||
addMapping(TileEntityDropper.class, "Dropper");
|
||||
addMapping(TileEntitySign.class, "Sign");
|
||||
addMapping(TileEntityDisplay.class, "Display");
|
||||
addMapping(TileEntityPiston.class, "Piston");
|
||||
addMapping(TileEntityBrewingStand.class, "Cauldron");
|
||||
addMapping(TileEntityEnchantmentTable.class, "EnchantTable");
|
||||
addMapping(TileEntityBeacon.class, "Beacon");
|
||||
addMapping(TileEntityDaylightDetector.class, "DLDetector");
|
||||
addMapping(TileEntityHopper.class, "Hopper");
|
||||
addMapping(TileEntityComparator.class, "Comparator");
|
||||
addMapping(TileEntityBanner.class, "Banner");
|
||||
addMapping(TileEntityTianReactor.class, "TianReactor");
|
||||
addMapping(TileEntityMobSpawner.class, "MobSpawner");
|
||||
}
|
||||
}
|
|
@ -1,200 +0,0 @@
|
|||
package common.item.block;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.tile.BlockBannerStanding;
|
||||
import common.block.tile.BlockStandingSign;
|
||||
import common.block.tile.BlockWallSign;
|
||||
import common.collect.Lists;
|
||||
import common.color.DyeColor;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transforms;
|
||||
import common.tags.TagObject;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.world.World;
|
||||
|
||||
public class ItemBanner extends Item
|
||||
{
|
||||
private final BlockBannerStanding block;
|
||||
|
||||
public ItemBanner(BlockBannerStanding block)
|
||||
{
|
||||
this.block = block;
|
||||
this.setTab(CheatTab.DECORATION);
|
||||
}
|
||||
|
||||
public static ItemStack getColoredBanner(DyeColor color) {
|
||||
return Items.banner.getColored(color);
|
||||
}
|
||||
|
||||
private ItemStack getColored(DyeColor color) {
|
||||
TagObject tag = new TagObject();
|
||||
TileEntityBanner.setBaseColorAndPatterns(tag, color, null);
|
||||
TagObject tile = new TagObject();
|
||||
tile.setObject("BlockEntityTag", tag);
|
||||
ItemStack stack = new ItemStack(this);
|
||||
stack.setTag(tile);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public Block getBlock()
|
||||
{
|
||||
return this.block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a Block is right-clicked with this Item
|
||||
*/
|
||||
public boolean onItemUse(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (side == Facing.DOWN)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!worldIn.getState(pos).getBlock().getMaterial().isSolid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = pos.offset(side);
|
||||
|
||||
if (!playerIn.canPlayerEdit(pos, side, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!this.block.canPlaceBlockAt(worldIn, pos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (worldIn.client)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (side == Facing.UP)
|
||||
{
|
||||
int i = ExtMath.floord((double)((playerIn.rotYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
|
||||
worldIn.setState(pos, Blocks.banner.getState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setState(pos, Blocks.wall_banner.getState().withProperty(BlockWallSign.FACING, side), 3);
|
||||
}
|
||||
|
||||
--stack.size;
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntityBanner)
|
||||
{
|
||||
((TileEntityBanner)tileentity).setItemValues(stack);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getDisplay(ItemStack stack)
|
||||
{
|
||||
// String s = "item.banner.";
|
||||
DyeColor enumdyecolor = this.getBaseColor(stack);
|
||||
// s = s + + ".name";
|
||||
return enumdyecolor.getSubject(0) + " " + super.getDisplay(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* allows items to add custom lines of information to the mouseover description
|
||||
*/
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
TagObject tag = stack.getSubTag("BlockEntityTag", false);
|
||||
|
||||
if (tag != null && tag.hasList("Patterns"))
|
||||
{
|
||||
List<TagObject> list = tag.getList("Patterns");
|
||||
|
||||
for (int i = 0; i < list.size() && i < 6; ++i)
|
||||
{
|
||||
TagObject pat = list.get(i);
|
||||
DyeColor color = DyeColor.byName(pat.getString("Color"));
|
||||
TileEntityBanner.EnumBannerPattern pattern = TileEntityBanner.EnumBannerPattern.getPatternByID(pat.getString("Pattern"));
|
||||
|
||||
if (pattern != null)
|
||||
{
|
||||
tooltip.add(String.format(pattern.getDisplay(), pattern.isColorLowercase() ?
|
||||
color.getSubject(pattern.getDisplayType()).toLowerCase() : color.getSubject(pattern.getDisplayType())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getColorFromItemStack(ItemStack stack, int renderPass)
|
||||
{
|
||||
if (renderPass == 0)
|
||||
{
|
||||
return 16777215;
|
||||
}
|
||||
else
|
||||
{
|
||||
DyeColor enumdyecolor = this.getBaseColor(stack);
|
||||
return enumdyecolor.getColor();
|
||||
}
|
||||
}
|
||||
|
||||
public List<TagObject> getItemTags()
|
||||
{
|
||||
List<TagObject> tags = Lists.newArrayList();
|
||||
for (DyeColor color : DyeColor.values())
|
||||
{
|
||||
tags.add(this.getColored(color).getTag());
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the tab this item is displayed on
|
||||
*/
|
||||
public CheatTab getTab()
|
||||
{
|
||||
return CheatTab.DECORATION;
|
||||
}
|
||||
|
||||
private DyeColor getBaseColor(ItemStack stack)
|
||||
{
|
||||
TagObject tag = stack.getSubTag("BlockEntityTag", false);
|
||||
DyeColor color = null;
|
||||
|
||||
if (tag != null && tag.hasString("Base"))
|
||||
{
|
||||
color = DyeColor.byName(tag.getString("Base"));
|
||||
}
|
||||
else
|
||||
{
|
||||
color = DyeColor.WHITE;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
public Transforms getTransform() {
|
||||
return Transforms.BANNER;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name) {
|
||||
return provider.getModel(provider.getEntityModel(), this.getTransform());
|
||||
}
|
||||
}
|
|
@ -1,347 +0,0 @@
|
|||
package common.tileentity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import common.collect.Lists;
|
||||
import common.color.DyeColor;
|
||||
import common.init.Items;
|
||||
import common.item.ItemStack;
|
||||
import common.network.Packet;
|
||||
import common.packet.SPacketUpdateTileEntity;
|
||||
import common.tags.TagObject;
|
||||
|
||||
public class TileEntityBanner extends TileEntity
|
||||
{
|
||||
private DyeColor baseColor;
|
||||
|
||||
/** A list of all the banner patterns. */
|
||||
private List<TagObject> patterns;
|
||||
private boolean field_175119_g;
|
||||
private List<TileEntityBanner.EnumBannerPattern> patternList;
|
||||
private List<DyeColor> colorList;
|
||||
|
||||
/**
|
||||
* This is a String representation of this banners pattern and color lists, used for texture caching.
|
||||
*/
|
||||
private String patternResourceLocation;
|
||||
|
||||
public void setItemValues(ItemStack stack)
|
||||
{
|
||||
this.patterns = null;
|
||||
|
||||
if (stack.hasTag() && stack.getTag().hasObject("BlockEntityTag"))
|
||||
{
|
||||
TagObject nbttagcompound = stack.getTag().getObject("BlockEntityTag");
|
||||
|
||||
if (nbttagcompound.hasList("Patterns"))
|
||||
{
|
||||
this.patterns = Lists.newArrayList();
|
||||
for(TagObject pattern : nbttagcompound.getList("Patterns")) {
|
||||
this.patterns.add(pattern.copy());
|
||||
}
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasString("Base"))
|
||||
{
|
||||
this.baseColor = DyeColor.byName(nbttagcompound.getString("Base"));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.baseColor = DyeColor.WHITE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.baseColor = DyeColor.WHITE;
|
||||
}
|
||||
|
||||
this.patternList = null;
|
||||
this.colorList = null;
|
||||
this.patternResourceLocation = "";
|
||||
this.field_175119_g = true;
|
||||
}
|
||||
|
||||
public void writeTags(TagObject compound)
|
||||
{
|
||||
super.writeTags(compound);
|
||||
setBaseColorAndPatterns(compound, this.baseColor, this.patterns);
|
||||
}
|
||||
|
||||
public static void setBaseColorAndPatterns(TagObject compound, DyeColor baseColorIn, List<TagObject> patternsIn)
|
||||
{
|
||||
compound.setString("Base", baseColorIn.getName());
|
||||
|
||||
if (patternsIn != null)
|
||||
{
|
||||
compound.setList("Patterns", patternsIn);
|
||||
}
|
||||
}
|
||||
|
||||
public void readTags(TagObject compound)
|
||||
{
|
||||
super.readTags(compound);
|
||||
this.baseColor = DyeColor.byName(compound.getString("Base"));
|
||||
this.patterns = compound.getList("Patterns");
|
||||
this.patternList = null;
|
||||
this.colorList = null;
|
||||
this.patternResourceLocation = null;
|
||||
this.field_175119_g = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows for a specialized description packet to be created. This is often used to sync tile entity data from the
|
||||
* server to the client easily. For example this is used by signs to synchronise the text to be displayed.
|
||||
*/
|
||||
public Packet getDescriptionPacket()
|
||||
{
|
||||
return new SPacketUpdateTileEntity(this);
|
||||
}
|
||||
|
||||
public DyeColor getBaseColor()
|
||||
{
|
||||
return this.baseColor;
|
||||
}
|
||||
|
||||
public static DyeColor getBaseColor(ItemStack stack)
|
||||
{
|
||||
TagObject nbttagcompound = stack.getSubTag("BlockEntityTag", false);
|
||||
return nbttagcompound != null && nbttagcompound.hasString("Base") ? DyeColor.byName(nbttagcompound.getString("Base")) : DyeColor.WHITE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the amount of patterns stored on an ItemStack. If the tag does not exist this value will be 0.
|
||||
*/
|
||||
public static int getPatterns(ItemStack stack)
|
||||
{
|
||||
TagObject nbttagcompound = stack.getSubTag("BlockEntityTag", false);
|
||||
return nbttagcompound != null && nbttagcompound.hasList("Patterns") ? nbttagcompound.getList("Patterns").size() : 0;
|
||||
}
|
||||
|
||||
public List<TileEntityBanner.EnumBannerPattern> getPatternList()
|
||||
{
|
||||
this.initializeBannerData();
|
||||
return this.patternList;
|
||||
}
|
||||
|
||||
public List<TagObject> getPatterns()
|
||||
{
|
||||
return this.patterns;
|
||||
}
|
||||
|
||||
public List<DyeColor> getColorList()
|
||||
{
|
||||
this.initializeBannerData();
|
||||
return this.colorList;
|
||||
}
|
||||
|
||||
public String getPatternResourceLocation()
|
||||
{
|
||||
this.initializeBannerData();
|
||||
return this.patternResourceLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Establishes all of the basic properties for the banner. This will also apply the data from the tile entities nbt
|
||||
* tag compounds.
|
||||
*/
|
||||
private void initializeBannerData()
|
||||
{
|
||||
if (this.patternList == null || this.colorList == null || this.patternResourceLocation == null)
|
||||
{
|
||||
if (!this.field_175119_g)
|
||||
{
|
||||
this.patternResourceLocation = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.patternList = Lists.<TileEntityBanner.EnumBannerPattern>newArrayList();
|
||||
this.colorList = Lists.<DyeColor>newArrayList();
|
||||
this.patternList.add(TileEntityBanner.EnumBannerPattern.BASE);
|
||||
this.colorList.add(this.baseColor);
|
||||
this.patternResourceLocation = "b" + this.baseColor.ordinal();
|
||||
|
||||
if (this.patterns != null)
|
||||
{
|
||||
for (int i = 0; i < this.patterns.size(); ++i)
|
||||
{
|
||||
TagObject nbttagcompound = this.patterns.get(i);
|
||||
TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern = TileEntityBanner.EnumBannerPattern.getPatternByID(nbttagcompound.getString("Pattern"));
|
||||
|
||||
if (tileentitybanner$enumbannerpattern != null)
|
||||
{
|
||||
this.patternList.add(tileentitybanner$enumbannerpattern);
|
||||
String j = nbttagcompound.getString("Color");
|
||||
DyeColor color = DyeColor.byName(j);
|
||||
this.colorList.add(color);
|
||||
this.patternResourceLocation = this.patternResourceLocation + tileentitybanner$enumbannerpattern.getPatternID() + color.ordinal();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all the banner related data from a provided instance of ItemStack.
|
||||
*/
|
||||
public static void removeBannerData(ItemStack stack)
|
||||
{
|
||||
TagObject nbttagcompound = stack.getSubTag("BlockEntityTag", false);
|
||||
|
||||
if (nbttagcompound != null && nbttagcompound.hasList("Patterns"))
|
||||
{
|
||||
List<TagObject> nbttaglist = nbttagcompound.getList("Patterns");
|
||||
|
||||
if (nbttaglist.size() > 0)
|
||||
{
|
||||
nbttaglist.remove(nbttaglist.size() - 1);
|
||||
|
||||
if (nbttaglist.isEmpty())
|
||||
{
|
||||
stack.getTag().remove("BlockEntityTag");
|
||||
|
||||
if (stack.getTag().isEmpty())
|
||||
{
|
||||
stack.setTag((TagObject)null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static enum EnumBannerPattern
|
||||
{
|
||||
BASE("base", "b", "%s Banner", 0, false),
|
||||
SQUARE_BOTTOM_LEFT("square_bottom_left", "bl", "%s rechtes Untereck", 0, false, " ", " ", "# "),
|
||||
SQUARE_BOTTOM_RIGHT("square_bottom_right", "br", "%s linkes Untereck", 0, false, " ", " ", " #"),
|
||||
SQUARE_TOP_LEFT("square_top_left", "tl", "%s rechtes Obereck", 0, false, "# ", " ", " "),
|
||||
SQUARE_TOP_RIGHT("square_top_right", "tr", "%s linkes Obereck", 0, false, " #", " ", " "),
|
||||
STRIPE_BOTTOM("stripe_bottom", "bs", "%s Bannerfuß", 1, false, " ", " ", "###"),
|
||||
STRIPE_TOP("stripe_top", "ts", "%s Bannerhaupt", 0, false, "###", " ", " "),
|
||||
STRIPE_LEFT("stripe_left", "ls", "%s rechte Flanke", -1, false, "# ", "# ", "# "),
|
||||
STRIPE_RIGHT("stripe_right", "rs", "%s linke Flanke", -1, false, " #", " #", " #"),
|
||||
STRIPE_CENTER("stripe_center", "cs", "%s Pfahl", 1, false, " # ", " # ", " # "),
|
||||
STRIPE_MIDDLE("stripe_middle", "ms", "%s Balken", 1, false, " ", "###", " "),
|
||||
STRIPE_DOWNRIGHT("stripe_downright", "drs", "%s Schrägbalken", 1, false, "# ", " # ", " #"),
|
||||
STRIPE_DOWNLEFT("stripe_downleft", "dls", "%s Schräglinksbalken", 1, false, " #", " # ", "# "),
|
||||
STRIPE_SMALL("small_stripes", "ss", "Vier %s Pfähle", 1, true, "# #", "# #", " "),
|
||||
CROSS("cross", "cr", "%s Andreaskreuz", 0, false, "# #", " # ", "# #"),
|
||||
STRAIGHT_CROSS("straight_cross", "sc", "%s Kreuz", 0, false, " # ", "###", " # "),
|
||||
TRIANGLE_BOTTOM("triangle_bottom", "bt", "%s halbe Spitze", -1, false, " ", " # ", "# #"),
|
||||
TRIANGLE_TOP("triangle_top", "tt", "%s gestürzte halbe Spitze", -1, false, "# #", " # ", " "),
|
||||
TRIANGLES_BOTTOM("triangles_bottom", "bts", "%s gespickelter Bannerfuß", 1, false, " ", "# #", " # "),
|
||||
TRIANGLES_TOP("triangles_top", "tts", "%s gespickeltes Bannerhaupt", 0, false, " # ", "# #", " "),
|
||||
DIAGONAL_LEFT("diagonal_left", "ld", "%s schräglinks geteilt", null, false, "## ", "# ", " "),
|
||||
DIAGONAL_RIGHT("diagonal_up_right", "rd", "%s schräglinks geteilt (Invertiert)", null, false, " ", " #", " ##"),
|
||||
DIAGONAL_LEFT_MIRROR("diagonal_up_left", "lud", "%s schrägrechts geteilt (Invertiert)", null, false, " ", "# ", "## "),
|
||||
DIAGONAL_RIGHT_MIRROR("diagonal_right", "rud", "%s schrägrechts geteilt", null, false, " ##", " #", " "),
|
||||
CIRCLE_MIDDLE("circle", "mc", "%s Kugel", -1, false, " ", " # ", " "),
|
||||
RHOMBUS_MIDDLE("rhombus", "mr", "%s Raute", -1, false, " # ", "# #", " # "),
|
||||
HALF_VERTICAL("half_vertical", "vh", "Rechts %s gespalten", null, true, "## ", "## ", "## "),
|
||||
HALF_HORIZONTAL("half_horizontal", "hh", "Oben %s geteilt", null, true, "###", "###", " "),
|
||||
HALF_VERTICAL_MIRROR("half_vertical_right", "vhr", "Links %s gespalten", null, true, " ##", " ##", " ##"),
|
||||
HALF_HORIZONTAL_MIRROR("half_horizontal_bottom", "hhb", "Unten %s geteilt", null, true, " ", "###", "###"),
|
||||
BORDER("border", "bo", "%s Bord", 1, false, "###", "# #", "###"),
|
||||
CURLY_BORDER("curly_border", "cbo", "%s Spickelbord", 1, false, new ItemStack(Items.vine)),
|
||||
RUNE("rune", "run", "%s Rune", -1, false, new ItemStack(Items.golden_apple)),
|
||||
GRADIENT("gradient", "gra", "%s Farbverlauf", 1, false, "# #", " # ", " # "),
|
||||
GRADIENT_UP("gradient_up", "gru", "%s Farbverlauf (Invertiert)", 1, false, " # ", " # ", "# #"),
|
||||
BRICKS("bricks", "bri", "Feld %s gemauert", null, true, new ItemStack(Items.brick_block)),
|
||||
SKULL("skull", "sku", "%s Schädel", 1, false, new ItemStack(Items.skull)),
|
||||
FLOWER("flower", "flo", "%s Blume", -1, false, new ItemStack(Items.daisy)),
|
||||
THING("thing", "thi", "%s <???>", 0, false, new ItemStack(Items.charged_apple));
|
||||
|
||||
private String patternName;
|
||||
private String patternID;
|
||||
private String display;
|
||||
private Integer displayType;
|
||||
private boolean displayLower;
|
||||
private String[] craftingLayers;
|
||||
private ItemStack patternCraftingStack;
|
||||
|
||||
private EnumBannerPattern(String name, String id, String display, Integer displayType, boolean displayLower)
|
||||
{
|
||||
this.craftingLayers = new String[3];
|
||||
this.patternName = name;
|
||||
this.patternID = id;
|
||||
this.display = display;
|
||||
this.displayType = displayType;
|
||||
}
|
||||
|
||||
private EnumBannerPattern(String name, String id, String display, Integer displayType, boolean displayLower, ItemStack craftingItem)
|
||||
{
|
||||
this(name, id, display, displayType, displayLower);
|
||||
this.patternCraftingStack = craftingItem;
|
||||
}
|
||||
|
||||
private EnumBannerPattern(String name, String id, String display, Integer displayType, boolean displayLower, String craftingTop, String craftingMid, String craftingBot)
|
||||
{
|
||||
this(name, id, display, displayType, displayLower);
|
||||
this.craftingLayers[0] = craftingTop;
|
||||
this.craftingLayers[1] = craftingMid;
|
||||
this.craftingLayers[2] = craftingBot;
|
||||
}
|
||||
|
||||
public String getPatternName()
|
||||
{
|
||||
return this.patternName;
|
||||
}
|
||||
|
||||
public String getPatternID()
|
||||
{
|
||||
return this.patternID;
|
||||
}
|
||||
|
||||
public String getDisplay()
|
||||
{
|
||||
return this.display;
|
||||
}
|
||||
|
||||
public Integer getDisplayType()
|
||||
{
|
||||
return this.displayType;
|
||||
}
|
||||
|
||||
public boolean isColorLowercase()
|
||||
{
|
||||
return this.displayLower;
|
||||
}
|
||||
|
||||
public String[] getCraftingLayers()
|
||||
{
|
||||
return this.craftingLayers;
|
||||
}
|
||||
|
||||
public boolean hasValidCrafting()
|
||||
{
|
||||
return this.patternCraftingStack != null || this.craftingLayers[0] != null;
|
||||
}
|
||||
|
||||
public boolean hasCraftingStack()
|
||||
{
|
||||
return this.patternCraftingStack != null;
|
||||
}
|
||||
|
||||
public ItemStack getCraftingStack()
|
||||
{
|
||||
return this.patternCraftingStack;
|
||||
}
|
||||
|
||||
public static TileEntityBanner.EnumBannerPattern getPatternByID(String id)
|
||||
{
|
||||
for (TileEntityBanner.EnumBannerPattern tileentitybanner$enumbannerpattern : values())
|
||||
{
|
||||
if (tileentitybanner$enumbannerpattern.patternID.equals(id))
|
||||
{
|
||||
return tileentitybanner$enumbannerpattern;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -124,8 +124,6 @@ public abstract class ReorderRegistry {
|
|||
PLACE_FINAL.add(Blocks.cake);
|
||||
PLACE_FINAL.add(Blocks.piston_head);
|
||||
PLACE_FINAL.add(Blocks.piston_extension);
|
||||
PLACE_FINAL.add(Blocks.banner);
|
||||
PLACE_FINAL.add(Blocks.wall_banner);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.io.FilenameFilter;
|
|||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
@ -87,8 +88,6 @@ import common.block.tech.BlockTorch;
|
|||
import common.block.tech.BlockTripWire;
|
||||
import common.block.tech.BlockTripWireHook;
|
||||
import common.block.tech.BlockWarpChest;
|
||||
import common.block.tile.BlockBannerHanging;
|
||||
import common.block.tile.BlockBannerStanding;
|
||||
import common.block.tile.BlockStandingSign;
|
||||
import common.block.tile.BlockWallSign;
|
||||
import common.collect.Lists;
|
||||
|
@ -115,7 +114,6 @@ import common.log.Log;
|
|||
import common.rng.Random;
|
||||
import common.tags.TagObject;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityBanner;
|
||||
import common.tileentity.TileEntityBeacon;
|
||||
import common.tileentity.TileEntityChest;
|
||||
import common.tileentity.TileEntityComparator;
|
||||
|
@ -385,7 +383,8 @@ public abstract class Converter {
|
|||
mapTile(TileEntityDaylightDetector.class, "DLDetector", "daylight_detector");
|
||||
mapTile(TileEntityHopper.class, "Hopper", "hopper");
|
||||
mapTile(TileEntityComparator.class, "Comparator", "comparator");
|
||||
mapTile(TileEntityBanner.class, "Banner", "banner");
|
||||
|
||||
Arrays.fill(BLOCK_MAP, Blocks.air.getState());
|
||||
|
||||
mapBlock(Blocks.stone, 1);
|
||||
mapBlock(Blocks.rock, 1, 1);
|
||||
|
@ -1439,26 +1438,6 @@ public abstract class Converter {
|
|||
mapBlock(Blocks.large_fern, 175, 3);
|
||||
mapBlock(Blocks.rose_bush, 175, 4);
|
||||
mapBlock(Blocks.paeonia, 175, 5);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 0), 176, 0);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 1), 176, 1);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 2), 176, 2);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 3), 176, 3);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 4), 176, 4);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 5), 176, 5);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 6), 176, 6);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 7), 176, 7);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 8), 176, 8);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 9), 176, 9);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 10), 176, 10);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 11), 176, 11);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 12), 176, 12);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 13), 176, 13);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 14), 176, 14);
|
||||
mapBlock(Blocks.banner.getState().withProperty(BlockBannerStanding.ROTATION, 15), 176, 15);
|
||||
mapBlock(Blocks.wall_banner.getState().withProperty(BlockBannerHanging.FACING, Facing.NORTH), 177);
|
||||
mapBlock(Blocks.wall_banner.getState().withProperty(BlockBannerHanging.FACING, Facing.SOUTH), 177, 3, 9, 15);
|
||||
mapBlock(Blocks.wall_banner.getState().withProperty(BlockBannerHanging.FACING, Facing.WEST), 177, 4, 10);
|
||||
mapBlock(Blocks.wall_banner.getState().withProperty(BlockBannerHanging.FACING, Facing.EAST), 177, 5, 11);
|
||||
mapBlock(Blocks.daylight_detector_inverted.getState().withProperty(BlockDaylightDetector.POWER, 0), 178, 0);
|
||||
mapBlock(Blocks.daylight_detector_inverted.getState().withProperty(BlockDaylightDetector.POWER, 1), 178, 1);
|
||||
mapBlock(Blocks.daylight_detector_inverted.getState().withProperty(BlockDaylightDetector.POWER, 2), 178, 2);
|
||||
|
|
|
@ -83,7 +83,7 @@ public class Region {
|
|||
mapping.put(bid, id);
|
||||
highest = bid > highest ? bid : highest;
|
||||
missing.remove(id);
|
||||
Log.IO.debug("Geänderte Block-ID %d = %s -> %s", (int)bid, oid, id);
|
||||
Log.IO.debug((id.equals(oid) ? "Mehrfache" : "Geänderte") + " Block-ID %d = %s -> %s", (int)bid, oid, id);
|
||||
}
|
||||
else {
|
||||
Log.IO.debug("Entfernte Block-ID %d = %s", (int)bid, oid);
|
||||
|
|