mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
rewrite of interact system, bugfixes, ai tweaks
This commit is contained in:
parent
f5222be9d2
commit
ac1a1b2449
62 changed files with 649 additions and 491 deletions
11
src/material/item/base/ItemAxe.php
Normal file
11
src/material/item/base/ItemAxe.php
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
abstract class ItemAxe extends ItemTool
|
||||
{
|
||||
public function isAxe(){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
18
src/material/item/base/ItemHoe.php
Normal file
18
src/material/item/base/ItemHoe.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
abstract class ItemHoe extends ItemTool
|
||||
{
|
||||
public function isHoe(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public function useOn($object, $force = false){
|
||||
if(($object instanceof Block) and ($object->getID() === GRASS or $object->getID() === DIRT)){
|
||||
$this->meta++;
|
||||
return true;
|
||||
}else{
|
||||
return parent::useOn($object, $force);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
13
src/material/item/base/ItemPickaxe.php
Normal file
13
src/material/item/base/ItemPickaxe.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
abstract class ItemPickaxe extends ItemTool
|
||||
{
|
||||
public function isTool(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isPickaxe(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
9
src/material/item/base/ItemShovel.php
Normal file
9
src/material/item/base/ItemShovel.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
class ItemShovel extends ItemTool
|
||||
{
|
||||
public function isShovel(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
10
src/material/item/base/ItemSword.php
Normal file
10
src/material/item/base/ItemSword.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
abstract class ItemSword extends ItemTool
|
||||
{
|
||||
|
||||
public function isSword(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
17
src/material/item/base/ItemTool.php
Normal file
17
src/material/item/base/ItemTool.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
abstract class ItemTool extends Item
|
||||
{
|
||||
public function isTool(){
|
||||
return true;
|
||||
}
|
||||
public function useOn($object, $force = false){
|
||||
if(($object instanceof Entity) and !$this->isSword()){
|
||||
$this->meta += 2;
|
||||
}else{
|
||||
$this->meta++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
class DiamondAxeItem extends Item{
|
||||
class DiamondAxeItem extends ItemAxe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(DIAMOND_AXE, $meta, $count, "Diamond Axe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
class DiamondHoeItem extends Item{
|
||||
class DiamondHoeItem extends ItemHoe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(DIAMOND_HOE, $meta, $count, "Diamond Hoe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
class DiamondPickaxeItem extends Item{
|
||||
class DiamondPickaxeItem extends ItemPickaxe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(DIAMOND_PICKAXE, $meta, $count, "Diamond Pickaxe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
<?php
|
||||
|
||||
class DiamondShovelItem extends Item{
|
||||
class DiamondShovelItem extends ItemShovel{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(DIAMOND_SHOVEL, $meta, $count, "Diamond Shovel");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
<?php
|
||||
|
||||
class DiamondSwordItem extends Item{
|
||||
class DiamondSwordItem extends ItemSword{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(DIAMOND_SWORD, $meta, $count, "Diamond Sword");
|
||||
}
|
||||
public function isTool(){
|
||||
return true;
|
||||
}
|
||||
public function getDamageAgainstOf($e)
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
class FlintSteelItem extends Item{
|
||||
class FlintSteelItem extends ItemTool{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(FLINT_STEEL, $meta, $count, "Flint and Steel");
|
||||
$this->isActivable = true;
|
||||
|
|
@ -20,7 +20,12 @@ class FlintSteelItem extends Item{
|
|||
return false;
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function useOn($object, $force = false){
|
||||
if(($object instanceof Creeper) and $this->id === FLINT_STEEL){
|
||||
$this->meta++;
|
||||
return true;
|
||||
}else{
|
||||
return parent::useOn($object, $force);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
<?php
|
||||
|
||||
class GoldenAxeItem extends Item{
|
||||
class GoldenAxeItem extends ItemAxe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(GOLDEN_AXE, $meta, $count, "Golden Axe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
class GoldenHoeItem extends Item{
|
||||
class GoldenHoeItem extends ItemHoe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(GOLDEN_HOE, $meta, $count, "Golden Hoe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
class GoldenPickaxeItem extends Item{
|
||||
class GoldenPickaxeItem extends ItemPickaxe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(GOLDEN_PICKAXE, $meta, $count, "Golden Pickaxe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
class GoldenShovelItem extends Item{
|
||||
class GoldenShovelItem extends ItemShovel{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(GOLDEN_SHOVEL, $meta, $count, "Golden Shovel");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
<?php
|
||||
|
||||
class GoldenSwordItem extends Item{
|
||||
class GoldenSwordItem extends ItemSword{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(GOLDEN_SWORD, $meta, $count, "Golden Sword");
|
||||
}
|
||||
public function isTool(){
|
||||
return true;
|
||||
}
|
||||
public function getDamageAgainstOf($e)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
class IronAxeItem extends Item{
|
||||
class IronAxeItem extends ItemAxe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(IRON_AXE, $meta, $count, "Iron Axe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
class IronHoeItem extends Item{
|
||||
class IronHoeItem extends ItemHoe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(IRON_HOE, $meta, $count, "Iron Hoe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
class IronPickaxeItem extends Item{
|
||||
class IronPickaxeItem extends ItemPickaxe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(IRON_PICKAXE, $meta, $count, "Iron Pickaxe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
class IronShovelItem extends Item{
|
||||
class IronShovelItem extends ItemShovel{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(IRON_SHOVEL, $meta, $count, "Iron Shovel");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
class IronSwordItem extends Item{
|
||||
class IronSwordItem extends ItemSword{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(IRON_SWORD, $meta, $count, "Iron Sword");
|
||||
}
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,15 @@
|
|||
<?php
|
||||
|
||||
class ShearsItem extends Item{
|
||||
class ShearsItem extends ItemTool{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(SHEARS, $meta, $count, "Shears");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function useOn($object, $force = false){
|
||||
if(($object instanceof Sheep) and $this->id === SHEARS){
|
||||
$this->meta++;
|
||||
return true;
|
||||
}
|
||||
parent::useOn($object, $force);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
class StoneAxeItem extends Item{
|
||||
class StoneAxeItem extends ItemAxe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(STONE_AXE, $meta, $count, "Stone Axe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
class StoneHoeItem extends Item{
|
||||
class StoneHoeItem extends ItemHoe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(STONE_HOE, $meta, $count, "Stone Hoe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
class StonePickaxeItem extends Item{
|
||||
class StonePickaxeItem extends ItemPickaxe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(STONE_PICKAXE, $meta, $count, "Stone Pickaxe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,12 @@
|
|||
<?php
|
||||
|
||||
class StoneShovelItem extends Item{
|
||||
class StoneShovelItem extends ItemShovel{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(STONE_SHOVEL, $meta, $count, "Stone Shovel");
|
||||
}
|
||||
|
||||
|
||||
public function getDamageAgainstOf($e){
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
class StoneSwordItem extends Item{
|
||||
class StoneSwordItem extends ItemSword{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(STONE_SWORD, $meta, $count, "Stone Sword");
|
||||
}
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
class WoodenAxeItem extends Item{
|
||||
class WoodenAxeItem extends ItemAxe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(WOODEN_AXE, $meta, $count, "Wooden Axe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
class WoodenHoeItem extends Item{
|
||||
class WoodenHoeItem extends ItemHoe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(WOODEN_HOE, $meta, $count, "Wooden Hoe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
|
||||
class WoodenPickaxeItem extends Item{
|
||||
class WoodenPickaxeItem extends ItemPickaxe{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(WOODEN_PICKAXE, $meta, $count, "Wooden Pickaxe");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
class WoodenShovelItem extends Item{
|
||||
class WoodenShovelItem extends ItemShovel{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(WOODEN_SHOVEL, $meta, $count, "Wooden Shovel");
|
||||
}
|
||||
|
||||
public function isTool(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
class WoodenSwordItem extends Item{
|
||||
class WoodenSwordItem extends ItemSword{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(WOODEN_SWORD, $meta, $count, "Wooden Sword");
|
||||
}
|
||||
public function isTool(){
|
||||
return true;
|
||||
public function getDamageAgainstOf($e){
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue