change block destruction logic
This commit is contained in:
parent
2504f24b7b
commit
2d476cbf8a
39 changed files with 175 additions and 746 deletions
|
@ -113,6 +113,6 @@ public abstract class EntityAIDoorInteract extends EntityAIBase
|
|||
private BlockDoor getBlockDoor(LocalPos pos)
|
||||
{
|
||||
Block block = this.theEntity.worldObj.getState(pos).getBlock();
|
||||
return block instanceof BlockDoor && block.getMaterial() == Material.WOOD ? (BlockDoor)block : null;
|
||||
return block instanceof BlockDoor && block.getMaterial() == Material.BURNABLE ? (BlockDoor)block : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -560,13 +560,6 @@ public class Block {
|
|||
return this.maxZ;
|
||||
}
|
||||
|
||||
public final float getHardness(EntityNPC player, World world, LocalPos pos) {
|
||||
float f = (float)this.hardness;
|
||||
return f < 0.0F ? 0.0F
|
||||
: (!player.canHarvestBlock(this) ? player.getToolDigEfficiency(this) / f / 100.0F
|
||||
: player.getToolDigEfficiency(this) / f / 30.0F);
|
||||
}
|
||||
|
||||
public final State getState() {
|
||||
return this.defaultState;
|
||||
}
|
||||
|
@ -1013,7 +1006,7 @@ public class Block {
|
|||
}
|
||||
|
||||
public int getFuelAmount() {
|
||||
return this.material == Material.WOOD ? 300 : 0;
|
||||
return this.material == Material.BURNABLE ? 300 : 0;
|
||||
}
|
||||
|
||||
public void getModifiers(Map<Attribute, Float> map) {
|
||||
|
@ -1084,7 +1077,9 @@ public class Block {
|
|||
if(this.light != 0)
|
||||
tooltip.add(Color.BLUE + "Licht" + Color.DARK_GRAY + ": " + Color.NEON + String.format("%06x", this.light));
|
||||
if(this.hardness != 0)
|
||||
tooltip.add(Color.BLUE + "Härte" + Color.DARK_GRAY + ": " + Color.NEON + this.hardness);
|
||||
tooltip.add(Color.LIGHT_GRAY + "Härte" + Color.GRAY + ": " + Color.BEIGE + this.hardness);
|
||||
if(this.miningTool != null && this.miningTool.isLevelled())
|
||||
tooltip.add(Color.VIOLET + "Level" + Color.DARK_VIOLET + ": " + Color.DARK_MAGENTA + (this.miningLevel + 1));
|
||||
}
|
||||
|
||||
@Clientside
|
||||
|
|
|
@ -9,31 +9,25 @@ public enum Material {
|
|||
LOOSE {{
|
||||
;
|
||||
}},
|
||||
WOOD {{
|
||||
this.setBurning().setTool(Equipment.AXE);
|
||||
BURNABLE {{ // is fuel
|
||||
this.setBurning();
|
||||
}},
|
||||
SOLID {{
|
||||
this.setRequiredTool(Equipment.PICKAXE);
|
||||
this.setTool(Equipment.PICKAXE);
|
||||
}},
|
||||
TRANSLUCENT {{
|
||||
this.setTranslucent();
|
||||
}},
|
||||
BURNABLE {{
|
||||
this.setBurning();
|
||||
}},
|
||||
SOFT {{ // can break faster with sword, can't connect to fences+walls
|
||||
SOFT {{ // can't connect to fences+walls
|
||||
this.setNoPushMobility();
|
||||
}},
|
||||
PISTON {{
|
||||
IMMOVABLE {{
|
||||
this.setImmovableMobility();
|
||||
}},
|
||||
HEAVY {{
|
||||
this.setRequiredTool(Equipment.PICKAXE).setImmovableMobility();
|
||||
}},
|
||||
PLANT {{ // can break faster with sword
|
||||
PLANT {{
|
||||
this.setNonSolid().setNoPushMobility();
|
||||
}},
|
||||
SMALL {{ // can be placed more easily
|
||||
SMALL {{ // can be replaced by anvil
|
||||
this.setNonSolid().setNoPushMobility();
|
||||
}},
|
||||
FLEECE {{
|
||||
|
@ -60,20 +54,20 @@ public enum Material {
|
|||
HOT {{
|
||||
this.setLiquid(true).setReplaceable().setNoPushMobility();
|
||||
}},
|
||||
LEAVES {{ // can break faster with sword, precipitation block, special treatment in some worldgen
|
||||
LEAVES {{ // precipitation block, special treatment in some worldgen
|
||||
this.setBurning().setTranslucent().setNoPushMobility();
|
||||
}},
|
||||
BUSH {{ // can break faster with sword, can be replaced by small tree leaves
|
||||
BUSH {{ // can be replaced by small tree leaves
|
||||
this.setNonSolid().setBurning().setNoPushMobility().setReplaceable();
|
||||
}},
|
||||
FIRE {{
|
||||
this.setNonSolid().setReplaceable().setNoPushMobility();
|
||||
}},
|
||||
POWDER {{ // can harvest with shovel, precipitation block
|
||||
POWDER {{ // precipitation block
|
||||
this.setNonSolid().setReplaceable().setNoPushMobility();
|
||||
}},
|
||||
FLUFF {{ // can harvest with shears
|
||||
this.setPassable().setRequiredTool(Equipment.SWORD).setNoPushMobility();
|
||||
FLUFF {{
|
||||
this.setPassable().setTool(Equipment.SWORD).setNoPushMobility();
|
||||
}};
|
||||
|
||||
private boolean solid = true;
|
||||
|
@ -85,7 +79,6 @@ public enum Material {
|
|||
private boolean hot;
|
||||
private boolean burnable;
|
||||
private boolean replaceable;
|
||||
private boolean requiresTool;
|
||||
// 0 - normal; 1 - can't push other blocks; 2 - can't be pushed
|
||||
private int mobility;
|
||||
private Equipment tool;
|
||||
|
@ -121,12 +114,6 @@ public enum Material {
|
|||
return this;
|
||||
}
|
||||
|
||||
protected Material setRequiredTool(Equipment tool) {
|
||||
this.requiresTool = true;
|
||||
this.tool = tool;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Material setTool(Equipment tool) {
|
||||
this.tool = tool;
|
||||
return this;
|
||||
|
@ -188,10 +175,6 @@ public enum Material {
|
|||
return this.opaque;
|
||||
}
|
||||
|
||||
public boolean isToolRequired() {
|
||||
return this.requiresTool;
|
||||
}
|
||||
|
||||
public int getMobility() {
|
||||
return this.mobility;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class BlockBookshelf extends Block
|
|||
{
|
||||
public BlockBookshelf()
|
||||
{
|
||||
super(Material.WOOD);
|
||||
super(Material.BURNABLE);
|
||||
this.setTab(CheatTab.DECORATION);
|
||||
this.setFlammable(30, 20);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,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);
|
||||
this.setTab(material == Material.BURNABLE ? CheatTab.WOOD : CheatTab.TECHNOLOGY);
|
||||
DOORS.add(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class BlockFence extends Block
|
|||
{
|
||||
super(p_i46395_1_);
|
||||
this.setDefaultState(this.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)));
|
||||
this.setTab(p_i46395_1_ == Material.WOOD ? CheatTab.WOOD : CheatTab.BLOCKS);
|
||||
this.setTab(p_i46395_1_ == Material.BURNABLE ? CheatTab.WOOD : CheatTab.BLOCKS);
|
||||
this.texture = texture;
|
||||
FENCES.add(this);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class BlockFenceGate extends Block implements Rotatable
|
|||
|
||||
public BlockFenceGate(WoodType type)
|
||||
{
|
||||
super(Material.WOOD);
|
||||
super(Material.BURNABLE);
|
||||
this.setDefaultState(this.getBaseState().withProperty(OPEN, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false)));
|
||||
this.setTab(CheatTab.WOOD);
|
||||
this.texture = type.getName() + "_planks";
|
||||
|
|
|
@ -202,6 +202,6 @@ public class BlockSlab extends Block implements Directional {
|
|||
}
|
||||
|
||||
public int getFuelAmount() {
|
||||
return this.material == Material.WOOD ? 150 : 0;
|
||||
return this.material == Material.BURNABLE ? 150 : 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class BlockTrapDoor extends Block implements Rotatable
|
|||
float f = 0.5F;
|
||||
float f1 = 1.0F;
|
||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.setTab(materialIn == Material.WOOD ? CheatTab.WOOD : CheatTab.TECHNOLOGY);
|
||||
this.setTab(materialIn == Material.BURNABLE ? CheatTab.WOOD : CheatTab.TECHNOLOGY);
|
||||
}
|
||||
|
||||
public void setKeyItem(ItemKey key) {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class BlockHugeMushroom extends Block {
|
|||
private final Block smallBlock;
|
||||
|
||||
public BlockHugeMushroom(Block smallBlock) {
|
||||
super(Material.WOOD);
|
||||
super(Material.BURNABLE);
|
||||
this.setDefaultState(this.getBaseState().withProperty(VARIANT, BlockHugeMushroom.EnumType.ALL_OUTSIDE));
|
||||
this.smallBlock = smallBlock;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import common.model.Model.ModelProvider;
|
|||
import common.model.ModelRotation;
|
||||
import common.properties.Property;
|
||||
import common.util.LocalPos;
|
||||
import common.util.Equipment;
|
||||
import common.util.Facing;
|
||||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
@ -18,11 +19,12 @@ public class BlockLog extends BlockRotatedPillar
|
|||
{
|
||||
public BlockLog()
|
||||
{
|
||||
super(Material.WOOD);
|
||||
super(Material.BURNABLE);
|
||||
this.setDefaultState(this.getBaseState().withProperty(AXIS, Facing.Axis.Y));
|
||||
this.setTab(CheatTab.WOOD);
|
||||
this.setHardness(2.0F);
|
||||
this.setFlammable(5, 5);
|
||||
this.setMiningTool(Equipment.AXE);
|
||||
}
|
||||
|
||||
public void onRemoved(AWorldServer worldIn, LocalPos pos, State state)
|
||||
|
|
|
@ -33,7 +33,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable
|
|||
|
||||
public BlockAnvil(int damage)
|
||||
{
|
||||
super(Material.HEAVY);
|
||||
super(Material.IMMOVABLE);
|
||||
this.damage = damage;
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setOpacity(0);
|
||||
|
|
|
@ -50,7 +50,7 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable
|
|||
|
||||
public BlockChest(int capacity)
|
||||
{
|
||||
super(capacity <= 30 ? Material.WOOD : Material.SOLID);
|
||||
super(capacity <= 30 ? Material.BURNABLE : Material.SOLID);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(OPEN, false));
|
||||
this.capacity = capacity;
|
||||
this.setTab(CheatTab.TECHNOLOGY);
|
||||
|
|
|
@ -250,7 +250,7 @@ public class BlockPistonBase extends Block implements Directional
|
|||
|
||||
public BlockPistonBase(boolean isSticky)
|
||||
{
|
||||
super(Material.PISTON);
|
||||
super(Material.IMMOVABLE);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(EXTENDED, Boolean.valueOf(false)));
|
||||
this.isSticky = isSticky;
|
||||
this.setHardness(0.5F);
|
||||
|
|
|
@ -28,7 +28,7 @@ public class BlockPistonHead extends Block implements Directional
|
|||
|
||||
public BlockPistonHead(boolean sticky)
|
||||
{
|
||||
super(Material.PISTON);
|
||||
super(Material.IMMOVABLE);
|
||||
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH));
|
||||
this.setHardness(0.5F);
|
||||
this.sticky = sticky;
|
||||
|
|
|
@ -23,7 +23,7 @@ public class BlockSign extends Block implements ITileEntityProvider, Rotatable
|
|||
{
|
||||
public BlockSign()
|
||||
{
|
||||
super(Material.WOOD);
|
||||
super(Material.BURNABLE);
|
||||
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);
|
||||
|
|
|
@ -19,7 +19,7 @@ public class BlockWorkbench extends Block
|
|||
|
||||
public BlockWorkbench(int tier)
|
||||
{
|
||||
super(Material.WOOD);
|
||||
super(Material.BURNABLE);
|
||||
this.setTab(CheatTab.TECHNOLOGY);
|
||||
this.tier = tier;
|
||||
}
|
||||
|
|
|
@ -21,12 +21,7 @@ public enum Effect {
|
|||
return String.format(Color.RED + "-%d%% Geschwindigkeit", 15 * (amp + 1));
|
||||
}
|
||||
},
|
||||
HASTE("haste", "Eile", "Trank der Eile", false, 14270531) {
|
||||
public double getEffectiveness() {
|
||||
return 1.5;
|
||||
}
|
||||
},
|
||||
FATIGUE("mining_fatigue", "Abbaulähmung", "Trank der Trägheit", true, 4866583),
|
||||
PUNCHING("punching", "Schlagkraft", "Trank der Schlagkraft", false, 0xffff00),
|
||||
STRENGTH("strength", 2, 180, "Stärke", "Trank der Stärke", false, 9643043) {
|
||||
public String getTooltip(int amp) {
|
||||
return String.format(Color.BLUE + "+%d%% Angriffsschaden", 50 * (amp + 1));
|
||||
|
|
|
@ -299,22 +299,6 @@ public enum Enchantment implements Displayable, Identifyable
|
|||
return 3;
|
||||
}
|
||||
},
|
||||
EFFICIENCY("efficiency", 10, EnchantmentType.DIGGER, "Effizienz") {
|
||||
public int getMinEnchantability(int enchantmentLevel)
|
||||
{
|
||||
return 1 + 10 * (enchantmentLevel - 1);
|
||||
}
|
||||
|
||||
public int getMaxEnchantability(int enchantmentLevel)
|
||||
{
|
||||
return super.getMinEnchantability(enchantmentLevel) + 50;
|
||||
}
|
||||
|
||||
public int getMaxLevel()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
},
|
||||
SILK_TOUCH("silk_touch", 1, EnchantmentType.DIGGER, "Behutsamkeit") {
|
||||
public int getMinEnchantability(int enchantmentLevel)
|
||||
{
|
||||
|
|
|
@ -213,30 +213,6 @@ public class EnchantmentHelper
|
|||
return getEnchantmentLevel(Enchantment.FIRE_ASPECT, player instanceof EntityNPC npc ? npc.getHeldItem() : null);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Returns the 'Water Breathing' modifier of enchantments on player equipped armors.
|
||||
// */
|
||||
// public static int getRespiration(Entity player)
|
||||
// {
|
||||
// return getMaxEnchantmentLevel(Enchantment.respiration.effectId, player.getInventory());
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Returns the level of the Depth Strider enchantment.
|
||||
// */
|
||||
// public static int getDepthStriderModifier(Entity player)
|
||||
// {
|
||||
// return getMaxEnchantmentLevel(Enchantment.depthStrider.effectId, player.getInventory());
|
||||
// }
|
||||
|
||||
/**
|
||||
* Return the extra efficiency of tools based on enchantments on equipped player item.
|
||||
*/
|
||||
public static int getEfficiencyModifier(EntityLiving player)
|
||||
{
|
||||
return getEnchantmentLevel(Enchantment.EFFICIENCY, player instanceof EntityNPC npc ? npc.getHeldItem() : null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the silk touch status of enchantments on current equipped item of player.
|
||||
*/
|
||||
|
@ -277,14 +253,6 @@ public class EnchantmentHelper
|
|||
return getEnchantmentLevel(Enchantment.LOOTING, player instanceof EntityNPC npc ? npc.getHeldItem() : null);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Returns the aqua affinity status of enchantments on current equipped item of player.
|
||||
// */
|
||||
// public static boolean getAquaAffinityModifier(EntityLivingBase player)
|
||||
// {
|
||||
// return getMaxEnchantmentLevel(Enchantment.aquaAffinity.effectId, player.getInventory()) > 0;
|
||||
// }
|
||||
|
||||
public static ItemStack getEnchantedArmor(Enchantment ench, EntityLiving entity)
|
||||
{
|
||||
if(entity instanceof EntityNPC npc) {
|
||||
|
|
|
@ -1640,11 +1640,6 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
|
||||
if (itemstack == this.itemInUse)
|
||||
{
|
||||
if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0)
|
||||
{
|
||||
this.updateItemUse(itemstack, 5);
|
||||
}
|
||||
|
||||
if (--this.itemInUseCount == 0 && !this.worldObj.client)
|
||||
{
|
||||
this.onItemUseFinish();
|
||||
|
@ -2883,7 +2878,6 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
// super.onItemUseFinish();
|
||||
if (this.itemInUse != null)
|
||||
{
|
||||
this.updateItemUse(this.itemInUse, 16);
|
||||
int i = this.itemInUse.getSize();
|
||||
ItemStack itemstack = this.itemInUse.getItem().onItemUseFinish(this.itemInUse, this.worldObj, this);
|
||||
|
||||
|
@ -3034,22 +3028,6 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
return this.isUsingItem() && this.itemInUse.getItem().getItemUseAction() == ItemAction.BLOCK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays sounds and makes particles for item in use state
|
||||
*/
|
||||
protected void updateItemUse(ItemStack itemStackIn, int p_71010_2_)
|
||||
{
|
||||
if (itemStackIn.getItemUseAction() == ItemAction.DRINK)
|
||||
{
|
||||
this.playSound(SoundEvent.DRINK, 0.5F);
|
||||
}
|
||||
|
||||
if (itemStackIn.getItemUseAction() == ItemAction.EAT)
|
||||
{
|
||||
this.playSound(SoundEvent.EAT, 0.5F + 0.5F * (float)this.rand.zrange(2));
|
||||
}
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
|
@ -3228,64 +3206,9 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
return entityitem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Block hardness will be further counted in game/block/Block.getPlayerRelativeBlockHardness
|
||||
*/
|
||||
public float getToolDigEfficiency(Block block)
|
||||
{
|
||||
float f = this.getHeldItem() != null && this.getHeldItem().getItem() instanceof ItemTool tool && block.getMiningTool() == tool.getToolType() ? tool.getToolEfficiency() : 1.0f;
|
||||
|
||||
if (f > 1.0F)
|
||||
{
|
||||
int i = EnchantmentHelper.getEfficiencyModifier(this);
|
||||
ItemStack itemstack = this.getHeldItem();
|
||||
|
||||
if (i > 0 && itemstack != null)
|
||||
{
|
||||
f += (float)(i * i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hasEffect(Effect.HASTE))
|
||||
{
|
||||
int speed = this.getEffect(Effect.HASTE).getAmplifier();
|
||||
if(speed >= 255)
|
||||
return 1000000.0f;
|
||||
f *= 1.0F + (float)(speed + 1) * 0.2F;
|
||||
}
|
||||
|
||||
if (this.hasEffect(Effect.FATIGUE))
|
||||
{
|
||||
float f1 = 1.0F;
|
||||
|
||||
switch (this.getEffect(Effect.FATIGUE).getAmplifier())
|
||||
{
|
||||
case 0:
|
||||
f1 = 0.3F;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
f1 = 0.09F;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
f1 = 0.0027F;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
default:
|
||||
f1 = 8.1E-4F;
|
||||
}
|
||||
|
||||
f *= f1;
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
public boolean canHarvestBlock(Block block)
|
||||
{
|
||||
if(!block.getMaterial().isToolRequired())
|
||||
if(block.getMiningTool() == null || this.hasEffect(Effect.PUNCHING))
|
||||
return true;
|
||||
return this.getHeldItem() != null && this.getHeldItem().getItem() instanceof ItemTool tool && block.getMiningTool() == tool.getToolType() && (!tool.getToolType().isLevelled() || tool.getToolLevel() >= block.getMiningLevel());
|
||||
}
|
||||
|
@ -4481,7 +4404,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
public void setGodMode(boolean god) {
|
||||
this.fallDistance = 0.0F;
|
||||
if(!god) {
|
||||
this.removeEffect(Effect.HASTE);
|
||||
this.removeEffect(Effect.PUNCHING);
|
||||
this.removeEffect(Effect.RESISTANCE);
|
||||
this.removeEffect(Effect.FIRE_RESISTANCE);
|
||||
this.removeEffect(Effect.FLYING);
|
||||
|
@ -4492,7 +4415,7 @@ public abstract class EntityNPC extends EntityLiving implements IInventory
|
|||
this.setHealth(this.getMaxHealth());
|
||||
this.setManaPoints(this.getMaxMana());
|
||||
this.clearEffects(false);
|
||||
this.addEffect(new StatusEffect(Effect.HASTE, Integer.MAX_VALUE, 255));
|
||||
this.addEffect(new StatusEffect(Effect.PUNCHING, Integer.MAX_VALUE, 255));
|
||||
this.addEffect(new StatusEffect(Effect.RESISTANCE, Integer.MAX_VALUE, 255));
|
||||
this.addEffect(new StatusEffect(Effect.FIRE_RESISTANCE, Integer.MAX_VALUE, 0));
|
||||
this.addEffect(new StatusEffect(Effect.FLYING, Integer.MAX_VALUE, 1));
|
||||
|
|
|
@ -290,17 +290,17 @@ public abstract class BlockRegistry {
|
|||
register(wood.getName() + "_sapling", (new BlockSapling(wood)).setHardness(0.0F)
|
||||
.setDisplay(wood.getDisplay() + "setzling"));
|
||||
register(wood.getName() + "_trunk", (new BlockSlab(log, wood.getName() + "_log_top", wood.getName() + "_log_top")).setDisplay(wood.getDisplay() + "holzscheibe"));
|
||||
Block planks = (new Block(Material.WOOD)).setHardness(2.0F)
|
||||
Block planks = (new Block(Material.BURNABLE)).setHardness(2.0F)
|
||||
.setDisplay(wood.getDisplay() + "holzbretter").setTab(CheatTab.WOOD).setFlammable(5, 20);
|
||||
register(wood.getName() + "_planks", planks);
|
||||
register(wood.getName() + "_stairs", (new BlockStairs(planks))
|
||||
.setDisplay(wood.getDisplay() + "holztreppe").setFlammable(5, 20));
|
||||
register(wood.getName() + "_slab", (new BlockSlab(planks)).setDisplay(wood.getDisplay() + "holzstufe").setFlammable(5, 20));
|
||||
register(wood.getName() + "_fence", (new BlockFence(Material.WOOD, wood.getName() + "_planks"))
|
||||
register(wood.getName() + "_fence", (new BlockFence(Material.BURNABLE, wood.getName() + "_planks"))
|
||||
.setHardness(2.0F).setDisplay(wood.getDisplay() + "holzzaun").setFlammable(5, 20));
|
||||
register(wood.getName() + "_fence_gate", (new BlockFenceGate(wood)).setHardness(2.0F)
|
||||
.setDisplay(wood.getDisplay() + "holzzauntor").setFlammable(5, 20));
|
||||
register(wood.getName() + "_door", (new BlockDoor(Material.WOOD)).setHardness(3.0F)
|
||||
register(wood.getName() + "_door", (new BlockDoor(Material.BURNABLE)).setHardness(3.0F)
|
||||
.setDisplay(wood.getDisplay() + "holztür").setFlammable(5, 20));
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,7 @@ public abstract class BlockRegistry {
|
|||
register(color.getName() + "_bed", (new BlockBed(color)).setHardness(0.2F).setDisplay(color.getSubject(0) + " Bett"));
|
||||
}
|
||||
|
||||
register("ladder", (new BlockLadder()).setHardness(0.4F).setDisplay("Leiter").setMiningTool(Equipment.AXE));
|
||||
register("ladder", (new BlockLadder()).setHardness(0.4F).setDisplay("Leiter"));
|
||||
register("bookshelf", (new BlockBookshelf()).setHardness(1.5F).setDisplay("Bücherregal"));
|
||||
register("cake", (new BlockCake()).setHardness(0.5F).setDisplay("Kuchen").setTab(CheatTab.DECORATION));
|
||||
register("dragon_egg", (new BlockDragonEgg()).setHardness(3.0F)
|
||||
|
@ -538,7 +538,7 @@ public abstract class BlockRegistry {
|
|||
}
|
||||
|
||||
register("iron_door", (new BlockDoor(Material.SOLID)).setHardness(5.0F).setDisplay("Eisentür"));
|
||||
register("trapdoor", (new BlockTrapDoor(Material.WOOD)).setHardness(3.0F).setDisplay("Holzfalltür").setFlammable(5, 20));
|
||||
register("trapdoor", (new BlockTrapDoor(Material.BURNABLE)).setHardness(3.0F).setDisplay("Holzfalltür").setFlammable(5, 20));
|
||||
register("iron_trapdoor", (new BlockTrapDoor(Material.SOLID)).setHardness(5.0F).setDisplay("Eisenfalltür"));
|
||||
|
||||
register("core", new BlockCore().setHardness(1.5F).setDisplay("Chunk-Lade-Kern"));
|
||||
|
@ -606,7 +606,7 @@ public abstract class BlockRegistry {
|
|||
|
||||
register("stone_pressure_plate", (new BlockPressurePlate(Material.SOLID, BlockPressurePlate.Sensitivity.MOBS)).setHardness(0.5F)
|
||||
.setDisplay("Steindruckplatte"));
|
||||
register("wooden_pressure_plate", (new BlockPressurePlate(Material.WOOD, BlockPressurePlate.Sensitivity.EVERYTHING))
|
||||
register("wooden_pressure_plate", (new BlockPressurePlate(Material.BURNABLE, BlockPressurePlate.Sensitivity.EVERYTHING))
|
||||
.setHardness(0.5F).setDisplay("Holzdruckplatte"));
|
||||
register("light_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.SOLID, 15)).setHardness(0.5F)
|
||||
.setDisplay("Wägeplatte (niedrige Gewichte)"));
|
||||
|
|
|
@ -825,9 +825,6 @@ public abstract class Items {
|
|||
public static final ItemEnchantedBook enchanted_book_draining_5 = get("enchanted_book_draining_5");
|
||||
public static final ItemEnchantedBook enchanted_book_draining_7 = get("enchanted_book_draining_7");
|
||||
public static final ItemEnchantedBook enchanted_book_draining_9 = get("enchanted_book_draining_9");
|
||||
public static final ItemEnchantedBook enchanted_book_efficiency = get("enchanted_book_efficiency");
|
||||
public static final ItemEnchantedBook enchanted_book_efficiency_3 = get("enchanted_book_efficiency_3");
|
||||
public static final ItemEnchantedBook enchanted_book_efficiency_5 = get("enchanted_book_efficiency_5");
|
||||
public static final ItemEnchantedBook enchanted_book_feather_falling = get("enchanted_book_feather_falling");
|
||||
public static final ItemEnchantedBook enchanted_book_feather_falling_4 = get("enchanted_book_feather_falling_4");
|
||||
public static final ItemEnchantedBook enchanted_book_fire_aspect = get("enchanted_book_fire_aspect");
|
||||
|
|
|
@ -9,7 +9,6 @@ import common.util.Equipment;
|
|||
public class ToolMaterial {
|
||||
private final int harvestLevel;
|
||||
private final int durability;
|
||||
private final int efficiency;
|
||||
private final int damage;
|
||||
private final float radiationResistance;
|
||||
private final float magicResistance;
|
||||
|
@ -22,10 +21,9 @@ public class ToolMaterial {
|
|||
private boolean magnetic;
|
||||
private int defColor = 0xffffffff;
|
||||
|
||||
protected ToolMaterial(int level, float rad, float mag, int uses, int efficiency, int damage, int ench, int auses, int aench, int r1, int r2, int r3, int r4) {
|
||||
protected ToolMaterial(int level, float rad, float mag, int uses, int d, int damage, int ench, int auses, int aench, int r1, int r2, int r3, int r4) {
|
||||
this.harvestLevel = level;
|
||||
this.durability = uses;
|
||||
this.efficiency = efficiency;
|
||||
this.damage = damage;
|
||||
this.enchantability = ench;
|
||||
this.maxDamageFactor = auses;
|
||||
|
@ -53,10 +51,6 @@ public class ToolMaterial {
|
|||
return this.durability;
|
||||
}
|
||||
|
||||
public int getEfficiency() {
|
||||
return this.efficiency;
|
||||
}
|
||||
|
||||
public int getDamage() {
|
||||
return this.damage;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package common.item;
|
||||
|
||||
public enum ItemAction {
|
||||
NONE, EAT, DRINK, BLOCK, AIM;
|
||||
NONE, BLOCK, AIM;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import common.entity.npc.EntityNPC;
|
|||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemAction;
|
||||
import common.item.ItemStack;
|
||||
import common.item.ItemCategory;
|
||||
import common.world.World;
|
||||
|
@ -33,21 +32,6 @@ public class ItemFood extends Item
|
|||
return ItemCategory.CONSUMABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using
|
||||
* the Item before the action is complete.
|
||||
*/
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
// if(!playerIn.creative)
|
||||
stack.decrSize();
|
||||
worldIn.playSoundAtEntity(playerIn, SoundEvent.EAT, 0.5F);
|
||||
playerIn.heal((int)((float)this.getHealAmount(stack) * 0.5f * (1.0f + worldIn.rand.floatv())));
|
||||
this.onFoodEaten(stack, worldIn, playerIn);
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
return stack;
|
||||
}
|
||||
|
||||
protected void onFoodEaten(ItemStack stack, World worldIn, EntityNPC player)
|
||||
{
|
||||
if (!worldIn.client && this.potionId != null && worldIn.rand.floatv() < this.potionEffectProbability)
|
||||
|
@ -56,29 +40,19 @@ public class ItemFood extends Item
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* How long it takes to use or consume an item
|
||||
*/
|
||||
public int getMaxItemUseDuration(ItemStack stack)
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public ItemAction getItemUseAction()
|
||||
{
|
||||
return ItemAction.EAT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
||||
public ItemStack onItemRightClick(ItemStack stack, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
|
||||
return itemStackIn;
|
||||
playerIn.playSound(SoundEvent.EAT, 0.5F + 0.5F * (float)playerIn.getRNG().zrange(2));
|
||||
// if(!playerIn.creative)
|
||||
stack.decrSize();
|
||||
// worldIn.playSoundAtEntity(playerIn, SoundEvent.EAT, 0.5F);
|
||||
playerIn.heal((int)((float)this.getHealAmount(stack) * 0.5f * (1.0f + worldIn.rand.floatv())));
|
||||
this.onFoodEaten(stack, worldIn, playerIn);
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public int getHealAmount(ItemStack stack)
|
||||
|
|
|
@ -4,9 +4,9 @@ import java.util.Map;
|
|||
|
||||
import common.entity.npc.Attribute;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.CheatTab;
|
||||
import common.item.Item;
|
||||
import common.item.ItemAction;
|
||||
import common.item.ItemStack;
|
||||
import common.item.ItemCategory;
|
||||
import common.util.Clientside;
|
||||
|
@ -23,23 +23,11 @@ public class ItemMilkBottle extends Item {
|
|||
return ItemCategory.CONSUMABLE;
|
||||
}
|
||||
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn) {
|
||||
stack.decrSize();
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) {
|
||||
playerIn.playSound(SoundEvent.DRINK, 0.5F);
|
||||
itemStackIn.decrSize();
|
||||
if(!worldIn.client)
|
||||
playerIn.clearEffects(false);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return 32;
|
||||
}
|
||||
|
||||
public ItemAction getItemUseAction() {
|
||||
return ItemAction.DRINK;
|
||||
}
|
||||
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) {
|
||||
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
|
||||
return itemStackIn;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,61 +94,6 @@ public class ItemPotion extends Item
|
|||
{
|
||||
return this.type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using
|
||||
* the Item before the action is complete.
|
||||
*/
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
stack.decrSize();
|
||||
// }
|
||||
|
||||
if (!worldIn.client)
|
||||
{
|
||||
if (this.effect != null)
|
||||
{
|
||||
if(this.effect.getPotion().isInstant())
|
||||
this.effect.getPotion().onImpact(null, null, playerIn, this.effect.getAmplifier(), 1.0);
|
||||
else
|
||||
playerIn.addEffect(new StatusEffect(this.effect.getPotion(), this.effect.getDuration(), this.effect.getAmplifier()));
|
||||
}
|
||||
}
|
||||
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return new ItemStack(Items.bottle);
|
||||
}
|
||||
|
||||
if (!playerIn.addItemStackToInventory(new ItemStack(Items.bottle))) {
|
||||
playerIn.dropItem(new ItemStack(Items.bottle), false);
|
||||
}
|
||||
// }
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* How long it takes to use or consume an item
|
||||
*/
|
||||
public int getMaxItemUseDuration(ItemStack stack)
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public ItemAction getItemUseAction()
|
||||
{
|
||||
return ItemAction.DRINK;
|
||||
}
|
||||
|
||||
public boolean onAction(ItemStack stack, EntityNPC player, World world, ItemControl control, LocalPos block) {
|
||||
if(control == ItemControl.TERTIARY || control == ItemControl.QUARTERNARY) {
|
||||
|
@ -164,10 +109,40 @@ public class ItemPotion extends Item
|
|||
/**
|
||||
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
||||
public ItemStack onItemRightClick(ItemStack stack, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
|
||||
return itemStackIn;
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
playerIn.playSound(SoundEvent.DRINK, 0.5F);
|
||||
stack.decrSize();
|
||||
// }
|
||||
|
||||
if (!worldIn.client)
|
||||
{
|
||||
if (this.effect != null)
|
||||
{
|
||||
if(this.effect.getPotion().isInstant())
|
||||
this.effect.getPotion().onImpact(null, null, playerIn, this.effect.getAmplifier(), 1.0);
|
||||
else
|
||||
playerIn.addEffect(new StatusEffect(this.effect.getPotion(), this.effect.getDuration(), this.effect.getAmplifier()));
|
||||
}
|
||||
}
|
||||
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
if (stack.isEmpty())
|
||||
{
|
||||
return new ItemStack(Items.bottle);
|
||||
}
|
||||
|
||||
if (!playerIn.addItemStackToInventory(new ItemStack(Items.bottle))) {
|
||||
playerIn.dropItem(new ItemStack(Items.bottle), false);
|
||||
}
|
||||
// }
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
|
|
|
@ -44,7 +44,6 @@ public class ItemTool extends Item {
|
|||
{
|
||||
if(this.type.isLevelled())
|
||||
tooltip.add(Color.VIOLET + "Level " + (this.material.getHarvestLevel() + 1));
|
||||
tooltip.add(Color.DARK_GREEN + "+" + (this.material.getEfficiency() - 1) + " Abbaueffizienz");
|
||||
int damage = this.getAttackDamageBonus(stack);
|
||||
if(damage > 0)
|
||||
tooltip.add(Color.BLUE + "+" + damage + " Angriffsschaden");
|
||||
|
@ -73,10 +72,6 @@ public class ItemTool extends Item {
|
|||
return this.material.getHarvestLevel();
|
||||
}
|
||||
|
||||
public int getToolEfficiency() {
|
||||
return this.material.getEfficiency();
|
||||
}
|
||||
|
||||
public int getItemEnchantability() {
|
||||
return this.material.getEnchantability();
|
||||
}
|
||||
|
|
|
@ -62,8 +62,6 @@ public class CPacketBreak implements Packet<IPlayer>
|
|||
public static enum Action
|
||||
{
|
||||
START_DESTROY_BLOCK,
|
||||
ABORT_DESTROY_BLOCK,
|
||||
STOP_DESTROY_BLOCK,
|
||||
DROP_ALL_ITEMS,
|
||||
DROP_ITEM,
|
||||
RELEASE_USE_ITEM;
|
||||
|
|
|
@ -212,7 +212,7 @@ public class WalkNodeProcessor extends NodeProcessor
|
|||
{
|
||||
if (!block.getMaterial().isColdLiquid())
|
||||
{
|
||||
if (!enterDoors && block instanceof BlockDoor && block.getMaterial() == Material.WOOD)
|
||||
if (!enterDoors && block instanceof BlockDoor && block.getMaterial() == Material.BURNABLE)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ public class WalkNodeProcessor extends NodeProcessor
|
|||
return -3;
|
||||
}
|
||||
}
|
||||
else if (!block.isPassable(world, mpos) && (!breakDoors || !(block instanceof BlockDoor) || block.getMaterial() != Material.WOOD))
|
||||
else if (!block.isPassable(world, mpos) && (!breakDoors || !(block instanceof BlockDoor) || block.getMaterial() != Material.BURNABLE))
|
||||
{
|
||||
if (block instanceof BlockFence || block instanceof BlockFenceGate || block instanceof BlockWall)
|
||||
{
|
||||
|
|
|
@ -182,7 +182,7 @@ public class Village
|
|||
private boolean isWoodDoor(AWorldServer world, LocalPos pos)
|
||||
{
|
||||
Block block = world.getState(pos).getBlock();
|
||||
return block instanceof BlockDoor ? block.getMaterial() == Material.WOOD : false;
|
||||
return block instanceof BlockDoor ? block.getMaterial() == Material.BURNABLE : false;
|
||||
}
|
||||
|
||||
private void updatePosition()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue