mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
project uses tabs instead of spaces(as in CONTRIBUTING.md)
This commit is contained in:
parent
f00318b6ed
commit
62571f26cd
115 changed files with 2291 additions and 2364 deletions
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
abstract class ItemAxe extends ItemTool
|
||||
{
|
||||
public function isAxe(){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function isAxe(){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
abstract class ItemPickaxe extends ItemTool
|
||||
{
|
||||
public function isTool(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isPickaxe(){
|
||||
return true;
|
||||
}
|
||||
public function isTool(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isPickaxe(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
class ItemShovel extends ItemTool
|
||||
{
|
||||
public function isShovel(){
|
||||
return true;
|
||||
}
|
||||
public function isShovel(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
abstract class ItemSword extends ItemTool
|
||||
{
|
||||
|
||||
public function isSword(){
|
||||
return true;
|
||||
}
|
||||
public function isSword(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@
|
|||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class PaintingItem extends Item{
|
|||
array("Flaming Skull", 4, 4),
|
||||
);
|
||||
private static $direction = array(2, 0, 1, 3);
|
||||
private static $right = array(4, 5, 3, 2);
|
||||
private static $right = array(4, 5, 3, 2);
|
||||
|
||||
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($target->isTransparent === false and $face > 1 and $block->isSolid === false){
|
||||
|
|
@ -56,17 +56,17 @@ class PaintingItem extends Item{
|
|||
for($y = 0; $y <= $motive[2]; $y++){
|
||||
if ($target->getSide(PaintingItem::$right[$face - 2], $x)->isTransparent || $target->getSide(1, $y)->isTransparent
|
||||
|| $block->getSide(PaintingItem::$right[$face - 2], $x)->isSolid || $block->getSide(1, $y)->isSolid) {
|
||||
$valid = false;
|
||||
$valid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$valid){
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($valid) {
|
||||
$validMotives[] = $motive;
|
||||
}
|
||||
$validMotives[] = $motive;
|
||||
}
|
||||
}
|
||||
$motive = $validMotives[array_rand($validMotives)];
|
||||
$data = array(
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class SignItem extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(SIGN, 0, $count, "Sign");
|
||||
parent::__construct(SIGN, 0, $count, "Sign");
|
||||
$this->block = BlockAPI::get(SIGN_POST);
|
||||
$this->maxStackSize = 16;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,18 +8,18 @@ class SpawnEggItem extends Item{
|
|||
}
|
||||
|
||||
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$ageable = $this->meta === MOB_CHICKEN || $this->meta === MOB_COW || $this->meta === MOB_SHEEP || $this->meta === MOB_PIG;
|
||||
$data = array(
|
||||
"x" => $block->x + 0.5,
|
||||
"y" => $block->y,
|
||||
"z" => $block->z + 0.5,
|
||||
"IsBaby" => $ageable ? Utils::chance(5) ? 1 : 0 : 0
|
||||
);
|
||||
$e = ServerAPI::request()->api->entity->add($block->level, ENTITY_MOB, $this->meta, $data);
|
||||
ServerAPI::request()->api->entity->spawnToAll($e);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
-- $this->count;
|
||||
}
|
||||
return true;
|
||||
$ageable = $this->meta === MOB_CHICKEN || $this->meta === MOB_COW || $this->meta === MOB_SHEEP || $this->meta === MOB_PIG;
|
||||
$data = array(
|
||||
"x" => $block->x + 0.5,
|
||||
"y" => $block->y,
|
||||
"z" => $block->z + 0.5,
|
||||
"IsBaby" => $ageable ? Utils::chance(5) ? 1 : 0 : 0
|
||||
);
|
||||
$e = ServerAPI::request()->api->entity->add($block->level, ENTITY_MOB, $this->meta, $data);
|
||||
ServerAPI::request()->api->entity->spawnToAll($e);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
-- $this->count;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,6 @@ class DiamondAxeItem extends ItemAxe{
|
|||
}
|
||||
|
||||
public function getDamageAgainstOf($e){
|
||||
return 6;
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,6 @@ class DiamondPickaxeItem extends ItemPickaxe{
|
|||
}
|
||||
|
||||
public function getDamageAgainstOf($e){
|
||||
return 5;
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,6 @@ class DiamondShovelItem extends ItemShovel{
|
|||
parent::__construct(DIAMOND_SHOVEL, $meta, $count, "Diamond Shovel");
|
||||
}
|
||||
public function getDamageAgainstOf($e){
|
||||
return 4;
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
|
@ -4,9 +4,9 @@ class DiamondSwordItem extends ItemSword{
|
|||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(DIAMOND_SWORD, $meta, $count, "Diamond Sword");
|
||||
}
|
||||
public function getDamageAgainstOf($e)
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
public function getDamageAgainstOf($e)
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -21,11 +21,11 @@ class FlintSteelItem extends ItemTool{
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
if(($object instanceof Creeper) and $this->id === FLINT_STEEL){
|
||||
$this->meta++;
|
||||
return true;
|
||||
}else{
|
||||
return parent::useOn($object, $force);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,6 @@ class GoldenAxeItem extends ItemAxe{
|
|||
parent::__construct(GOLDEN_AXE, $meta, $count, "Golden Axe");
|
||||
}
|
||||
public function getDamageAgainstOf($e){
|
||||
return 3;
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,6 @@ class GoldenPickaxeItem extends ItemPickaxe{
|
|||
}
|
||||
|
||||
public function getDamageAgainstOf($e){
|
||||
return 2;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -4,9 +4,9 @@ class GoldenSwordItem extends ItemSword{
|
|||
public function __construct($meta = 0, $count = 1){
|
||||
parent::__construct(GOLDEN_SWORD, $meta, $count, "Golden Sword");
|
||||
}
|
||||
public function getDamageAgainstOf($e)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
public function getDamageAgainstOf($e)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -6,6 +6,6 @@ class IronAxeItem extends ItemAxe{
|
|||
}
|
||||
|
||||
public function getDamageAgainstOf($e){
|
||||
return 5;
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,6 @@ class IronSwordItem extends ItemSword{
|
|||
parent::__construct(IRON_SWORD, $meta, $count, "Iron Sword");
|
||||
}
|
||||
public function getDamageAgainstOf($e){
|
||||
return 6;
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,10 +6,10 @@ class ShearsItem extends ItemTool{
|
|||
}
|
||||
|
||||
public function useOn($object, $force = false){
|
||||
if(($object instanceof Sheep) and $this->id === SHEARS){
|
||||
$this->meta++;
|
||||
return true;
|
||||
}
|
||||
parent::useOn($object, $force);
|
||||
if(($object instanceof Sheep) and $this->id === SHEARS){
|
||||
$this->meta++;
|
||||
return true;
|
||||
}
|
||||
parent::useOn($object, $force);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,9 +4,9 @@ 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;
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -6,6 +6,6 @@ class WoodenPickaxeItem extends ItemPickaxe{
|
|||
}
|
||||
|
||||
public function getDamageAgainstOf($e){
|
||||
return 2;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue