update textures #3 + item code cleanup
|
@ -128,7 +128,6 @@ import common.inventory.InventoryPlayer;
|
|||
import common.item.Item;
|
||||
import common.item.ItemControl;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.log.Log;
|
||||
import common.log.LogLevel;
|
||||
import common.net.bootstrap.Bootstrap;
|
||||
|
|
|
@ -19,7 +19,7 @@ import common.init.BlockRegistry;
|
|||
import common.init.Blocks;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.Item;
|
||||
import common.item.tool.ItemPotion;
|
||||
import common.item.consumable.ItemPotion;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Set;
|
|||
|
||||
import client.renderer.texture.TextureAtlasSprite;
|
||||
import client.renderer.texture.TextureMap;
|
||||
import common.block.Block;
|
||||
import common.block.liquid.BlockDynamicLiquid;
|
||||
import common.block.liquid.BlockLiquid;
|
||||
import common.block.liquid.BlockStaticLiquid;
|
||||
|
@ -18,7 +19,10 @@ import common.collect.Sets;
|
|||
import common.init.BlockRegistry;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.Item;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.model.Transform;
|
||||
import common.util.Facing;
|
||||
import common.util.Pair;
|
||||
import common.world.State;
|
||||
|
@ -64,13 +68,13 @@ public abstract class ModelBakery
|
|||
for (Item item : ItemRegistry.items())
|
||||
{
|
||||
String loc = "item/" + ItemRegistry.getName(item);
|
||||
models.put(loc, (ModelBlock)item.getModel(ModelBlock.PROVIDER, ItemRegistry.getName(item)));
|
||||
models.put(loc, getModel(item, ModelBlock.PROVIDER, ItemRegistry.getName(item)));
|
||||
itemLocations.add(loc);
|
||||
String[] extra = item.getSprites();
|
||||
if(extra != null) {
|
||||
for(String sprite : extra) {
|
||||
loc = "item/" + sprite;
|
||||
models.put(loc, (ModelBlock)ModelBlock.PROVIDER.getModel(item.getTransform(), sprite));
|
||||
models.put(loc, new ModelBlock(Transform.IDENTITY, sprite));
|
||||
itemLocations.add(loc);
|
||||
}
|
||||
}
|
||||
|
@ -204,6 +208,21 @@ public abstract class ModelBakery
|
|||
return bakedRegistry;
|
||||
}
|
||||
|
||||
private static final ModelBlock getModel(Item item, ModelProvider provider, String name) {
|
||||
ModelBlock model = (ModelBlock)item.getCustomModel(provider, name);
|
||||
if(model != null)
|
||||
return new ModelBlock(model, item.getCustomTransform());
|
||||
if(item.hasBuiltinModel())
|
||||
return new ModelBlock(MODEL_ENTITY, Transform.IDENTITY);
|
||||
Block block = item.getBlock();
|
||||
if(block != null && block.getRenderType() != 3)
|
||||
return new ModelBlock(MODEL_ENTITY, Transform.IDENTITY);
|
||||
State state = block == null ? null : block.getItemState();
|
||||
if(state != null)
|
||||
return state.getBlock().hasBlockFlatTexture() ? new ModelBlock(state.getBlock().getTransform(), "blocks/" + name) : new ModelBlock((ModelBlock)state.getBlock().getModel(provider, BlockRegistry.getName(state.getBlock()), state), state.getBlock().getTransform());
|
||||
return new ModelBlock(Transform.IDENTITY, item.getTextures(name));
|
||||
}
|
||||
|
||||
private static IBakedModel bakeModel(Map<String, TextureAtlasSprite> sprites, FaceBakery faceBakery,
|
||||
TextureAtlasSprite fallback, ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked)
|
||||
{
|
||||
|
|
|
@ -17,18 +17,6 @@ public class ModelBlock extends Model {
|
|||
public Model getModel(String primary) {
|
||||
return new ModelBlock(primary);
|
||||
}
|
||||
|
||||
public Model getModel(Transform transform, String... layers) {
|
||||
return new ModelBlock(transform, layers);
|
||||
}
|
||||
|
||||
public Model getModel(Model parent, Transform transform) {
|
||||
return new ModelBlock((ModelBlock)parent, transform);
|
||||
}
|
||||
|
||||
public Model getEntityModel() {
|
||||
return ModelBakery.MODEL_ENTITY;
|
||||
}
|
||||
};
|
||||
|
||||
private final List<BlockPart> elements;
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package client.renderer.entity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import client.renderer.Drawing;
|
||||
import client.renderer.Frustum;
|
||||
import client.renderer.GlState;
|
||||
import common.entity.Entity;
|
||||
import common.util.BoundingBox;
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ public class RenderItem
|
|||
|
||||
if (flag && bakedquad.hasTintIndex())
|
||||
{
|
||||
k = stack.getItem().getColorFromItemStack(stack, bakedquad.getTintIndex());
|
||||
k = stack.getItem().getRenderColor(stack, bakedquad.getTintIndex());
|
||||
k = k | -16777216;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import client.renderer.model.ModelArmor;
|
|||
import client.renderer.model.ModelBiped;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.ItemStack;
|
||||
import common.item.tool.ItemArmor;
|
||||
import common.item.material.ItemArmor;
|
||||
|
||||
public class LayerArmor implements LayerRenderer<EntityLiving>
|
||||
{
|
||||
|
|
|
@ -10,7 +10,6 @@ import common.entity.types.EntityLiving;
|
|||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.model.Transform;
|
||||
|
||||
public class LayerHeldItem implements LayerRenderer<EntityLiving>
|
||||
|
@ -55,7 +54,7 @@ public class LayerHeldItem implements LayerRenderer<EntityLiving>
|
|||
Item item = itemstack.getItem();
|
||||
Client gm = Client.CLIENT;
|
||||
|
||||
if (item instanceof ItemBlock && item.getBlock().getRenderType() == 2)
|
||||
if (item.getBlock() != null && item.getBlock().getRenderType() == 2)
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
|
||||
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
|
||||
|
|
|
@ -7,14 +7,11 @@ import client.renderer.GlState;
|
|||
import client.renderer.layers.LayerArmor;
|
||||
import client.renderer.model.ModelHorse;
|
||||
import common.block.tech.BlockChest;
|
||||
import common.block.tile.BlockSign;
|
||||
import common.block.tile.BlockStandingSign;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.ItemRegistry;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemSign;
|
||||
import common.item.tool.ItemArmor;
|
||||
import common.item.tool.ItemHorseArmor;
|
||||
import common.item.material.ItemArmor;
|
||||
import common.item.material.ItemHorseArmor;
|
||||
import common.tileentity.TileEntityChest;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.util.Facing;
|
||||
|
@ -53,13 +50,13 @@ public class TileEntityItemStackRenderer {
|
|||
private final ModelHorse horse = new ModelHorse();
|
||||
|
||||
public void renderByItem(ItemStack stack) {
|
||||
if(stack.getItem() != null && stack.getItem().getBlock() instanceof BlockChest chest) {
|
||||
if(stack.getItem().getBlock() instanceof BlockChest chest) {
|
||||
this.state = chest.getState().withProperty(BlockChest.FACING, Facing.SOUTH);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chest, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
this.state = null;
|
||||
}
|
||||
else if(stack.getItem() instanceof ItemSign sign) {
|
||||
this.state = sign.getBlock().getState().withProperty(BlockStandingSign.ROTATION, 8);
|
||||
else if(stack.getItem().getBlock() instanceof BlockStandingSign sign) {
|
||||
this.state = sign.getState().withProperty(BlockStandingSign.ROTATION, 8);
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(this.sign, 0.0D, 0.0D, 0.0D, 0.0F);
|
||||
this.state = null;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.lwjgl.opengl.GL11;
|
|||
import client.renderer.Drawing;
|
||||
import client.renderer.GlState;
|
||||
import client.renderer.model.ModelSign;
|
||||
import common.block.Block;
|
||||
import common.block.tile.BlockStandingSign;
|
||||
import common.block.tile.BlockWallSign;
|
||||
import common.init.Blocks;
|
||||
|
|
|
@ -14,7 +14,6 @@ import common.init.EntityRegistry;
|
|||
import common.init.UniverseRegistry;
|
||||
import common.item.ItemControl;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.packet.CPacketAction;
|
||||
import common.packet.CPacketBreak;
|
||||
import common.packet.CPacketClick;
|
||||
|
@ -233,13 +232,8 @@ public class PlayerController {
|
|||
flag = true;
|
||||
}
|
||||
|
||||
if(!flag && stack != null && stack.getItem() instanceof ItemBlock) {
|
||||
ItemBlock itemblock = (ItemBlock)stack.getItem();
|
||||
|
||||
if(!itemblock.canPlaceBlockOnSide(world, pos, side, player, stack)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(!flag && stack != null && stack.getItem().getBlock() != null && !stack.getItem().getBlock().canPlace(world, pos, side, player, stack))
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
stack.getItem().onItemUse(stack, player, world, pos, side, f, f1, f2);
|
||||
|
|
Before Width: | Height: | Size: 108 B After Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 128 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 187 B After Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 306 B After Width: | Height: | Size: 306 B |
Before Width: | Height: | Size: 108 B After Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 128 B After Width: | Height: | Size: 128 B |
Before Width: | Height: | Size: 187 B After Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 236 B After Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 240 B |
Before Width: | Height: | Size: 422 B |
Before Width: | Height: | Size: 152 B After Width: | Height: | Size: 152 B |
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 100 B After Width: | Height: | Size: 100 B |
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 379 B After Width: | Height: | Size: 379 B |
Before Width: | Height: | Size: 454 B After Width: | Height: | Size: 454 B |
Before Width: | Height: | Size: 534 B After Width: | Height: | Size: 534 B |
Before Width: | Height: | Size: 562 B After Width: | Height: | Size: 562 B |
Before Width: | Height: | Size: 621 B After Width: | Height: | Size: 621 B |
Before Width: | Height: | Size: 147 B After Width: | Height: | Size: 147 B |
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 283 B |
BIN
client/src/main/resources/textures/items/wheat_seed.png
Executable file
After Width: | Height: | Size: 142 B |
Before Width: | Height: | Size: 283 B |
|
@ -66,7 +66,7 @@ public class EntityAIShareItems extends EntityAIWatchClosest2
|
|||
itemstack.decrSize(l);
|
||||
itemstack1 = new ItemStack(item, l);
|
||||
}
|
||||
else if (item == Items.wheats && itemstack.getSize() > 5)
|
||||
else if (item == Items.wheat && itemstack.getSize() > 5)
|
||||
{
|
||||
int j = itemstack.getSize() / 2 / 3 * 3;
|
||||
int k = j / 3;
|
||||
|
|
|
@ -13,7 +13,10 @@ import java.util.Set;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
|
||||
import common.attributes.Attribute;
|
||||
import common.attributes.UsageSlot;
|
||||
import common.block.artificial.BlockSlab;
|
||||
import common.block.natural.BlockSnow;
|
||||
import common.collect.ImmutableList;
|
||||
import common.collect.ImmutableMap;
|
||||
import common.collect.Iterables;
|
||||
|
@ -21,6 +24,8 @@ import common.collect.Lists;
|
|||
import common.collect.Maps;
|
||||
import common.collect.Sets;
|
||||
import common.collect.UnmodifiableIterator;
|
||||
import common.color.DyeColor;
|
||||
import common.color.TextColor;
|
||||
import common.enchantment.EnchantmentHelper;
|
||||
import common.entity.Entity;
|
||||
import common.entity.item.EntityItem;
|
||||
|
@ -28,10 +33,11 @@ import common.entity.item.EntityXp;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.BlockRegistry;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.item.StackSize;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -902,6 +908,10 @@ public class Block {
|
|||
public int getShearsEfficiency() {
|
||||
return this.shearsEfficiency;
|
||||
}
|
||||
|
||||
public float getRadiation() {
|
||||
return this.radiation;
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return false;
|
||||
|
@ -914,6 +924,10 @@ public class Block {
|
|||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel(name).add().all();
|
||||
}
|
||||
|
||||
public State getItemState() {
|
||||
return this.getState();
|
||||
}
|
||||
|
||||
public Property<?>[] getIgnoredProperties() {
|
||||
return null;
|
||||
|
@ -949,18 +963,14 @@ public class Block {
|
|||
return null;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemBlock(this);
|
||||
protected boolean hasRegisteredItem() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public final Item registerItem() {
|
||||
Item item = this.getItemToRegister();
|
||||
if(item == null)
|
||||
if(!this.hasRegisteredItem())
|
||||
return null;
|
||||
if(item.getBlock() != this)
|
||||
throw new IllegalArgumentException("Gegenstand für Block " + BlockRegistry.getName(this) + " stimmt nicht überein");
|
||||
this.item = item;
|
||||
return item;
|
||||
return this.item = new Item(this);
|
||||
}
|
||||
|
||||
public Item getItem() {
|
||||
|
@ -1053,7 +1063,89 @@ public class Block {
|
|||
return this.itemColored;
|
||||
}
|
||||
|
||||
public String getItemTexture(String name) {
|
||||
return name;
|
||||
public StackSize getMaxStackSize() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public TextColor getItemColor() {
|
||||
return this.radiation > 0.0f ? TextColor.GREEN : null;
|
||||
}
|
||||
|
||||
public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if(block == Blocks.snow_layer && iblockstate.getValue(BlockSnow.LAYERS).intValue() < 1)
|
||||
side = Facing.UP;
|
||||
else if (!block.isReplaceable(worldIn, pos))
|
||||
{
|
||||
pos = pos.offset(side);
|
||||
}
|
||||
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!playerIn.canPlayerEdit(pos, side, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (worldIn.canBlockBePlaced(this, pos, false, side, (Entity)null, stack))
|
||||
{
|
||||
State iblockstate1 = this.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, playerIn);
|
||||
|
||||
if (worldIn.setState(pos, iblockstate1, 3))
|
||||
{
|
||||
iblockstate1 = worldIn.getState(pos);
|
||||
|
||||
if (iblockstate1.getBlock() == this)
|
||||
{
|
||||
this.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn);
|
||||
}
|
||||
|
||||
worldIn.playSound(this.sound.getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), 1.0F);
|
||||
stack.decrSize();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack)
|
||||
{
|
||||
Block block = worldIn.getState(pos).getBlock();
|
||||
|
||||
if (block == Blocks.snow_layer)
|
||||
{
|
||||
side = Facing.UP;
|
||||
}
|
||||
else if (!block.isReplaceable(worldIn, pos))
|
||||
{
|
||||
pos = pos.offset(side);
|
||||
}
|
||||
|
||||
return worldIn.canBlockBePlaced(this, pos, false, side, (Entity)null, stack);
|
||||
}
|
||||
|
||||
public boolean prePlace(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean dispense(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
}
|
||||
|
||||
public void getModifiers(Map<Attribute, Float> map, UsageSlot slot)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public final class BlockAir extends Block {
|
|||
return false;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return null;
|
||||
protected boolean hasRegisteredItem() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,10 @@ import common.block.Material;
|
|||
import common.color.DyeColor;
|
||||
import common.color.TextColor;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemBed;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -16,6 +18,7 @@ import common.properties.Property;
|
|||
import common.properties.PropertyEnum;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.Identifyable;
|
||||
import common.util.WorldPos;
|
||||
|
@ -53,6 +56,7 @@ public class BlockBed extends Block implements Rotatable {
|
|||
super(Material.BURNABLE);
|
||||
this.color = color;
|
||||
this.setDefaultState(this.getBaseState().withProperty(PART, BlockBed.EnumPartType.FOOT));
|
||||
this.setTab(CheatTab.DECORATION);
|
||||
this.setBedBounds();
|
||||
}
|
||||
|
||||
|
@ -193,8 +197,73 @@ public class BlockBed extends Block implements Rotatable {
|
|||
.add(0, 3, 0, 16, 3, 16)
|
||||
.d("oak_planks").noCull().rotate(ModelRotation.getNorthRot(state.getValue(FACING).getOpposite()));
|
||||
}
|
||||
|
||||
public State getItemState() {
|
||||
return this.getState().withProperty(PART, EnumPartType.HEAD).withProperty(FACING, Facing.NORTH);
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemBed(this).setDisplay(this.color.getSubject(0) + " Bett");
|
||||
public StackSize getMaxStackSize() {
|
||||
return StackSize.S;
|
||||
}
|
||||
|
||||
public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (worldIn.client)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (side != Facing.UP)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
boolean flag = block.isReplaceable(worldIn, pos);
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
pos = pos.up();
|
||||
}
|
||||
|
||||
int i = ExtMath.floord((double)(playerIn.rotYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
Facing enumfacing = Facing.getHorizontal(i);
|
||||
BlockPos blockpos = pos.offset(enumfacing);
|
||||
|
||||
if (playerIn.canPlayerEdit(pos, side, stack) && playerIn.canPlayerEdit(blockpos, side, stack))
|
||||
{
|
||||
boolean flag1 = worldIn.getState(blockpos).getBlock().isReplaceable(worldIn, blockpos);
|
||||
boolean flag2 = flag || worldIn.isAirBlock(pos);
|
||||
boolean flag3 = flag1 || worldIn.isAirBlock(blockpos);
|
||||
|
||||
if (flag2 && flag3 && worldIn.isBlockSolid(pos.down()) && worldIn.isBlockSolid(blockpos.down()))
|
||||
{
|
||||
State iblockstate1 = this.getState() /* .withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)) */ .withProperty(BlockBed.FACING, enumfacing).withProperty(BlockBed.PART, BlockBed.EnumPartType.FOOT);
|
||||
|
||||
if (worldIn.setState(pos, iblockstate1, 3))
|
||||
{
|
||||
State iblockstate2 = iblockstate1.withProperty(BlockBed.PART, BlockBed.EnumPartType.HEAD);
|
||||
worldIn.setState(blockpos, iblockstate2, 3);
|
||||
}
|
||||
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack)
|
||||
{
|
||||
return side == Facing.UP;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,11 @@ import common.block.Rotatable;
|
|||
import common.block.Material;
|
||||
import common.collect.Lists;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemDoor;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.item.tool.ItemKey;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
|
@ -66,6 +69,7 @@ public class BlockDoor extends Block implements Rotatable {
|
|||
super(material);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(OPEN, false)
|
||||
.withProperty(HINGE, EnumHingePosition.LEFT).withProperty(HALF, EnumDoorHalf.LOWER));
|
||||
this.setTab(material == Material.WOOD ? CheatTab.WOOD : CheatTab.TECHNOLOGY);
|
||||
DOORS.add(this);
|
||||
}
|
||||
|
||||
|
@ -285,7 +289,78 @@ public class BlockDoor extends Block implements Rotatable {
|
|||
return Transform.PANE_SIDE;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemDoor(this);
|
||||
public State getItemState() {
|
||||
return this.getState().withProperty(HALF, EnumDoorHalf.UPPER).withProperty(FACING, Facing.NORTH);
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return this == Blocks.iron_door;
|
||||
}
|
||||
|
||||
public StackSize getMaxStackSize() {
|
||||
return StackSize.S;
|
||||
}
|
||||
|
||||
public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (side != Facing.UP)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
|
||||
if (!block.isReplaceable(worldIn, pos))
|
||||
{
|
||||
pos = pos.offset(side);
|
||||
}
|
||||
|
||||
if (!playerIn.canPlayerEdit(pos, side, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!this.canPlaceBlockAt(worldIn, pos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
placeDoor(worldIn, pos, Facing.fromAngle((double)playerIn.rotYaw), this, true);
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack)
|
||||
{
|
||||
return side == Facing.UP;
|
||||
}
|
||||
|
||||
public static void placeDoor(World worldIn, BlockPos pos, Facing facing, Block door, boolean update)
|
||||
{
|
||||
BlockPos blockpos = pos.offset(facing.rotateY());
|
||||
BlockPos blockpos1 = pos.offset(facing.rotateYCCW());
|
||||
int i = (worldIn.getState(blockpos1).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getState(blockpos1.up()).getBlock().isNormalCube() ? 1 : 0);
|
||||
int j = (worldIn.getState(blockpos).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getState(blockpos.up()).getBlock().isNormalCube() ? 1 : 0);
|
||||
boolean flag = worldIn.getState(blockpos1).getBlock() == door || worldIn.getState(blockpos1.up()).getBlock() == door;
|
||||
boolean flag1 = worldIn.getState(blockpos).getBlock() == door || worldIn.getState(blockpos.up()).getBlock() == door;
|
||||
boolean flag2 = false;
|
||||
|
||||
if (flag && !flag1 || j > i)
|
||||
{
|
||||
flag2 = true;
|
||||
}
|
||||
|
||||
BlockPos blockpos2 = pos.up();
|
||||
State iblockstate = door.getState().withProperty(BlockDoor.FACING, facing).withProperty(BlockDoor.HINGE, flag2 ? BlockDoor.EnumHingePosition.RIGHT : BlockDoor.EnumHingePosition.LEFT);
|
||||
worldIn.setState(pos, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2);
|
||||
worldIn.setState(blockpos2, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2);
|
||||
if(update) {
|
||||
worldIn.notifyNeighborsOfStateChange(pos, door);
|
||||
worldIn.notifyNeighborsOfStateChange(blockpos2, door);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import common.entity.Entity;
|
|||
import common.entity.npc.EntityNPC;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemFence;
|
||||
import common.item.tool.ItemLead;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -373,10 +372,10 @@ public class BlockFence extends Block
|
|||
.e().uv(7, 7, 9, 10)
|
||||
.rotate(!w ? ModelRotation.X0_Y0 : (!e ? ModelRotation.X0_Y180 : (!s ? ModelRotation.X0_Y270 : ModelRotation.X0_Y90)));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemFence(this);
|
||||
}
|
||||
|
||||
public State getItemState() {
|
||||
return this.getState().withProperty(EAST, false).withProperty(WEST, false).withProperty(NORTH, true).withProperty(SOUTH, true);
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
return new Property[] {NORTH, SOUTH, WEST, EAST};
|
||||
|
|
|
@ -151,7 +151,7 @@ public class BlockFloorPortal extends Block
|
|||
return "obsidian";
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return null;
|
||||
protected boolean hasRegisteredItem() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import common.init.Items;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -141,7 +140,7 @@ public class BlockFlowerPot extends Block
|
|||
{
|
||||
ItemStack itemstack = playerIn.inventory.getCurrentItem();
|
||||
|
||||
if (itemstack != null && itemstack.getItem() instanceof ItemBlock)
|
||||
if (itemstack != null && itemstack.getItem().getBlock() != null)
|
||||
{
|
||||
if (this.content != null)
|
||||
{
|
||||
|
@ -259,8 +258,8 @@ public class BlockFlowerPot extends Block
|
|||
}
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return this.content == null ? super.getItemToRegister() : null;
|
||||
protected boolean hasRegisteredItem() {
|
||||
return this.content == null;
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
package common.block.artificial;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import common.attributes.Attribute;
|
||||
import common.attributes.UsageSlot;
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.block.SoundType;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.MetalType;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemMetalBlock;
|
||||
import common.item.ItemStack;
|
||||
|
||||
public class BlockMetalBlock extends Block {
|
||||
private final MetalType metal;
|
||||
|
@ -23,8 +29,23 @@ public class BlockMetalBlock extends Block {
|
|||
public MetalType getMetal() {
|
||||
return this.metal;
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return this.metal.isMagnetic();
|
||||
}
|
||||
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
tooltip.add(this.metal.formatSymbol());
|
||||
if(this.metal.radioactivity > 0.0f) {
|
||||
tooltip.add(this.metal.formatRadioactivity());
|
||||
}
|
||||
tooltip.add(this.metal.formatRarity());
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemMetalBlock(this);
|
||||
}
|
||||
public void getModifiers(Map<Attribute, Float> map, UsageSlot slot)
|
||||
{
|
||||
if((slot == null || slot == UsageSlot.INVENTORY) && this.metal.radioactivity > 0.0f)
|
||||
map.put(Attribute.RADIATION, this.metal.radioactivity * 4.0f * 9.0f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import common.entity.Entity;
|
|||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemPane;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -499,12 +498,8 @@ public class BlockPane extends Block
|
|||
public Transform getTransform() {
|
||||
return Transform.PANE;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemPane(this);
|
||||
}
|
||||
|
||||
public String getItemTexture(String name) {
|
||||
return this.getPaneBase();
|
||||
}
|
||||
|
||||
public State getItemState() {
|
||||
return this.getState().withProperty(NORTH, false).withProperty(SOUTH, false).withProperty(WEST, true).withProperty(EAST, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,8 +268,8 @@ public class BlockPortal extends Block
|
|||
map.put("portal", 1);
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return null;
|
||||
protected boolean hasRegisteredItem() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// public BlockPattern.PatternHelper func_181089_f(World p_181089_1_, BlockPos p_181089_2_)
|
||||
|
|
|
@ -7,11 +7,12 @@ import common.block.Directional;
|
|||
import common.block.Material;
|
||||
import common.collect.Lists;
|
||||
import common.entity.Entity;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.BlockRegistry;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemSlab;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.Property;
|
||||
|
@ -154,7 +155,27 @@ public class BlockSlab extends Block implements Directional {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSlab(this);
|
||||
public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) {
|
||||
return !stack.isEmpty() && playerIn.canPlayerEdit(pos.offset(side), side, stack) &&
|
||||
(this.tryVerticalPlace(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ) || super.place(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ));
|
||||
}
|
||||
|
||||
private boolean tryVerticalPlace(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) {
|
||||
if(hitY >= 0.34f && hitY <= 0.66f) {
|
||||
State state = worldIn.getState(pos);
|
||||
Block block = state.getBlock();
|
||||
if(!block.isReplaceable(worldIn, pos))
|
||||
pos = pos.offset(side);
|
||||
if(worldIn.canBlockBePlaced(this, pos, false, side, null, stack)) {
|
||||
State place = this.getState().withProperty(BlockSlab.FACING, playerIn.getHorizontalFacing());
|
||||
if(worldIn.setState(pos, place, 3)) {
|
||||
worldIn.playSound(this.sound.getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F),
|
||||
(double)((float)pos.getZ() + 0.5F), 1.0F);
|
||||
stack.decrSize();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import common.block.Material;
|
|||
import common.color.DyeColor;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.model.BlockLayer;
|
||||
import common.properties.Property;
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import common.collect.Lists;
|
|||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemWall;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
|
@ -291,10 +290,10 @@ public class BlockWall extends Block
|
|||
.e().uv(5, 3, 11, 16)
|
||||
.rotate(!w ? ModelRotation.X0_Y0 : (!e ? ModelRotation.X0_Y180 : (!s ? ModelRotation.X0_Y270 : ModelRotation.X0_Y90)));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemWall(this);
|
||||
}
|
||||
|
||||
public State getItemState() {
|
||||
return this.getState().withProperty(UP, true).withProperty(NORTH, false).withProperty(SOUTH, false).withProperty(WEST, true).withProperty(EAST, true);
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
return new Property[] {NORTH, SOUTH, UP, WEST, EAST};
|
||||
|
|
|
@ -4,7 +4,7 @@ import common.init.Blocks;
|
|||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSeedFood;
|
||||
import common.item.consumable.ItemSeedFood;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.world.State;
|
||||
|
@ -15,13 +15,13 @@ public class BlockCarrot extends BlockCrops
|
|||
{
|
||||
return Items.carrot;
|
||||
}
|
||||
|
||||
protected Item getDropItem() {
|
||||
return Items.carrot;
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
int age = state.getValue(AGE);
|
||||
return crop(provider, name + "_" + (age == 6 ? 2 : (age / 2)));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSeedFood(3, this, Blocks.farmland).setDisplay("Karotte").setMaxAmount(StackSize.L);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSeeds;
|
||||
import common.item.material.ItemSeeds;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.Property;
|
||||
|
@ -138,9 +138,13 @@ public class BlockCrops extends BlockBush implements IGrowable
|
|||
|
||||
protected Item getCrop()
|
||||
{
|
||||
return Items.wheats;
|
||||
return Items.wheat;
|
||||
}
|
||||
|
||||
protected Item getDropItem() {
|
||||
return Items.wheat_seed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns this Block's drops into the World as EntityItems.
|
||||
*/
|
||||
|
@ -160,7 +164,7 @@ public class BlockCrops extends BlockBush implements IGrowable
|
|||
{
|
||||
if (worldIn.rand.zrange(15) <= i)
|
||||
{
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(this.getItem()));
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(this.getDropItem()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -218,7 +222,7 @@ public class BlockCrops extends BlockBush implements IGrowable
|
|||
.s().uv(0, 0, 16, 16).noCull();
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSeeds(this, Blocks.farmland).setDisplay("Weizenkörner").setMaxAmount(StackSize.XL);
|
||||
protected boolean hasRegisteredItem() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import common.init.Blocks;
|
|||
import common.init.Items;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemDoublePlant;
|
||||
import common.item.StackSize;
|
||||
import common.item.tool.ItemShears;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
@ -48,6 +48,8 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
|||
this.setStepSound(SoundType.GRASS);
|
||||
this.setFlammable(60, 100);
|
||||
this.setFlatBlockTexture();
|
||||
if(this.type == BlockDoublePlant.EnumPlantType.GRASS || this.type == BlockDoublePlant.EnumPlantType.FERN)
|
||||
this.setItemColored();
|
||||
PLANTS[type.ordinal()] = this;
|
||||
}
|
||||
|
||||
|
@ -151,10 +153,14 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
|||
}
|
||||
else
|
||||
{
|
||||
return this.type == BlockDoublePlant.EnumPlantType.FERN ? null : (this.type == BlockDoublePlant.EnumPlantType.GRASS ? (rand.chance(8) ? Items.wheat : null) : super.getItemDropped(state, rand, fortune));
|
||||
return this.type == BlockDoublePlant.EnumPlantType.FERN ? null : (this.type == BlockDoublePlant.EnumPlantType.GRASS ? (rand.chance(8) ? Items.wheat_seed : null) : super.getItemDropped(state, rand, fortune));
|
||||
}
|
||||
}
|
||||
|
||||
public int getRenderColor(State state) {
|
||||
return this.type != BlockDoublePlant.EnumPlantType.GRASS && this.type != BlockDoublePlant.EnumPlantType.FERN ? 16777215 : Colorizer.getGrassColor(0.5D, 1.0D);
|
||||
}
|
||||
|
||||
public int colorMultiplier(IWorldAccess worldIn, BlockPos pos, int renderPass)
|
||||
{
|
||||
return this.type != BlockDoublePlant.EnumPlantType.GRASS && this.type != BlockDoublePlant.EnumPlantType.FERN ? 16777215 : Colorizer.getGrassColor(worldIn, pos);
|
||||
|
@ -283,9 +289,13 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
|||
public Transform getTransform() {
|
||||
return Transform.CROSS;
|
||||
}
|
||||
|
||||
public State getItemState() {
|
||||
return this.getState().withProperty(HALF, EnumBlockHalf.UPPER);
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemDoublePlant(this);
|
||||
public StackSize getMaxStackSize() {
|
||||
return StackSize.S;
|
||||
}
|
||||
|
||||
public static enum EnumBlockHalf implements Identifyable
|
||||
|
|
|
@ -8,11 +8,12 @@ import common.block.liquid.BlockLiquid;
|
|||
import common.block.liquid.BlockStaticLiquid;
|
||||
import common.entity.Entity;
|
||||
import common.entity.item.EntityBoat;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemLilyPad;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
|
@ -21,6 +22,7 @@ import common.properties.Property;
|
|||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
import common.util.Facing;
|
||||
import common.util.HitPosition;
|
||||
import common.world.IWorldAccess;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
@ -106,8 +108,42 @@ public class BlockLilyPad extends BlockBush implements Rotatable
|
|||
public Transform getTransform() {
|
||||
return Transform.SMALL_FLAT;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemLilyPad(this);
|
||||
}
|
||||
|
||||
public boolean prePlace(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
HitPosition movingobjectposition = Item.getMovingObjectPositionFromPlayer(worldIn, playerIn, true);
|
||||
|
||||
if (movingobjectposition == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (movingobjectposition.type == HitPosition.ObjectType.BLOCK)
|
||||
{
|
||||
BlockPos blockpos = movingobjectposition.block;
|
||||
|
||||
if (!World.isValidXZ(blockpos))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!playerIn.canPlayerEdit(blockpos.offset(movingobjectposition.side), movingobjectposition.side, itemStackIn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockPos blockpos1 = blockpos.up();
|
||||
State iblockstate = worldIn.getState(blockpos);
|
||||
|
||||
if (iblockstate.getBlock().getMaterial().isColdLiquid() && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1))
|
||||
{
|
||||
worldIn.setState(blockpos1, Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, playerIn.getHorizontalFacing().getOpposite()));
|
||||
itemStackIn.decrSize();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,39 +10,25 @@ import common.model.ModelProvider;
|
|||
import common.rng.Random;
|
||||
import common.world.State;
|
||||
|
||||
public class BlockMelon extends Block
|
||||
{
|
||||
public BlockMelon()
|
||||
{
|
||||
super(Material.SOFT);
|
||||
this.setTab(CheatTab.PLANTS);
|
||||
}
|
||||
public class BlockMelon extends Block {
|
||||
public BlockMelon() {
|
||||
super(Material.SOFT);
|
||||
this.setTab(CheatTab.PLANTS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return Items.melon;
|
||||
}
|
||||
public Item getItemDropped(State state, Random rand, int fortune) {
|
||||
return Items.melon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
protected int quantityDropped(Random random)
|
||||
{
|
||||
return random.range(3, 7);
|
||||
}
|
||||
protected int quantityDropped(Random random) {
|
||||
return random.range(3, 7);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the quantity dropped based on the given fortune level
|
||||
*/
|
||||
protected int quantityDroppedWithBonus(int fortune, Random random)
|
||||
{
|
||||
return Math.min(9, this.quantityDropped(random) + random.zrange(1 + fortune));
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel("melon_side").add().nswe().du("melon_top");
|
||||
}
|
||||
protected int quantityDroppedWithBonus(int fortune, Random random) {
|
||||
return Math.min(9, this.quantityDropped(random) + random.zrange(1 + fortune));
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel("melon_side").add().nswe().du("melon_top");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import common.init.Items;
|
|||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSeedFood;
|
||||
import common.item.consumable.ItemSeedFood;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.util.BlockPos;
|
||||
|
@ -19,6 +19,10 @@ public class BlockPotato extends BlockCrops
|
|||
return Items.potato;
|
||||
}
|
||||
|
||||
protected Item getDropItem() {
|
||||
return Items.potato;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns this Block's drops into the World as EntityItems.
|
||||
*/
|
||||
|
@ -39,8 +43,4 @@ public class BlockPotato extends BlockCrops
|
|||
int age = state.getValue(AGE);
|
||||
return crop(provider, name + "_" + (age == 6 ? 2 : (age / 2)));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSeedFood(1, this, Blocks.farmland).setDisplay("Kartoffel").setMaxAmount(StackSize.L);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Rotatable;
|
||||
import common.block.Material;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.CheatTab;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.Property;
|
||||
import common.util.BlockPos;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class BlockPumpkin extends Block implements Rotatable {
|
||||
public class BlockPumpkin extends Block {
|
||||
public BlockPumpkin() {
|
||||
super(Material.SOFT);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setTab(CheatTab.PLANTS);
|
||||
}
|
||||
|
||||
|
@ -25,16 +19,7 @@ public class BlockPumpkin extends Block implements Rotatable {
|
|||
return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down());
|
||||
}
|
||||
|
||||
public State onBlockPlaced(World world, BlockPos pos, Facing face, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||
}
|
||||
|
||||
protected Property[] getProperties() {
|
||||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
return provider.getModel("pumpkin_side").add().du("pumpkin_top").n("pumpkin_face_" + (this.getLightValue() == 0 ? "off" : "on")).s().we()
|
||||
.rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
return provider.getModel("pumpkin_side").add().nswe().du("pumpkin_top");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,8 +164,8 @@ public class BlockReed extends Block
|
|||
return new Property[] {AGE};
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return super.getItemToRegister().setMaxAmount(StackSize.L);
|
||||
public StackSize getMaxStackSize() {
|
||||
return StackSize.L;
|
||||
}
|
||||
|
||||
public Transform getTransform() {
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
package common.block.foliage;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Directional;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSeeds;
|
||||
import common.item.material.ItemSeeds;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.rng.Random;
|
||||
|
@ -23,44 +21,22 @@ import common.world.State;
|
|||
import common.world.World;
|
||||
import common.world.AWorldServer;
|
||||
|
||||
public class BlockStem extends BlockBush implements Directional, IGrowable
|
||||
public class BlockStem extends BlockBush implements IGrowable
|
||||
{
|
||||
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 7);
|
||||
|
||||
private final Block crop;
|
||||
private final String itemName;
|
||||
|
||||
public BlockStem(Block crop, String itemName)
|
||||
public BlockStem(Block crop)
|
||||
{
|
||||
this.setDefaultState(this.getBaseState().withProperty(AGE, Integer.valueOf(0)).withProperty(FACING, Facing.UP));
|
||||
this.setDefaultState(this.getBaseState().withProperty(AGE, 0));
|
||||
this.crop = crop;
|
||||
this.itemName = itemName;
|
||||
this.setTickRandomly();
|
||||
float f = 0.125F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
|
||||
this.setTab((CheatTab)null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
||||
* metadata, such as fence connections.
|
||||
*/
|
||||
public State getActualState(State state, IWorldAccess worldIn, BlockPos pos)
|
||||
{
|
||||
state = state.withProperty(FACING, Facing.UP);
|
||||
|
||||
for (Facing enumfacing : Facing.Plane.HORIZONTAL)
|
||||
{
|
||||
if (worldIn.getState(pos.offset(enumfacing)).getBlock() == this.crop)
|
||||
{
|
||||
state = state.withProperty(FACING, enumfacing);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* is the block grass, dirt or farmland
|
||||
*/
|
||||
|
@ -88,20 +64,17 @@ public class BlockStem extends BlockBush implements Directional, IGrowable
|
|||
}
|
||||
else
|
||||
{
|
||||
for (Facing enumfacing : Facing.Plane.HORIZONTAL)
|
||||
BlockPos pos2 = pos.offset(Facing.Plane.HORIZONTAL.random(rand));
|
||||
Block block = worldIn.getState(pos2.down()).getBlock();
|
||||
Block block2 = worldIn.getState(pos2).getBlock();
|
||||
|
||||
if ((block2 == Blocks.air || block2 instanceof BlockStem) && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass))
|
||||
{
|
||||
if (worldIn.getState(pos.offset(enumfacing)).getBlock() == this.crop)
|
||||
{
|
||||
return;
|
||||
}
|
||||
worldIn.setState(pos, Blocks.air.getState());
|
||||
worldIn.setState(pos2, this.crop.getState());
|
||||
}
|
||||
|
||||
pos = pos.offset(Facing.Plane.HORIZONTAL.random(rand));
|
||||
Block block = worldIn.getState(pos.down()).getBlock();
|
||||
|
||||
if (worldIn.getState(pos).getBlock() == Blocks.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass))
|
||||
{
|
||||
worldIn.setState(pos, this.crop.getState());
|
||||
else {
|
||||
worldIn.setState(pos, this.crop.getState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -166,20 +139,12 @@ public class BlockStem extends BlockBush implements Directional, IGrowable
|
|||
{
|
||||
if (worldIn.rand.zrange(15) <= i)
|
||||
{
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(this.getItem()));
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(this == Blocks.melon_stem ? Items.melon_seed : Items.pumpkin_seed));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this IGrowable can grow
|
||||
*/
|
||||
|
@ -200,101 +165,81 @@ public class BlockStem extends BlockBush implements Directional, IGrowable
|
|||
|
||||
protected Property[] getProperties()
|
||||
{
|
||||
return new Property[] {AGE, FACING};
|
||||
return new Property[] {AGE};
|
||||
}
|
||||
|
||||
public Model getModel(ModelProvider provider, String name, State state) {
|
||||
String stem = name;
|
||||
String upperstem = name + "_connected";
|
||||
if(state.getValue(FACING).getAxis().isVertical()) {
|
||||
switch(state.getValue(AGE)) {
|
||||
case 0:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 1, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 2).tint().noCull()
|
||||
.s().uv(16, 0, 0, 2).tint().noCull()
|
||||
.add(8, -1, 0, 8, 1, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 2).tint().noCull()
|
||||
.e().uv(16, 0, 0, 2).tint().noCull();
|
||||
case 1:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 3, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 4).tint().noCull()
|
||||
.s().uv(16, 0, 0, 4).tint().noCull()
|
||||
.add(8, -1, 0, 8, 3, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 4).tint().noCull()
|
||||
.e().uv(16, 0, 0, 4).tint().noCull();
|
||||
case 2:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 5, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 6).tint().noCull()
|
||||
.s().uv(16, 0, 0, 6).tint().noCull()
|
||||
.add(8, -1, 0, 8, 5, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 6).tint().noCull()
|
||||
.e().uv(16, 0, 0, 6).tint().noCull();
|
||||
case 3:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 7, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 8).tint().noCull()
|
||||
.s().uv(16, 0, 0, 8).tint().noCull()
|
||||
.add(8, -1, 0, 8, 7, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 8).tint().noCull()
|
||||
.e().uv(16, 0, 0, 8).tint().noCull();
|
||||
case 4:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 9, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 10).tint().noCull()
|
||||
.s().uv(16, 0, 0, 10).tint().noCull()
|
||||
.add(8, -1, 0, 8, 9, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 10).tint().noCull()
|
||||
.e().uv(16, 0, 0, 10).tint().noCull();
|
||||
case 5:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 11, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 12).tint().noCull()
|
||||
.s().uv(16, 0, 0, 12).tint().noCull()
|
||||
.add(8, -1, 0, 8, 11, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 12).tint().noCull()
|
||||
.e().uv(16, 0, 0, 12).tint().noCull();
|
||||
case 6:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 13, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 14).tint().noCull()
|
||||
.s().uv(16, 0, 0, 14).tint().noCull()
|
||||
.add(8, -1, 0, 8, 13, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 14).tint().noCull()
|
||||
.e().uv(16, 0, 0, 14).tint().noCull();
|
||||
case 7:
|
||||
default:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 15, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 16).tint().noCull()
|
||||
.s().uv(16, 0, 0, 16).tint().noCull()
|
||||
.add(8, -1, 0, 8, 15, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 16).tint().noCull()
|
||||
.e().uv(16, 0, 0, 16).tint().noCull();
|
||||
}
|
||||
}
|
||||
else {
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 7, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 8).tint().noCull()
|
||||
.s().uv(16, 0, 0, 8).tint().noCull()
|
||||
.add(8, -1, 0, 8, 7, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 8).tint().noCull()
|
||||
.e().uv(16, 0, 0, 8).tint().noCull()
|
||||
.add(0, 0, 8, 9, 16, 8)
|
||||
.n(upperstem).uv(9, 0, 0, 16).tint().noCull()
|
||||
.s(upperstem).uv(0, 0, 9, 16).tint().noCull()
|
||||
.rotate(ModelRotation.getEastRot(state.getValue(FACING).getOpposite(), false));
|
||||
}
|
||||
switch(state.getValue(AGE)) {
|
||||
case 0:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 1, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 2).tint().noCull()
|
||||
.s().uv(16, 0, 0, 2).tint().noCull()
|
||||
.add(8, -1, 0, 8, 1, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 2).tint().noCull()
|
||||
.e().uv(16, 0, 0, 2).tint().noCull();
|
||||
case 1:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 3, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 4).tint().noCull()
|
||||
.s().uv(16, 0, 0, 4).tint().noCull()
|
||||
.add(8, -1, 0, 8, 3, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 4).tint().noCull()
|
||||
.e().uv(16, 0, 0, 4).tint().noCull();
|
||||
case 2:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 5, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 6).tint().noCull()
|
||||
.s().uv(16, 0, 0, 6).tint().noCull()
|
||||
.add(8, -1, 0, 8, 5, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 6).tint().noCull()
|
||||
.e().uv(16, 0, 0, 6).tint().noCull();
|
||||
case 3:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 7, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 8).tint().noCull()
|
||||
.s().uv(16, 0, 0, 8).tint().noCull()
|
||||
.add(8, -1, 0, 8, 7, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 8).tint().noCull()
|
||||
.e().uv(16, 0, 0, 8).tint().noCull();
|
||||
case 4:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 9, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 10).tint().noCull()
|
||||
.s().uv(16, 0, 0, 10).tint().noCull()
|
||||
.add(8, -1, 0, 8, 9, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 10).tint().noCull()
|
||||
.e().uv(16, 0, 0, 10).tint().noCull();
|
||||
case 5:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 11, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 12).tint().noCull()
|
||||
.s().uv(16, 0, 0, 12).tint().noCull()
|
||||
.add(8, -1, 0, 8, 11, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 12).tint().noCull()
|
||||
.e().uv(16, 0, 0, 12).tint().noCull();
|
||||
case 6:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 13, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 14).tint().noCull()
|
||||
.s().uv(16, 0, 0, 14).tint().noCull()
|
||||
.add(8, -1, 0, 8, 13, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 14).tint().noCull()
|
||||
.e().uv(16, 0, 0, 14).tint().noCull();
|
||||
case 7:
|
||||
default:
|
||||
return provider.getModel(stem)
|
||||
.add(0, -1, 8, 16, 15, 8).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.n().uv(0, 0, 16, 16).tint().noCull()
|
||||
.s().uv(16, 0, 0, 16).tint().noCull()
|
||||
.add(8, -1, 0, 8, 15, 16).rotate(8, 8, 8, Facing.Axis.Y, 45, true)
|
||||
.w().uv(0, 0, 16, 16).tint().noCull()
|
||||
.e().uv(16, 0, 0, 16).tint().noCull();
|
||||
}
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSeeds(this, Blocks.farmland).setDisplay(this.itemName).setMaxAmount(StackSize.XL);
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
return new Property[] {FACING};
|
||||
protected boolean hasRegisteredItem() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable
|
|||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return rand.chance(8) ? Items.wheat : null;
|
||||
return rand.chance(8) ? Items.wheat_seed : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,7 @@ import common.item.CheatTab;
|
|||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.StackSize;
|
||||
import common.item.block.ItemSeeds;
|
||||
import common.item.material.ItemSeeds;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.Property;
|
||||
|
@ -83,19 +83,11 @@ public class BlockWart extends BlockBush
|
|||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(this.getItem()));
|
||||
spawnAsEntity(worldIn, pos, new ItemStack(Items.soul_wart));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Item that this Block should drop when harvested.
|
||||
*/
|
||||
public Item getItemDropped(State state, Random rand, int fortune)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
|
@ -114,7 +106,7 @@ public class BlockWart extends BlockBush
|
|||
return BlockCrops.crop(provider, name + "_" + (age >= 2 ? age - 1 : age));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSeeds(this, Blocks.soul_sand).setDisplay("Seelenwarze").setMaxAmount(StackSize.L);
|
||||
protected boolean hasRegisteredItem() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -363,7 +363,7 @@ public abstract class BlockLiquid extends Block
|
|||
return true;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return null;
|
||||
protected boolean hasRegisteredItem() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1137,8 +1137,8 @@ public class BlockFire extends Block
|
|||
return true;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return null;
|
||||
protected boolean hasRegisteredItem() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
package common.block.natural;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import common.attributes.Attribute;
|
||||
import common.attributes.UsageSlot;
|
||||
import common.block.SoundType;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.MetalType;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemMetalBlock;
|
||||
import common.item.ItemStack;
|
||||
|
||||
public class BlockMetalOre extends BlockOre {
|
||||
private final MetalType metal;
|
||||
|
@ -18,8 +24,23 @@ public class BlockMetalOre extends BlockOre {
|
|||
public MetalType getMetal() {
|
||||
return this.metal;
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return this.metal.isMagnetic();
|
||||
}
|
||||
|
||||
public void addInformation(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
|
||||
{
|
||||
tooltip.add(this.metal.formatSymbol());
|
||||
if(this.metal.radioactivity > 0.0f) {
|
||||
tooltip.add(this.metal.formatRadioactivity());
|
||||
}
|
||||
tooltip.add(this.metal.formatRarity());
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemMetalBlock(this);
|
||||
}
|
||||
public void getModifiers(Map<Attribute, Float> map, UsageSlot slot)
|
||||
{
|
||||
if((slot == null || slot == UsageSlot.INVENTORY) && this.metal.radioactivity > 0.0f)
|
||||
map.put(Attribute.RADIATION, this.metal.radioactivity * 4.0f * 2.0f);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import common.init.Items;
|
|||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.block.ItemSnow;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
|
@ -171,8 +170,49 @@ public class BlockSnow extends Block
|
|||
return height == 16 ? provider.getModel("snow").add().all() :
|
||||
provider.getModel("snow").add(0, 0, 0, 16, height, 16).u().noCull().d().nswe().uv(0, 16 - height, 16, 16);
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSnow(this);
|
||||
}
|
||||
|
||||
public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!playerIn.canPlayerEdit(pos, side, stack))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
State iblockstate = worldIn.getState(pos);
|
||||
Block block = iblockstate.getBlock();
|
||||
BlockPos blockpos = pos;
|
||||
|
||||
if ((side != Facing.UP || block != this) && !block.isReplaceable(worldIn, pos))
|
||||
{
|
||||
blockpos = pos.offset(side);
|
||||
iblockstate = worldIn.getState(blockpos);
|
||||
block = iblockstate.getBlock();
|
||||
}
|
||||
|
||||
if (block == this)
|
||||
{
|
||||
int i = ((Integer)iblockstate.getValue(BlockSnow.LAYERS)).intValue();
|
||||
|
||||
if (i <= 7)
|
||||
{
|
||||
State iblockstate1 = iblockstate.withProperty(BlockSnow.LAYERS, Integer.valueOf(i + 1));
|
||||
BoundingBox axisalignedbb = this.getCollisionBoundingBox(worldIn, blockpos, iblockstate1);
|
||||
|
||||
if (axisalignedbb != null && worldIn.checkNoEntityCollision(axisalignedbb) && worldIn.setState(blockpos, iblockstate1, 2))
|
||||
{
|
||||
worldIn.playSound(this.sound.getPlaceSound(), (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F), 1.0F);
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.place(stack, playerIn, worldIn, blockpos, side, hitX, hitY, hitZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ public class BlockActiveDisplay extends BlockDisplay implements ITileEntityProvi
|
|||
return new TileEntityDisplay(this.density);
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return null;
|
||||
protected boolean hasRegisteredItem() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) {
|
||||
|
|
|
@ -7,9 +7,9 @@ import common.entity.Entity;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemPressurePlate;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.Transform;
|
||||
import common.rng.Random;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
@ -249,9 +249,9 @@ public abstract class BlockBasePressurePlate extends Block
|
|||
.w().uv(1, 15, 15, 16).noCull()
|
||||
.e().uv(1, 15, 15, 16).noCull();
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemPressurePlate(this);
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.SMALL_FLAT;
|
||||
}
|
||||
|
||||
public abstract String getTexture();
|
||||
|
|
|
@ -13,7 +13,6 @@ import common.entity.types.EntityLiving;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemButton;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
|
@ -348,8 +347,8 @@ public class BlockButton extends Block implements Directional
|
|||
.ns().uv(5, pressed ? 15 : 14, 11, 16).noCull().we().uv(6, pressed ? 15 : 14, 10, 16).noCull()
|
||||
.rotate(getRotation(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemButton(this);
|
||||
|
||||
public Transform getTransform() {
|
||||
return Transform.PANE_SIDE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -503,7 +503,7 @@ public class BlockCauldron extends Block
|
|||
|
||||
return true;
|
||||
}
|
||||
else if (item == Items.glass_bottle)
|
||||
else if (item == Items.bottle)
|
||||
{
|
||||
if (i > 0)
|
||||
{
|
||||
|
|
|
@ -210,7 +210,7 @@ public class BlockFurnace extends Block implements ITileEntityProvider, Rotatabl
|
|||
.s().we().rotate(ModelRotation.getNorthRot(state.getValue(FACING)));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return this.isBurning ? null : super.getItemToRegister();
|
||||
protected boolean hasRegisteredItem() {
|
||||
return !this.isBurning;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import common.entity.types.EntityLiving;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
|
|
|
@ -107,8 +107,8 @@ public class BlockLitTorch extends BlockTorch {
|
|||
return new Property[] {FUEL};
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return null;
|
||||
protected boolean hasRegisteredItem() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Item getItem() {
|
||||
|
|
|
@ -8,7 +8,6 @@ import common.init.Blocks;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.util.BlockPos;
|
||||
|
@ -56,7 +55,7 @@ public class BlockNuke extends Block
|
|||
return provider.getModel("nuke_side").add().nswe().d("nuke_bottom").u("nuke_top");
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return super.getItemToRegister().setColor(TextColor.RED);
|
||||
public TextColor getItemColor() {
|
||||
return TextColor.RED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import common.init.Blocks;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemPiston;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.model.ModelRotation;
|
||||
|
@ -679,8 +678,12 @@ public class BlockPistonBase extends Block implements Directional
|
|||
.rotate(ModelRotation.getNorthRot(state.getValue(FACING).getAxis() == Facing.Axis.Y
|
||||
? state.getValue(FACING).getOpposite() : state.getValue(FACING)));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemPiston(this);
|
||||
}
|
||||
|
||||
public State getItemState() {
|
||||
return this.getState().withProperty(FACING, Facing.UP);
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -229,7 +229,7 @@ public class BlockPistonHead extends Block implements Directional
|
|||
? state.getValue(FACING).getOpposite() : state.getValue(FACING)));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return null;
|
||||
protected boolean hasRegisteredItem() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package common.block.tech;
|
|||
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.color.DyeColor;
|
||||
import common.color.TextColor;
|
||||
import common.entity.Entity;
|
||||
import common.entity.item.EntityTnt;
|
||||
import common.entity.npc.EntityNPC;
|
||||
|
@ -11,14 +13,16 @@ import common.init.Items;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemTNT;
|
||||
import common.item.ItemStack;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyBool;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.util.Vec3;
|
||||
import common.world.Explosion;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
@ -157,7 +161,16 @@ public class BlockTNT extends Block
|
|||
this.onBlockDestroyedByPlayer(world, pos, state.withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true)));
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemTNT(this);
|
||||
public TextColor getItemColor() {
|
||||
return TextColor.RED;
|
||||
}
|
||||
|
||||
public boolean dispense(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) {
|
||||
blockpos = blockpos.offset(facing);
|
||||
EntityTnt entitytntprimed = new EntityTnt(world, (double)blockpos.getX() + 0.5D, (double)blockpos.getY(), (double)blockpos.getZ() + 0.5D, (EntityLiving)null, this.power);
|
||||
world.spawnEntityInWorld(entitytntprimed);
|
||||
world.playSoundAtEntity(entitytntprimed, SoundEvent.FUSE, 1.0F);
|
||||
stack.decrSize();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class BlockToggleableLight extends Block {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return this.isOn ? null : super.getItemToRegister();
|
||||
protected boolean hasRegisteredItem() {
|
||||
return !this.isOn;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -649,8 +649,8 @@ public class BlockTripWire extends Block
|
|||
return new Property[] {DISARMED, POWERED};
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return super.getItemToRegister().setMaxAmount(StackSize.XXXL);
|
||||
public StackSize getMaxStackSize() {
|
||||
return StackSize.XXXL;
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
|
|
|
@ -8,7 +8,6 @@ import common.init.Blocks;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemBlock;
|
||||
import common.model.BlockLayer;
|
||||
import common.model.Model;
|
||||
import common.model.ModelProvider;
|
||||
|
|
|
@ -535,8 +535,8 @@ public class BlockWire extends Block
|
|||
return wire_none;
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return super.getItemToRegister().setMaxAmount(StackSize.XL);
|
||||
public StackSize getMaxStackSize() {
|
||||
return StackSize.XL;
|
||||
}
|
||||
|
||||
public Property[] getUnsavedProperties() {
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
package common.block.tile;
|
||||
|
||||
import common.block.Block;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.Blocks;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.block.ItemSign;
|
||||
import common.item.ItemStack;
|
||||
import common.properties.Property;
|
||||
import common.properties.PropertyInteger;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntitySign;
|
||||
import common.util.BlockPos;
|
||||
import common.util.ExtMath;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
|
@ -16,6 +23,7 @@ public class BlockStandingSign extends BlockSign
|
|||
public BlockStandingSign()
|
||||
{
|
||||
this.setDefaultState(this.getBaseState().withProperty(ROTATION, Integer.valueOf(0)));
|
||||
this.setTab(CheatTab.DECORATION);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,8 +44,60 @@ public class BlockStandingSign extends BlockSign
|
|||
{
|
||||
return new Property[] {ROTATION};
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return new ItemSign(this).setDisplay("Schild");
|
||||
}
|
||||
|
||||
public boolean place(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.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.sign.getState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldIn.setState(pos, Blocks.wall_sign.getState().withProperty(BlockWallSign.FACING, side), 3);
|
||||
}
|
||||
|
||||
stack.decrSize();
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
|
||||
if (tileentity instanceof TileEntitySign)
|
||||
{
|
||||
playerIn.connection.show((TileEntitySign)tileentity);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack)
|
||||
{
|
||||
return side != Facing.DOWN && worldIn.getState(pos).getBlock().getMaterial().isSolid();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class BlockWallSign extends BlockSign implements Rotatable
|
|||
return new Property[] {FACING};
|
||||
}
|
||||
|
||||
protected Item getItemToRegister() {
|
||||
return null;
|
||||
protected boolean hasRegisteredItem() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import common.entity.DamageSource;
|
|||
import common.entity.Entity;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.item.ItemStack;
|
||||
import common.item.tool.ItemArmor;
|
||||
import common.item.material.ItemArmor;
|
||||
import common.item.tool.ItemAxe;
|
||||
import common.item.tool.ItemShears;
|
||||
import common.rng.Random;
|
||||
|
|
|
@ -2,11 +2,11 @@ package common.enchantment;
|
|||
|
||||
import common.attributes.UsageSlot;
|
||||
import common.item.Item;
|
||||
import common.item.tool.ItemArmor;
|
||||
import common.item.tool.ItemBow;
|
||||
import common.item.material.ItemArmor;
|
||||
import common.item.tool.ItemFishingRod;
|
||||
import common.item.tool.ItemSword;
|
||||
import common.item.tool.ItemTool;
|
||||
import common.item.weapon.ItemBow;
|
||||
import common.item.weapon.ItemSword;
|
||||
|
||||
public enum EnchantmentType
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ import common.init.Items;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.tool.ItemFishFood;
|
||||
import common.item.consumable.ItemFishFood;
|
||||
import common.pathfinding.PathNavigateGround;
|
||||
import common.tags.TagObject;
|
||||
import common.vars.Vars;
|
||||
|
|
|
@ -45,7 +45,7 @@ public class EntityChicken extends EntityAnimal {
|
|||
this.tasks.addTask(0, new EntityAISwimming(this));
|
||||
this.tasks.addTask(1, new EntityAIPanic(this, 1.4D));
|
||||
this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
|
||||
this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.wheat, false));
|
||||
this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.wheat_seed, false));
|
||||
this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D));
|
||||
this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
|
||||
this.tasks.addTask(6, new EntityAIWatchClosest(this, null, 6.0F));
|
||||
|
@ -135,7 +135,7 @@ public class EntityChicken extends EntityAnimal {
|
|||
}
|
||||
|
||||
public boolean isBreedingItem(ItemStack stack) {
|
||||
return stack != null && stack.getItem() == Items.wheat;
|
||||
return stack != null && stack.getItem() == Items.wheat_seed;
|
||||
}
|
||||
|
||||
public void readEntity(TagObject tag) {
|
||||
|
|
|
@ -28,7 +28,7 @@ public class EntityCow extends EntityAnimal
|
|||
this.tasks.addTask(0, new EntityAISwimming(this));
|
||||
this.tasks.addTask(1, new EntityAIPanic(this, 2.0D));
|
||||
this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
|
||||
this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Items.wheats, false));
|
||||
this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Items.wheat, false));
|
||||
this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D));
|
||||
this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
|
||||
this.tasks.addTask(6, new EntityAIWatchClosest(this, null, 6.0F));
|
||||
|
|
|
@ -27,8 +27,8 @@ import common.inventory.IInvBasic;
|
|||
import common.inventory.InventoryBasic;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.material.ItemHorseArmor;
|
||||
import common.item.spawner.ItemMobTemplate;
|
||||
import common.item.tool.ItemHorseArmor;
|
||||
import common.pathfinding.PathNavigateGround;
|
||||
import common.tags.TagObject;
|
||||
import java.util.List;
|
||||
|
@ -815,7 +815,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
int j = 0;
|
||||
int k = 0;
|
||||
|
||||
if (itemstack.getItem() == Items.wheats)
|
||||
if (itemstack.getItem() == Items.wheat)
|
||||
{
|
||||
hp = 2;
|
||||
j = 20;
|
||||
|
@ -827,7 +827,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
j = 30;
|
||||
k = 3;
|
||||
}
|
||||
else if (itemstack.getItem().getBlock() == Blocks.hay_block)
|
||||
else if (itemstack.getItem() == Items.hay_block)
|
||||
{
|
||||
hp = 20;
|
||||
j = 180;
|
||||
|
|
|
@ -477,7 +477,7 @@ public class EntityRabbit extends EntityAnimal {
|
|||
Block block = state.getBlock();
|
||||
if(Vars.rabidRabbits)
|
||||
return block != Blocks.bedrock;
|
||||
return block == Blocks.carrot || block == Blocks.potato || block == Blocks.wheat || block == Blocks.brown_mushroom ||
|
||||
return block == Blocks.carrots || block == Blocks.potatoes || block == Blocks.wheats || block == Blocks.brown_mushroom ||
|
||||
block instanceof BlockFlower || block == Blocks.blue_mushroom ||
|
||||
block == Blocks.tallgrass;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class EntitySheep extends EntityAnimal
|
|||
this.tasks.addTask(0, new EntityAISwimming(this));
|
||||
this.tasks.addTask(1, new EntityAIPanic(this, 1.25D));
|
||||
this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
|
||||
this.tasks.addTask(3, new EntityAITempt(this, 1.1D, Items.wheats, false));
|
||||
this.tasks.addTask(3, new EntityAITempt(this, 1.1D, Items.wheat, false));
|
||||
this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D));
|
||||
this.tasks.addTask(5, this.entityAIEatGrass);
|
||||
this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
|
||||
|
|
|
@ -27,8 +27,8 @@ import common.init.Items;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.consumable.ItemFood;
|
||||
import common.item.material.ItemDye;
|
||||
import common.item.tool.ItemFood;
|
||||
import common.pathfinding.PathNavigateGround;
|
||||
import common.tags.TagObject;
|
||||
import common.util.ExtMath;
|
||||
|
|
|
@ -6,7 +6,7 @@ import common.entity.effect.EntityLightning;
|
|||
import common.entity.types.EntityLiving;
|
||||
import common.init.Items;
|
||||
import common.item.ItemStack;
|
||||
import common.item.tool.ItemPotion;
|
||||
import common.item.consumable.ItemPotion;
|
||||
import common.rng.Random;
|
||||
import common.util.ExtMath;
|
||||
import common.world.World;
|
||||
|
|
|
@ -62,15 +62,15 @@ import common.inventory.InventoryWarpChest;
|
|||
import common.item.Item;
|
||||
import common.item.ItemAction;
|
||||
import common.item.ItemStack;
|
||||
import common.item.tool.ItemArmor;
|
||||
import common.item.tool.ItemBow;
|
||||
import common.item.tool.ItemGunBase;
|
||||
import common.item.consumable.ItemPotion;
|
||||
import common.item.material.ItemArmor;
|
||||
import common.item.tool.ItemHoe;
|
||||
import common.item.tool.ItemKey;
|
||||
import common.item.tool.ItemPotion;
|
||||
import common.item.tool.ItemShears;
|
||||
import common.item.tool.ItemSword;
|
||||
import common.item.tool.ItemTool;
|
||||
import common.item.weapon.ItemBow;
|
||||
import common.item.weapon.ItemGunBase;
|
||||
import common.item.weapon.ItemSword;
|
||||
import common.network.IClientPlayer;
|
||||
import common.network.IPlayer;
|
||||
import common.packet.CPacketPlayerPosition;
|
||||
|
|
|
@ -7,7 +7,7 @@ import common.entity.types.EntityThrowable;
|
|||
import common.entity.types.IObjectData;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.ItemStack;
|
||||
import common.item.tool.ItemDie;
|
||||
import common.item.projectile.ItemDie;
|
||||
import common.tags.TagObject;
|
||||
import common.util.HitPosition;
|
||||
import common.world.World;
|
||||
|
|
|
@ -10,7 +10,7 @@ import common.entity.types.IObjectData;
|
|||
import common.init.ItemRegistry;
|
||||
import common.init.Items;
|
||||
import common.item.ItemStack;
|
||||
import common.item.tool.ItemPotion;
|
||||
import common.item.consumable.ItemPotion;
|
||||
import common.tags.TagObject;
|
||||
import common.util.BlockPos;
|
||||
import common.util.BoundingBox;
|
||||
|
|
|
@ -153,7 +153,7 @@ public abstract class EntityAnimal extends EntityLiving
|
|||
*/
|
||||
public boolean isBreedingItem(ItemStack stack)
|
||||
{
|
||||
return stack == null ? false : stack.getItem() == Items.wheats;
|
||||
return stack == null ? false : stack.getItem() == Items.wheat;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,8 +42,8 @@ import common.init.Items;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.item.material.ItemArmor;
|
||||
import common.item.spawner.ItemMobTemplate;
|
||||
import common.item.tool.ItemArmor;
|
||||
import common.network.IPlayer;
|
||||
import common.packet.SPacketEntityAttach;
|
||||
import common.packet.SPacketAnimation;
|
||||
|
|
|
@ -377,10 +377,10 @@ public abstract class BlockRegistry {
|
|||
|
||||
Block pumpkin = (new BlockPumpkin()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Kürbis");
|
||||
register("pumpkin", pumpkin);
|
||||
register("pumpkin_stem", (new BlockStem(pumpkin, "Kürbiskerne")).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Kürbisstamm"));
|
||||
register("pumpkin_stem", (new BlockStem(pumpkin)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Kürbisstamm"));
|
||||
Block melon = (new BlockMelon()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Melone");
|
||||
register("melon_block", melon);
|
||||
register("melon_stem", (new BlockStem(melon, "Melonenkerne")).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Melonenstamm"));
|
||||
register("melon_stem", (new BlockStem(melon)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Melonenstamm"));
|
||||
|
||||
|
||||
register("dry_leaves", (new BlockDryLeaves()).setDisplay("Vertrocknetes Laub"));
|
||||
|
@ -441,7 +441,6 @@ public abstract class BlockRegistry {
|
|||
register("sponge", (new Block(Material.LOOSE)).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Schwamm")
|
||||
.setTab(CheatTab.DECORATION));
|
||||
register("skull", (new BlockSkull()).setHardness(1.0F).setStepSound(SoundType.STONE).setDisplay("Schädel").setTab(CheatTab.DECORATION));
|
||||
register("lit_pumpkin", (new BlockPumpkin()).setHardness(1.0F).setStepSound(SoundType.WOOD).setLightLevel(1.0F).setDisplay("Kürbislaterne"));
|
||||
register("hay_block", (new BlockHay()).setHardness(0.5F).setStepSound(SoundType.GRASS).setDisplay("Strohballen")
|
||||
.setTab(CheatTab.DECORATION));
|
||||
register("sign", (new BlockStandingSign()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Schild"));
|
||||
|
@ -461,10 +460,10 @@ public abstract class BlockRegistry {
|
|||
|
||||
register("farmland", (new BlockFarmland()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Ackerboden")
|
||||
.setShovelHarvestable().setTab(CheatTab.PLANTS));
|
||||
register("wheat", (new BlockCrops()).setDisplay("Getreide"));
|
||||
register("carrot", (new BlockCarrot()).setDisplay("Karotten"));
|
||||
register("potato", (new BlockPotato()).setDisplay("Kartoffeln"));
|
||||
register("soul_wart", (new BlockWart()).setDisplay("Seelenwarze"));
|
||||
register("wheats", (new BlockCrops()).setDisplay("Getreide"));
|
||||
register("carrots", (new BlockCarrot()).setDisplay("Karotten"));
|
||||
register("potatoes", (new BlockPotato()).setDisplay("Kartoffeln"));
|
||||
register("soul_warts", (new BlockWart()).setDisplay("Seelenwarze"));
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ public abstract class Blocks {
|
|||
public static final BlockCake cake = get("cake");
|
||||
public static final Block calcium_block = get("calcium_block");
|
||||
public static final BlockOre calcium_ore = get("calcium_ore");
|
||||
public static final BlockCarrot carrot = get("carrot");
|
||||
public static final BlockCarrot carrots = get("carrots");
|
||||
public static final BlockSandStone carved_sandstone = get("carved_sandstone");
|
||||
public static final Block carved_stonebrick = get("carved_stonebrick");
|
||||
public static final BlockCauldron cauldron = get("cauldron");
|
||||
|
@ -304,7 +304,6 @@ public abstract class Blocks {
|
|||
public static final BlockStainedGlassPane lime_glass_pane = get("lime_glass_pane");
|
||||
public static final BlockWool lime_wool = get("lime_wool");
|
||||
public static final BlockFurnace lit_furnace = get("lit_furnace");
|
||||
public static final BlockPumpkin lit_pumpkin = get("lit_pumpkin");
|
||||
public static final Block lithium_block = get("lithium_block");
|
||||
public static final BlockOre lithium_ore = get("lithium_ore");
|
||||
public static final BlockCarpet magenta_carpet = get("magenta_carpet");
|
||||
|
@ -396,7 +395,7 @@ public abstract class Blocks {
|
|||
public static final BlockPortalFrame portal_frame = get("portal_frame");
|
||||
public static final Block potassium_block = get("potassium_block");
|
||||
public static final BlockOre potassium_ore = get("potassium_ore");
|
||||
public static final BlockPotato potato = get("potato");
|
||||
public static final BlockPotato potatoes = get("potatoes");
|
||||
public static final Block praseodymium_block = get("praseodymium_block");
|
||||
public static final BlockOre praseodymium_ore = get("praseodymium_ore");
|
||||
public static final BlockPumpkin pumpkin = get("pumpkin");
|
||||
|
@ -462,7 +461,7 @@ public abstract class Blocks {
|
|||
public static final BlockOre sodium_ore = get("sodium_ore");
|
||||
public static final BlockSoulFire soul_fire = get("soul_fire");
|
||||
public static final BlockSoulSand soul_sand = get("soul_sand");
|
||||
public static final BlockWart soul_wart = get("soul_wart");
|
||||
public static final BlockWart soul_warts = get("soul_warts");
|
||||
public static final Block sponge = get("sponge");
|
||||
public static final BlockStaticLiquid springwater = get("springwater");
|
||||
public static final BlockDoor spruce_door = get("spruce_door");
|
||||
|
@ -537,7 +536,7 @@ public abstract class Blocks {
|
|||
public static final BlockStaticLiquid water = get("water");
|
||||
public static final BlockLilyPad waterlily = get("waterlily");
|
||||
public static final BlockWeb web = get("web");
|
||||
public static final BlockCrops wheat = get("wheat");
|
||||
public static final BlockCrops wheats = get("wheats");
|
||||
public static final BlockBed white_bed = get("white_bed");
|
||||
public static final BlockCarpet white_carpet = get("white_carpet");
|
||||
public static final BlockColoredClay white_clay = get("white_clay");
|
||||
|
|