mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
[Ci skip] Refactored Androids
This commit is contained in:
parent
8b3b67e5c5
commit
be43f825a9
@ -73,6 +73,7 @@
|
|||||||
* Fixed #1438
|
* Fixed #1438
|
||||||
* Fixed Multi Tool functioning as unlimited Shears
|
* Fixed Multi Tool functioning as unlimited Shears
|
||||||
* Fixed #1383
|
* Fixed #1383
|
||||||
|
* Fixed Android Script Component textures
|
||||||
|
|
||||||
## Release Candidate 4 (06 Jan 2020)
|
## Release Candidate 4 (06 Jan 2020)
|
||||||
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#4
|
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#4
|
||||||
|
@ -5,7 +5,7 @@ import org.bukkit.event.Cancellable;
|
|||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import me.mrCookieSlime.Slimefun.androids.AndroidEntity;
|
import io.github.thebusybiscuit.slimefun4.implementation.android.AndroidEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is fired before a miner android mines a block.
|
* This event is fired before a miner android mines a block.
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
package io.github.thebusybiscuit.slimefun4.implementation.android;
|
||||||
|
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import me.mrCookieSlime.ExoticGarden.ExoticGarden;
|
||||||
|
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||||
|
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||||
|
|
||||||
|
public abstract class AdvancedFarmerAndroid extends FarmerAndroid {
|
||||||
|
|
||||||
|
public AdvancedFarmerAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||||
|
super(category, item, recipeType, recipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AndroidType getAndroidType() {
|
||||||
|
return AndroidType.ADVANCED_FARMER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void exoticFarm(BlockMenu menu, Block block) {
|
||||||
|
farm(menu, block);
|
||||||
|
|
||||||
|
if (SlimefunPlugin.getHooks().isExoticGardenInstalled()) {
|
||||||
|
ItemStack drop = ExoticGarden.harvestPlant(block);
|
||||||
|
|
||||||
|
if (drop != null && menu.fits(drop, getOutputSlots())) {
|
||||||
|
menu.pushItem(drop, getOutputSlots());
|
||||||
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package me.mrCookieSlime.Slimefun.androids;
|
package io.github.thebusybiscuit.slimefun4.implementation.android;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package me.mrCookieSlime.Slimefun.androids;
|
package io.github.thebusybiscuit.slimefun4.implementation.android;
|
||||||
|
|
||||||
public enum AndroidType {
|
public enum AndroidType {
|
||||||
|
|
@ -0,0 +1,70 @@
|
|||||||
|
package io.github.thebusybiscuit.slimefun4.implementation.android;
|
||||||
|
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.ArmorStand;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
|
||||||
|
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||||
|
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||||
|
|
||||||
|
public abstract class ButcherAndroid extends ProgrammableAndroid {
|
||||||
|
|
||||||
|
private static final String METADATA_KEY = "android_killer";
|
||||||
|
|
||||||
|
public ButcherAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||||
|
super(category, item, recipeType, recipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AndroidType getAndroidType() {
|
||||||
|
return AndroidType.FIGHTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void killEntities(Block b, double damage, Predicate<Entity> predicate) {
|
||||||
|
double radius = 4.0 + getTier();
|
||||||
|
|
||||||
|
for (Entity n : b.getWorld().getNearbyEntities(b.getLocation(), radius, radius, radius, n -> n instanceof LivingEntity && !(n instanceof ArmorStand) && !(n instanceof Player) && n.isValid() && predicate.test(n))) {
|
||||||
|
boolean attack = false;
|
||||||
|
|
||||||
|
switch (BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) {
|
||||||
|
case NORTH:
|
||||||
|
attack = n.getLocation().getZ() < b.getZ();
|
||||||
|
break;
|
||||||
|
case EAST:
|
||||||
|
attack = n.getLocation().getX() > b.getX();
|
||||||
|
break;
|
||||||
|
case SOUTH:
|
||||||
|
attack = n.getLocation().getZ() > b.getZ();
|
||||||
|
break;
|
||||||
|
case WEST:
|
||||||
|
attack = n.getLocation().getX() < b.getX();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attack) {
|
||||||
|
if (n.hasMetadata(METADATA_KEY)) {
|
||||||
|
n.removeMetadata(METADATA_KEY, SlimefunPlugin.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
n.setMetadata(METADATA_KEY, new FixedMetadataValue(SlimefunPlugin.instance, new AndroidEntity(this, b)));
|
||||||
|
|
||||||
|
((LivingEntity) n).damage(damage);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
package io.github.thebusybiscuit.slimefun4.implementation.android;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.data.Ageable;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||||
|
|
||||||
|
public abstract class FarmerAndroid extends ProgrammableAndroid {
|
||||||
|
|
||||||
|
public FarmerAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||||
|
super(category, item, recipeType, recipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AndroidType getAndroidType() {
|
||||||
|
return AndroidType.FARMER;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isFullGrown(Block block){
|
||||||
|
if (!(block.getBlockData() instanceof Ageable)) return false;
|
||||||
|
|
||||||
|
Ageable ageable = ((Ageable) block.getBlockData());
|
||||||
|
return ageable.getAge() >= ageable.getMaximumAge();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void farm(BlockMenu menu, Block block) {
|
||||||
|
if (isFullGrown(block)) {
|
||||||
|
ItemStack drop = getDropFromCrop(block.getType());
|
||||||
|
|
||||||
|
if (drop != null && menu.fits(drop, getOutputSlots())) {
|
||||||
|
menu.pushItem(drop, getOutputSlots());
|
||||||
|
Ageable ageable = (Ageable) block.getBlockData();
|
||||||
|
ageable.setAge(0);
|
||||||
|
block.setBlockData(ageable);
|
||||||
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack getDropFromCrop(Material crop) {
|
||||||
|
Random random = ThreadLocalRandom.current();
|
||||||
|
|
||||||
|
switch (crop) {
|
||||||
|
case WHEAT:
|
||||||
|
return new ItemStack(Material.WHEAT, random.nextInt(2) + 1);
|
||||||
|
case POTATOES:
|
||||||
|
return new ItemStack(Material.POTATO, random.nextInt(3) + 1);
|
||||||
|
case CARROTS:
|
||||||
|
return new ItemStack(Material.CARROT, random.nextInt(3) + 1);
|
||||||
|
case BEETROOTS:
|
||||||
|
return new ItemStack(Material.BEETROOT, random.nextInt(3) + 1);
|
||||||
|
case COCOA:
|
||||||
|
return new ItemStack(Material.COCOA_BEANS, random.nextInt(3) + 1);
|
||||||
|
case NETHER_WART:
|
||||||
|
return new ItemStack(Material.NETHER_WART, random.nextInt(3) + 1);
|
||||||
|
case SWEET_BERRY_BUSH:
|
||||||
|
return new ItemStack(Material.SWEET_BERRIES, random.nextInt(3) + 1);
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package io.github.thebusybiscuit.slimefun4.implementation.android;
|
||||||
|
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import io.github.thebusybiscuit.cscorelib2.collections.RandomizedSet;
|
||||||
|
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
||||||
|
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||||
|
|
||||||
|
public abstract class FisherAndroid extends ProgrammableAndroid {
|
||||||
|
|
||||||
|
private final RandomizedSet<ItemStack> fishingLoot = new RandomizedSet<>();
|
||||||
|
|
||||||
|
public FisherAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||||
|
super(category, item, recipeType, recipe);
|
||||||
|
|
||||||
|
for (Material fish : MaterialCollections.getAllFishItems()) {
|
||||||
|
fishingLoot.add(new ItemStack(fish), 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
fishingLoot.add(new ItemStack(Material.BONE), 10);
|
||||||
|
fishingLoot.add(new ItemStack(Material.STRING), 10);
|
||||||
|
fishingLoot.add(new ItemStack(Material.KELP), 6);
|
||||||
|
fishingLoot.add(new ItemStack(Material.STICK), 5);
|
||||||
|
fishingLoot.add(new ItemStack(Material.INK_SAC), 4);
|
||||||
|
fishingLoot.add(new ItemStack(Material.ROTTEN_FLESH), 3);
|
||||||
|
fishingLoot.add(new ItemStack(Material.LEATHER), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AndroidType getAndroidType() {
|
||||||
|
return AndroidType.FISHERMAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void fish(Block b, BlockMenu menu) {
|
||||||
|
Block water = b.getRelative(BlockFace.DOWN);
|
||||||
|
|
||||||
|
if (water.getType() == Material.WATER) {
|
||||||
|
water.getWorld().playSound(water.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
|
||||||
|
|
||||||
|
if (ThreadLocalRandom.current().nextInt(100) < 10 * getTier()) {
|
||||||
|
ItemStack drop = fishingLoot.getRandom();
|
||||||
|
|
||||||
|
if (menu.fits(drop, getOutputSlots())) {
|
||||||
|
menu.pushItem(drop, getOutputSlots());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,122 @@
|
|||||||
|
package io.github.thebusybiscuit.slimefun4.implementation.android;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
||||||
|
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.api.events.AndroidMineEvent;
|
||||||
|
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||||
|
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||||
|
|
||||||
|
public abstract class MinerAndroid extends ProgrammableAndroid {
|
||||||
|
|
||||||
|
// Determines the drops a miner android will get
|
||||||
|
private final ItemStack effectivePickaxe = new ItemStack(Material.DIAMOND_PICKAXE);
|
||||||
|
|
||||||
|
public MinerAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||||
|
super(category, item, recipeType, recipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AndroidType getAndroidType() {
|
||||||
|
return AndroidType.MINER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mine(Block b, BlockMenu menu, Block block) {
|
||||||
|
Collection<ItemStack> drops = block.getDrops(effectivePickaxe);
|
||||||
|
|
||||||
|
if (!MaterialCollections.getAllUnbreakableBlocks().contains(block.getType()) && !drops.isEmpty() && SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))), block.getLocation(), ProtectableAction.BREAK_BLOCK)) {
|
||||||
|
String item = BlockStorage.checkID(block);
|
||||||
|
|
||||||
|
AndroidMineEvent event = new AndroidMineEvent(block, new AndroidEntity(this, b));
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item == null) {
|
||||||
|
for (ItemStack drop : drops) {
|
||||||
|
if (menu.fits(drop, getOutputSlots())) {
|
||||||
|
menu.pushItem(drop, getOutputSlots());
|
||||||
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
||||||
|
block.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
else if (fits(b, item.getItem())) {
|
||||||
|
if (SlimefunItem.blockhandler.containsKey(item.getID())) {
|
||||||
|
if (SlimefunItem.blockhandler.get(item.getID()).onBreak(null, block, item, UnregisterReason.ANDROID_DIG)) {
|
||||||
|
pushItems(b, BlockStorage.retrieve(block));
|
||||||
|
if (SlimefunItem.blockhandler.containsKey(item.getID())) SlimefunItem.blockhandler.get(item.getID()).onBreak(null, block, item, UnregisterReason.ANDROID_DIG);
|
||||||
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
||||||
|
block.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void movedig(Block b, BlockMenu menu, BlockFace face, Block block) {
|
||||||
|
Collection<ItemStack> drops = block.getDrops(effectivePickaxe);
|
||||||
|
|
||||||
|
if (!MaterialCollections.getAllUnbreakableBlocks().contains(block.getType()) && !drops.isEmpty() && SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))), block.getLocation(), ProtectableAction.BREAK_BLOCK)) {
|
||||||
|
SlimefunItem item = BlockStorage.check(block);
|
||||||
|
|
||||||
|
AndroidMineEvent event = new AndroidMineEvent(block, new AndroidEntity(this, b));
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item == null) {
|
||||||
|
for (ItemStack drop : drops) {
|
||||||
|
if (menu.fits(drop, getOutputSlots())) {
|
||||||
|
menu.pushItem(drop, getOutputSlots());
|
||||||
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
||||||
|
|
||||||
|
block.setType(Material.AIR);
|
||||||
|
move(b, face, block);
|
||||||
|
|
||||||
|
b.setType(Material.AIR);
|
||||||
|
BlockStorage.moveBlockInfo(b.getLocation(), block.getLocation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
else {
|
||||||
|
if (fits(b, item.getItem()) && SlimefunPlugin.getUtilities().blockHandlers.containsKey(item.getID()) && SlimefunPlugin.getUtilities().blockHandlers.get(item.getID()).onBreak(null, block, item, UnregisterReason.ANDROID_DIG)) {
|
||||||
|
pushItems(b, BlockStorage.retrieve(block));
|
||||||
|
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
||||||
|
|
||||||
|
block.setType(Material.AIR);
|
||||||
|
move(b, face, block);
|
||||||
|
|
||||||
|
b.setType(Material.AIR);
|
||||||
|
BlockStorage.moveBlockInfo(b.getLocation(), block.getLocation());
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
move(b, face, block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,24 +1,19 @@
|
|||||||
package me.mrCookieSlime.Slimefun.androids;
|
package io.github.thebusybiscuit.slimefun4.implementation.android;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -26,43 +21,37 @@ import org.bukkit.Tag;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Dispenser;
|
import org.bukkit.block.Dispenser;
|
||||||
import org.bukkit.block.data.Ageable;
|
|
||||||
import org.bukkit.block.data.Rotatable;
|
import org.bukkit.block.data.Rotatable;
|
||||||
import org.bukkit.entity.Animals;
|
import org.bukkit.entity.Animals;
|
||||||
import org.bukkit.entity.ArmorStand;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.blocks.Vein;
|
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||||
import io.github.thebusybiscuit.cscorelib2.chat.ChatInput;
|
import io.github.thebusybiscuit.cscorelib2.chat.ChatInput;
|
||||||
import io.github.thebusybiscuit.cscorelib2.collections.RandomizedSet;
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||||
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||||
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.materials.MaterialConverter;
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.skull.SkullBlock;
|
import io.github.thebusybiscuit.cscorelib2.skull.SkullBlock;
|
||||||
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
||||||
import io.github.thebusybiscuit.slimefun4.api.events.AndroidMineEvent;
|
import io.github.thebusybiscuit.slimefun4.utils.NumberUtils;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
|
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
|
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
|
||||||
import me.mrCookieSlime.ExoticGarden.ExoticGarden;
|
|
||||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunBlockHandler;
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunBlockHandler;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.UnregisterReason;
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.UnregisterReason;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock;
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.RecipeDisplayItem;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
|
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
|
||||||
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
|
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
|
||||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||||
@ -72,47 +61,14 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
|||||||
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
|
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
|
||||||
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
|
import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
|
||||||
|
|
||||||
public abstract class ProgrammableAndroid extends SlimefunItem implements InventoryBlock {
|
public abstract class ProgrammableAndroid extends SimpleSlimefunItem<BlockTicker> implements InventoryBlock, RecipeDisplayItem {
|
||||||
|
|
||||||
// Determines the drops a miner android will get
|
|
||||||
private static final ItemStack EFFECTIVE_PICKAXE = new ItemStack(Material.DIAMOND_PICKAXE);
|
|
||||||
|
|
||||||
private static final int[] border = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 18, 24, 25, 26, 27, 33, 35, 36, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53};
|
private static final int[] border = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 18, 24, 25, 26, 27, 33, 35, 36, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53};
|
||||||
private static final int[] border_out = {10, 11, 12, 13, 14, 19, 23, 28, 32, 37, 38, 39, 40, 41};
|
private static final int[] border_out = {10, 11, 12, 13, 14, 19, 23, 28, 32, 37, 38, 39, 40, 41};
|
||||||
|
|
||||||
private static final RandomizedSet<ItemStack> fishingLoot = new RandomizedSet<>();
|
protected final List<BlockFace> directions = Arrays.asList(BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST);
|
||||||
|
protected final Set<MachineFuel> recipes = new HashSet<>();
|
||||||
static {
|
protected final String texture;
|
||||||
for (Material fish : MaterialCollections.getAllFishItems()) {
|
|
||||||
fishingLoot.add(new ItemStack(fish), 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
fishingLoot.add(new ItemStack(Material.BONE), 10);
|
|
||||||
fishingLoot.add(new ItemStack(Material.STRING), 10);
|
|
||||||
fishingLoot.add(new ItemStack(Material.STICK), 5);
|
|
||||||
fishingLoot.add(new ItemStack(Material.INK_SAC), 4);
|
|
||||||
fishingLoot.add(new ItemStack(Material.ROTTEN_FLESH), 3);
|
|
||||||
fishingLoot.add(new ItemStack(Material.LEATHER), 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final List<BlockFace> directions = Arrays.asList(BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST);
|
|
||||||
|
|
||||||
private final Set<MachineFuel> recipes = new HashSet<>();
|
|
||||||
private final String texture;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getInputSlots() {
|
|
||||||
return new int[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getOutputSlots() {
|
|
||||||
return new int[] {20, 21, 22, 29, 30, 31};
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract AndroidType getAndroidType();
|
|
||||||
public abstract float getFuelEfficiency();
|
|
||||||
public abstract int getTier();
|
|
||||||
|
|
||||||
public ProgrammableAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
public ProgrammableAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||||
super(category, item, recipeType, recipe);
|
super(category, item, recipeType, recipe);
|
||||||
@ -242,6 +198,60 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockTicker getItemHandler() {
|
||||||
|
return new BlockTicker() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick(Block b, SlimefunItem sf, me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config data) {
|
||||||
|
if (b != null) {
|
||||||
|
ProgrammableAndroid.this.tick(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSynchronized() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRecipeSectionLabel() {
|
||||||
|
return "&7\u21E9 Available Types of Fuel \u21E9";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDisplayRecipes() {
|
||||||
|
List<ItemStack> list = new ArrayList<>();
|
||||||
|
|
||||||
|
for (MachineFuel fuel : recipes) {
|
||||||
|
ItemStack item = fuel.getInput().clone();
|
||||||
|
ItemMeta im = item.getItemMeta();
|
||||||
|
List<String> lore = new ArrayList<>();
|
||||||
|
lore.add(ChatColors.color("&8\u21E8 &7Lasts " + NumberUtils.getTimeLeft(fuel.getTicks() / 2)));
|
||||||
|
im.setLore(lore);
|
||||||
|
item.setItemMeta(im);
|
||||||
|
list.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getInputSlots() {
|
||||||
|
return new int[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getOutputSlots() {
|
||||||
|
return new int[] {20, 21, 22, 29, 30, 31};
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract AndroidType getAndroidType();
|
||||||
|
public abstract float getFuelEfficiency();
|
||||||
|
public abstract int getTier();
|
||||||
|
|
||||||
protected void tick(Block b) {
|
protected void tick(Block b) {
|
||||||
if (b.getType() != Material.PLAYER_HEAD) {
|
if (b.getType() != Material.PLAYER_HEAD) {
|
||||||
// The Android was destroyed or moved.
|
// The Android was destroyed or moved.
|
||||||
@ -327,20 +337,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
|||||||
mine(b, menu, b.getRelative(BlockFace.DOWN));
|
mine(b, menu, b.getRelative(BlockFace.DOWN));
|
||||||
break;
|
break;
|
||||||
case CATCH_FISH:
|
case CATCH_FISH:
|
||||||
Block water = b.getRelative(BlockFace.DOWN);
|
fish(b, menu);
|
||||||
|
|
||||||
if (water.getType() == Material.WATER) {
|
|
||||||
water.getWorld().playSound(water.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
|
|
||||||
|
|
||||||
if (ThreadLocalRandom.current().nextInt(100) < 10 * getTier()) {
|
|
||||||
ItemStack drop = fishingLoot.getRandom();
|
|
||||||
|
|
||||||
if (menu.fits(drop, getOutputSlots())) {
|
|
||||||
menu.pushItem(drop, getOutputSlots());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case MOVE_AND_DIG_FORWARD:
|
case MOVE_AND_DIG_FORWARD:
|
||||||
movedig(b, menu, face, b.getRelative(face));
|
movedig(b, menu, face, b.getRelative(face));
|
||||||
@ -411,33 +408,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
|||||||
exoticFarm(menu, b.getRelative(BlockFace.DOWN));
|
exoticFarm(menu, b.getRelative(BlockFace.DOWN));
|
||||||
break;
|
break;
|
||||||
case CHOP_TREE:
|
case CHOP_TREE:
|
||||||
if (MaterialCollections.getAllLogs().contains(b.getRelative(face).getType())) {
|
refresh = chopTree(b, menu, face);
|
||||||
List<Block> list = Vein.find(b.getRelative(face), 180, block -> MaterialCollections.getAllLogs().contains(block.getType()));
|
|
||||||
if (!list.isEmpty()) {
|
|
||||||
refresh = false;
|
|
||||||
Block log = list.get(list.size() - 1);
|
|
||||||
log.getWorld().playEffect(log.getLocation(), Effect.STEP_SOUND, log.getType());
|
|
||||||
|
|
||||||
if (SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))), log.getLocation(), ProtectableAction.BREAK_BLOCK)) {
|
|
||||||
ItemStack drop = new ItemStack(log.getType());
|
|
||||||
|
|
||||||
if (menu.fits(drop, getOutputSlots())) {
|
|
||||||
menu.pushItem(drop, getOutputSlots());
|
|
||||||
log.getWorld().playEffect(log.getLocation(), Effect.STEP_SOUND, log.getType());
|
|
||||||
|
|
||||||
if (log.getY() == b.getRelative(face).getY()) {
|
|
||||||
Optional<Material> sapling = MaterialConverter.getSaplingFromLog(log.getType());
|
|
||||||
|
|
||||||
if (sapling.isPresent()) {
|
|
||||||
log.setType(sapling.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else log.setType(Material.AIR);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ATTACK_MOBS_ANIMALS:
|
case ATTACK_MOBS_ANIMALS:
|
||||||
killEntities(b, damage, e -> true);
|
killEntities(b, damage, e -> true);
|
||||||
@ -455,48 +426,14 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (refresh) BlockStorage.addBlockInfo(b, "index", String.valueOf(index));
|
if (refresh) {
|
||||||
}
|
BlockStorage.addBlockInfo(b, "index", String.valueOf(index));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void killEntities(Block b, double damage, Predicate<Entity> predicate) {
|
|
||||||
double radius = 4.0 + getTier();
|
|
||||||
|
|
||||||
for (Entity n : b.getWorld().getNearbyEntities(b.getLocation(), radius, radius, radius, n -> n instanceof LivingEntity && !(n instanceof ArmorStand) && !(n instanceof Player) && n.isValid() && predicate.test(n))) {
|
|
||||||
boolean attack = false;
|
|
||||||
|
|
||||||
switch (BlockFace.valueOf(BlockStorage.getLocationInfo(b.getLocation(), "rotation"))) {
|
|
||||||
case NORTH:
|
|
||||||
attack = n.getLocation().getZ() < b.getZ();
|
|
||||||
break;
|
|
||||||
case EAST:
|
|
||||||
attack = n.getLocation().getX() > b.getX();
|
|
||||||
break;
|
|
||||||
case SOUTH:
|
|
||||||
attack = n.getLocation().getZ() > b.getZ();
|
|
||||||
break;
|
|
||||||
case WEST:
|
|
||||||
attack = n.getLocation().getX() < b.getX();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attack) {
|
|
||||||
if (n.hasMetadata("android_killer")) {
|
|
||||||
n.removeMetadata("android_killer", SlimefunPlugin.instance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
n.setMetadata("android_killer", new FixedMetadataValue(SlimefunPlugin.instance, new AndroidEntity(this, b)));
|
|
||||||
|
|
||||||
((LivingEntity) n).damage(damage);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void move(Block b, BlockFace face, Block block) {
|
protected void move(Block b, BlockFace face, Block block) {
|
||||||
if (block.getY() > 0 && block.getY() < block.getWorld().getMaxHeight() && (block.getType() == Material.AIR || block.getType() == Material.CAVE_AIR)) {
|
if (block.getY() > 0 && block.getY() < block.getWorld().getMaxHeight() && (block.getType() == Material.AIR || block.getType() == Material.CAVE_AIR)) {
|
||||||
block.setType(Material.PLAYER_HEAD);
|
block.setType(Material.PLAYER_HEAD);
|
||||||
Rotatable blockData = (Rotatable) block.getBlockData();
|
Rotatable blockData = (Rotatable) block.getBlockData();
|
||||||
@ -510,144 +447,32 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mine(Block b, BlockMenu menu, Block block) {
|
protected void killEntities(Block b, double damage, Predicate<Entity> predicate) {
|
||||||
Collection<ItemStack> drops = block.getDrops(EFFECTIVE_PICKAXE);
|
throw new UnsupportedOperationException("Non-butcher Android tried to butcher!");
|
||||||
|
|
||||||
if (!MaterialCollections.getAllUnbreakableBlocks().contains(block.getType()) && !drops.isEmpty() && SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))), block.getLocation(), ProtectableAction.BREAK_BLOCK)) {
|
|
||||||
String item = BlockStorage.checkID(block);
|
|
||||||
|
|
||||||
AndroidMineEvent event = new AndroidMineEvent(block, new AndroidEntity(this, b));
|
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item == null) {
|
|
||||||
for (ItemStack drop : drops) {
|
|
||||||
if (menu.fits(drop, getOutputSlots())) {
|
|
||||||
menu.pushItem(drop, getOutputSlots());
|
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
|
||||||
block.setType(Material.AIR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
else if (fits(b, item.getItem())) {
|
|
||||||
if (SlimefunItem.blockhandler.containsKey(item.getID())) {
|
|
||||||
if (SlimefunItem.blockhandler.get(item.getID()).onBreak(null, block, item, UnregisterReason.ANDROID_DIG)) {
|
|
||||||
pushItems(b, BlockStorage.retrieve(block));
|
|
||||||
if (SlimefunItem.blockhandler.containsKey(item.getID())) SlimefunItem.blockhandler.get(item.getID()).onBreak(null, block, item, UnregisterReason.ANDROID_DIG);
|
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
|
||||||
block.setType(Material.AIR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void fish(Block b, BlockMenu menu) {
|
||||||
private void movedig(Block b, BlockMenu menu, BlockFace face, Block block) {
|
throw new UnsupportedOperationException("Non-fishing Android tried to fish!");
|
||||||
Collection<ItemStack> drops = block.getDrops(EFFECTIVE_PICKAXE);
|
|
||||||
|
|
||||||
if (!MaterialCollections.getAllUnbreakableBlocks().contains(block.getType()) && !drops.isEmpty() && SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))), block.getLocation(), ProtectableAction.BREAK_BLOCK)) {
|
|
||||||
SlimefunItem item = BlockStorage.check(block);
|
|
||||||
|
|
||||||
AndroidMineEvent event = new AndroidMineEvent(block, new AndroidEntity(this, b));
|
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item == null) {
|
|
||||||
for (ItemStack drop : drops) {
|
|
||||||
if (menu.fits(drop, getOutputSlots())) {
|
|
||||||
menu.pushItem(drop, getOutputSlots());
|
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
|
||||||
|
|
||||||
block.setType(Material.AIR);
|
|
||||||
move(b, face, block);
|
|
||||||
|
|
||||||
b.setType(Material.AIR);
|
|
||||||
BlockStorage.moveBlockInfo(b.getLocation(), block.getLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
else {
|
|
||||||
if (fits(b, item.getItem()) && SlimefunPlugin.getUtilities().blockHandlers.containsKey(item.getID()) && SlimefunPlugin.getUtilities().blockHandlers.get(item.getID()).onBreak(null, block, item, UnregisterReason.ANDROID_DIG)) {
|
|
||||||
pushItems(b, BlockStorage.retrieve(block));
|
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
|
||||||
|
|
||||||
block.setType(Material.AIR);
|
|
||||||
move(b, face, block);
|
|
||||||
|
|
||||||
b.setType(Material.AIR);
|
|
||||||
BlockStorage.moveBlockInfo(b.getLocation(), block.getLocation());
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
move(b, face, block);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isFullGrown(Block block){
|
protected void mine(Block b, BlockMenu menu, Block block) {
|
||||||
if (!(block.getBlockData() instanceof Ageable)) return false;
|
throw new UnsupportedOperationException("Non-mining Android tried to mine!");
|
||||||
|
|
||||||
Ageable ageable = ((Ageable) block.getBlockData());
|
|
||||||
return ageable.getAge() >= ageable.getMaximumAge();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void farm(BlockMenu menu, Block block) {
|
protected void movedig(Block b, BlockMenu menu, BlockFace face, Block block) {
|
||||||
if (isFullGrown(block)) {
|
throw new UnsupportedOperationException("Non-mining Android tried to mine!");
|
||||||
ItemStack drop = getDropFromCrop(block.getType());
|
|
||||||
|
|
||||||
if (drop != null && menu.fits(drop, getOutputSlots())) {
|
|
||||||
menu.pushItem(drop, getOutputSlots());
|
|
||||||
Ageable ageable = (Ageable) block.getBlockData();
|
|
||||||
ageable.setAge(0);
|
|
||||||
block.setBlockData(ageable);
|
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack getDropFromCrop(Material crop) {
|
protected boolean chopTree(Block b, BlockMenu menu, BlockFace face) {
|
||||||
Random random = ThreadLocalRandom.current();
|
throw new UnsupportedOperationException("Non-woodcutter Android tried to chop a Tree!");
|
||||||
|
|
||||||
switch (crop) {
|
|
||||||
case WHEAT:
|
|
||||||
return new ItemStack(Material.WHEAT, random.nextInt(2) + 1);
|
|
||||||
case POTATOES:
|
|
||||||
return new ItemStack(Material.POTATO, random.nextInt(3) + 1);
|
|
||||||
case CARROTS:
|
|
||||||
return new ItemStack(Material.CARROT, random.nextInt(3) + 1);
|
|
||||||
case BEETROOTS:
|
|
||||||
return new ItemStack(Material.BEETROOT, random.nextInt(3) + 1);
|
|
||||||
case COCOA:
|
|
||||||
return new ItemStack(Material.COCOA_BEANS, random.nextInt(3) + 1);
|
|
||||||
case NETHER_WART:
|
|
||||||
return new ItemStack(Material.NETHER_WART, random.nextInt(3) + 1);
|
|
||||||
case SWEET_BERRY_BUSH:
|
|
||||||
return new ItemStack(Material.SWEET_BERRIES, random.nextInt(3) + 1);
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exoticFarm(BlockMenu menu, Block block) {
|
protected void farm(BlockMenu menu, Block block) {
|
||||||
farm(menu, block);
|
throw new UnsupportedOperationException("Non-farming Android tried to farm!");
|
||||||
|
}
|
||||||
|
|
||||||
if (SlimefunPlugin.getHooks().isExoticGardenInstalled()) {
|
protected void exoticFarm(BlockMenu menu, Block block) {
|
||||||
ItemStack drop = ExoticGarden.harvestPlant(block);
|
throw new UnsupportedOperationException("Non-farming Android tried to farm!");
|
||||||
|
|
||||||
if (drop != null && menu.fits(drop, getOutputSlots())) {
|
|
||||||
menu.pushItem(drop, getOutputSlots());
|
|
||||||
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void constructMenu(BlockMenuPreset preset) {
|
private void constructMenu(BlockMenuPreset preset) {
|
||||||
@ -752,7 +577,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
|||||||
if (commands.length == 54) return false;
|
if (commands.length == 54) return false;
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
StringBuilder builder = new StringBuilder("START-");
|
StringBuilder builder = new StringBuilder(ScriptPart.START + "-");
|
||||||
|
|
||||||
for (String command : commands) {
|
for (String command : commands) {
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
@ -764,21 +589,21 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
|||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
builder.append("REPEAT");
|
builder.append(ScriptPart.REPEAT);
|
||||||
BlockStorage.addBlockInfo(b, "script", builder.toString());
|
BlockStorage.addBlockInfo(b, "script", builder.toString());
|
||||||
|
|
||||||
openScript(pl, b, builder.toString());
|
openScript(pl, b, builder.toString());
|
||||||
}
|
}
|
||||||
else if (action.isRightClicked()) {
|
else if (action.isRightClicked()) {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
StringBuilder builder = new StringBuilder("START-");
|
StringBuilder builder = new StringBuilder(ScriptPart.START + "-");
|
||||||
|
|
||||||
for (String command : commands) {
|
for (String command : commands) {
|
||||||
if (j != index && j > 0 && j < commands.length - 1) builder.append(command + "-");
|
if (j != index && j > 0 && j < commands.length - 1) builder.append(command + "-");
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.append("REPEAT");
|
builder.append(ScriptPart.REPEAT);
|
||||||
BlockStorage.addBlockInfo(b, "script", builder.toString());
|
BlockStorage.addBlockInfo(b, "script", builder.toString());
|
||||||
|
|
||||||
openScript(pl, b, builder.toString());
|
openScript(pl, b, builder.toString());
|
||||||
@ -1031,31 +856,11 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void register(boolean slimefun) {
|
|
||||||
addItemHandler(new BlockTicker() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tick(Block b, SlimefunItem sf, me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config data) {
|
|
||||||
if (b != null) {
|
|
||||||
ProgrammableAndroid.this.tick(b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSynchronized() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
super.register(slimefun);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerFuel(MachineFuel fuel) {
|
public void registerFuel(MachineFuel fuel) {
|
||||||
this.recipes.add(fuel);
|
this.recipes.add(fuel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Config> getUploadedScripts() {
|
private List<Config> getUploadedScripts() {
|
||||||
List<Config> scripts = new ArrayList<>();
|
List<Config> scripts = new ArrayList<>();
|
||||||
|
|
||||||
File directory = new File("plugins/Slimefun/scripts/" + this.getAndroidType().toString());
|
File directory = new File("plugins/Slimefun/scripts/" + this.getAndroidType().toString());
|
||||||
@ -1079,7 +884,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
|||||||
return scripts;
|
return scripts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ScriptPart> getAccessibleScriptParts() {
|
private List<ScriptPart> getAccessibleScriptParts() {
|
||||||
List<ScriptPart> list = new ArrayList<>();
|
List<ScriptPart> list = new ArrayList<>();
|
||||||
|
|
||||||
for (ScriptPart part : ScriptPart.values()) {
|
for (ScriptPart part : ScriptPart.values()) {
|
@ -0,0 +1,73 @@
|
|||||||
|
package io.github.thebusybiscuit.slimefun4.implementation.android;
|
||||||
|
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
||||||
|
|
||||||
|
public enum ScriptPart {
|
||||||
|
|
||||||
|
// Start and End Parts
|
||||||
|
START(AndroidType.NONE, "4ae29422db4047efdb9bac2cdae5a0719eb772fccc88a66d912320b343c341"),
|
||||||
|
REPEAT(AndroidType.NONE, "bc8def67a12622ead1decd3d89364257b531896d87e469813131ca235b5c7"),
|
||||||
|
WAIT(AndroidType.NONE, "2ee174f41e594e64ea3141c07daf7acf1fa045c230b2b0b0fb3da163db22f455"),
|
||||||
|
|
||||||
|
// Movement
|
||||||
|
GO_FORWARD(AndroidType.NON_FIGHTER, "d9bf6db4aeda9d8822b9f736538e8c18b9a4844f84eb45504adfbfee87eb"),
|
||||||
|
GO_UP(AndroidType.NON_FIGHTER, "105a2cab8b68ea57e3af992a36e47c8ff9aa87cc8776281966f8c3cf31a38"),
|
||||||
|
GO_DOWN(AndroidType.NON_FIGHTER, "c01586e39f6ffa63b4fb301b65ca7da8a92f7353aaab89d3886579125dfbaf9"),
|
||||||
|
|
||||||
|
//Directions
|
||||||
|
TURN_LEFT(AndroidType.NONE, "a185c97dbb8353de652698d24b64327b793a3f32a98be67b719fbedab35e"),
|
||||||
|
TURN_RIGHT(AndroidType.NONE, "31c0ededd7115fc1b23d51ce966358b27195daf26ebb6e45a66c34c69c34091"),
|
||||||
|
|
||||||
|
// Action - Pickaxe
|
||||||
|
DIG_UP(AndroidType.MINER, "2e6ce011ac9a7a75b2fcd408ad21a3ac1722f6e2eed8781cafd12552282b88"),
|
||||||
|
DIG_FORWARD(AndroidType.MINER, "b6ea2135838461534372f2da6c862d21cd5f3d2c7119f2bb674bbd42791"),
|
||||||
|
DIG_DOWN(AndroidType.MINER, "8d862024108c785bc0ef7199ec77c402dbbfcc624e9f41f83d8aed8b39fd13"),
|
||||||
|
|
||||||
|
MOVE_AND_DIG_UP(AndroidType.MINER, "2e6ce011ac9a7a75b2fcd408ad21a3ac1722f6e2eed8781cafd12552282b88"),
|
||||||
|
MOVE_AND_DIG_FORWARD(AndroidType.MINER, "b6ea2135838461534372f2da6c862d21cd5f3d2c7119f2bb674bbd42791"),
|
||||||
|
MOVE_AND_DIG_DOWN(AndroidType.MINER, "8d862024108c785bc0ef7199ec77c402dbbfcc624e9f41f83d8aed8b39fd13"),
|
||||||
|
|
||||||
|
// Action - Sword
|
||||||
|
ATTACK_MOBS_ANIMALS(AndroidType.FIGHTER, "c7e6c40f68b775f2efcd7bd9916b327869dcf27e24c855d0a18e07ac04fe1"),
|
||||||
|
ATTACK_MOBS(AndroidType.FIGHTER, "c7e6c40f68b775f2efcd7bd9916b327869dcf27e24c855d0a18e07ac04fe1"),
|
||||||
|
ATTACK_ANIMALS(AndroidType.FIGHTER, "c7e6c40f68b775f2efcd7bd9916b327869dcf27e24c855d0a18e07ac04fe1"),
|
||||||
|
ATTACK_ANIMALS_ADULT(AndroidType.FIGHTER, "c7e6c40f68b775f2efcd7bd9916b327869dcf27e24c855d0a18e07ac04fe1"),
|
||||||
|
|
||||||
|
// Action - Axe
|
||||||
|
CHOP_TREE(AndroidType.WOODCUTTER, "64ba49384dba7b7acdb4f70e9361e6d57cbbcbf720cf4f16c2bb83e4557"),
|
||||||
|
|
||||||
|
// Action - Fishing Rod
|
||||||
|
CATCH_FISH(AndroidType.FISHERMAN, "fd4fde511f4454101e4a2a72bc86f12985dfcda76b64bb24dc63a9fa9e3a3"),
|
||||||
|
|
||||||
|
// Action - Hoe
|
||||||
|
FARM_FORWARD(AndroidType.FARMER, "4de9a522c3d9e7d85f3d82c375dc37fecc856dbd801eb3bcedc1165198bf"),
|
||||||
|
FARM_DOWN(AndroidType.FARMER, "2d4296b333d25319af3f33051797f9e6d821cd19a014fb7137beb86a4e9e96"),
|
||||||
|
|
||||||
|
// Action - ExoticGarden
|
||||||
|
FARM_EXOTIC_FORWARD(AndroidType.ADVANCED_FARMER, "4de9a522c3d9e7d85f3d82c375dc37fecc856dbd801eb3bcedc1165198bf"),
|
||||||
|
FARM_EXOTIC_DOWN(AndroidType.ADVANCED_FARMER, "2d4296b333d25319af3f33051797f9e6d821cd19a014fb7137beb86a4e9e96"),
|
||||||
|
|
||||||
|
// Action - Interface
|
||||||
|
INTERFACE_ITEMS(AndroidType.NONE, "90a4dbf6625c42be57a8ba2c330954a76bdf22785540e87a5c9672685238ec"),
|
||||||
|
INTERFACE_FUEL(AndroidType.NONE, "2432f5282a50745b912be14deda581bd4a09b977a3c32d7e9578491fee8fa7");
|
||||||
|
|
||||||
|
|
||||||
|
private final ItemStack item;
|
||||||
|
private final AndroidType type;
|
||||||
|
|
||||||
|
private ScriptPart(AndroidType type, String texture) {
|
||||||
|
this.type = type;
|
||||||
|
this.item = SkullItem.fromHash(texture);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getItem() {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AndroidType getRequiredType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package io.github.thebusybiscuit.slimefun4.implementation.android;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import io.github.thebusybiscuit.cscorelib2.blocks.Vein;
|
||||||
|
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
||||||
|
import io.github.thebusybiscuit.cscorelib2.materials.MaterialConverter;
|
||||||
|
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
|
||||||
|
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||||
|
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||||
|
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||||
|
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
|
||||||
|
|
||||||
|
public abstract class WoodcutterAndroid extends ProgrammableAndroid {
|
||||||
|
|
||||||
|
public WoodcutterAndroid(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||||
|
super(category, item, recipeType, recipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AndroidType getAndroidType() {
|
||||||
|
return AndroidType.WOODCUTTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean chopTree(Block b, BlockMenu menu, BlockFace face) {
|
||||||
|
if (MaterialCollections.getAllLogs().contains(b.getRelative(face).getType())) {
|
||||||
|
List<Block> list = Vein.find(b.getRelative(face), 180, block -> MaterialCollections.getAllLogs().contains(block.getType()));
|
||||||
|
|
||||||
|
if (!list.isEmpty()) {
|
||||||
|
Block log = list.get(list.size() - 1);
|
||||||
|
log.getWorld().playEffect(log.getLocation(), Effect.STEP_SOUND, log.getType());
|
||||||
|
|
||||||
|
if (SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))), log.getLocation(), ProtectableAction.BREAK_BLOCK)) {
|
||||||
|
ItemStack drop = new ItemStack(log.getType());
|
||||||
|
|
||||||
|
if (menu.fits(drop, getOutputSlots())) {
|
||||||
|
menu.pushItem(drop, getOutputSlots());
|
||||||
|
log.getWorld().playEffect(log.getLocation(), Effect.STEP_SOUND, log.getType());
|
||||||
|
|
||||||
|
if (log.getY() == b.getRelative(face).getY()) {
|
||||||
|
Optional<Material> sapling = MaterialConverter.getSaplingFromLog(log.getType());
|
||||||
|
|
||||||
|
if (sapling.isPresent()) {
|
||||||
|
log.setType(sapling.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else log.setType(Material.AIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -16,8 +16,8 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.android.AndroidEntity;
|
||||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||||
import me.mrCookieSlime.Slimefun.androids.AndroidEntity;
|
|
||||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||||
|
|
||||||
public class AndroidKillingListener implements Listener {
|
public class AndroidKillingListener implements Listener {
|
||||||
|
@ -76,14 +76,14 @@ public class DebugFishListener implements Listener {
|
|||||||
if (BlockStorage.check(e.getClickedBlock()).isTicking()) {
|
if (BlockStorage.check(e.getClickedBlock()).isTicking()) {
|
||||||
p.sendMessage(ChatColors.color("&dTicking: " + "&2\u2714"));
|
p.sendMessage(ChatColors.color("&dTicking: " + "&2\u2714"));
|
||||||
p.sendMessage(ChatColors.color(" &dAsync: &e" + (BlockStorage.check(e.getClickedBlock()).getBlockTicker().isSynchronized() ? "&4\u2718" : "&2\u2714")));
|
p.sendMessage(ChatColors.color(" &dAsync: &e" + (BlockStorage.check(e.getClickedBlock()).getBlockTicker().isSynchronized() ? "&4\u2718" : "&2\u2714")));
|
||||||
p.sendMessage(ChatColors.color(" &dTimings: &e" + SlimefunPlugin.getTicker().getTimings(e.getClickedBlock()) + "ms"));
|
p.sendMessage(ChatColors.color(" &dTimings: &e" + SlimefunPlugin.getTicker().getTimings(e.getClickedBlock()) + "ns"));
|
||||||
p.sendMessage(ChatColors.color(" &dTotal Timings: &e" + SlimefunPlugin.getTicker().getTimings(BlockStorage.checkID(e.getClickedBlock())) + "ms"));
|
p.sendMessage(ChatColors.color(" &dTotal Timings: &e" + SlimefunPlugin.getTicker().getTimings(BlockStorage.checkID(e.getClickedBlock())) + "ns"));
|
||||||
p.sendMessage(ChatColors.color(" &dChunk Timings: &e" + SlimefunPlugin.getTicker().getTimings(e.getClickedBlock().getChunk()) + "ms"));
|
p.sendMessage(ChatColors.color(" &dChunk Timings: &e" + SlimefunPlugin.getTicker().getTimings(e.getClickedBlock().getChunk()) + "ns"));
|
||||||
}
|
}
|
||||||
else if (BlockStorage.check(e.getClickedBlock()).getEnergyTicker() != null) {
|
else if (BlockStorage.check(e.getClickedBlock()).getEnergyTicker() != null) {
|
||||||
p.sendMessage(ChatColors.color("&dTicking: " + "&b~ &3(Indirect)"));
|
p.sendMessage(ChatColors.color("&dTicking: " + "&b~ &3(Indirect)"));
|
||||||
p.sendMessage(ChatColors.color(" &dTimings: &e" + SlimefunPlugin.getTicker().getTimings(e.getClickedBlock()) + "ms"));
|
p.sendMessage(ChatColors.color(" &dTimings: &e" + SlimefunPlugin.getTicker().getTimings(e.getClickedBlock()) + "ns"));
|
||||||
p.sendMessage(ChatColors.color(" &dChunk Timings: &e" + SlimefunPlugin.getTicker().getTimings(e.getClickedBlock().getChunk()) + "ms"));
|
p.sendMessage(ChatColors.color(" &dChunk Timings: &e" + SlimefunPlugin.getTicker().getTimings(e.getClickedBlock().getChunk()) + "ns"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
p.sendMessage(ChatColors.color("&dTicking: " + "&4\u2718"));
|
p.sendMessage(ChatColors.color("&dTicking: " + "&4\u2718"));
|
||||||
|
@ -31,6 +31,14 @@ import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
|
|||||||
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
||||||
import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
|
import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
|
||||||
import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactivity;
|
import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactivity;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.android.AdvancedFarmerAndroid;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.android.AndroidType;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.android.ButcherAndroid;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.android.FarmerAndroid;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.android.FisherAndroid;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.android.MinerAndroid;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.android.ProgrammableAndroid;
|
||||||
|
import io.github.thebusybiscuit.slimefun4.implementation.android.WoodcutterAndroid;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.tasks.RainbowTicker;
|
import io.github.thebusybiscuit.slimefun4.implementation.tasks.RainbowTicker;
|
||||||
import io.github.thebusybiscuit.slimefun4.utils.FireworkUtils;
|
import io.github.thebusybiscuit.slimefun4.utils.FireworkUtils;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
|
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
|
||||||
@ -171,8 +179,6 @@ import me.mrCookieSlime.Slimefun.Objects.handlers.BlockPlaceHandler;
|
|||||||
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemUseHandler;
|
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemUseHandler;
|
||||||
import me.mrCookieSlime.Slimefun.Objects.handlers.MultiBlockInteractionHandler;
|
import me.mrCookieSlime.Slimefun.Objects.handlers.MultiBlockInteractionHandler;
|
||||||
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
|
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
|
||||||
import me.mrCookieSlime.Slimefun.androids.AndroidType;
|
|
||||||
import me.mrCookieSlime.Slimefun.androids.ProgrammableAndroid;
|
|
||||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||||
@ -2139,14 +2145,9 @@ public final class SlimefunItemSetup {
|
|||||||
}
|
}
|
||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
new ProgrammableAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_MINER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
new MinerAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_MINER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
new ItemStack[] {null, null, null, new ItemStack(Material.DIAMOND_PICKAXE), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_PICKAXE), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
new ItemStack[] {null, null, null, new ItemStack(Material.DIAMOND_PICKAXE), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_PICKAXE), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
||||||
|
|
||||||
@Override
|
|
||||||
public AndroidType getAndroidType() {
|
|
||||||
return AndroidType.MINER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFuelEfficiency() {
|
public float getFuelEfficiency() {
|
||||||
return 1;
|
return 1;
|
||||||
@ -2160,14 +2161,9 @@ public final class SlimefunItemSetup {
|
|||||||
}
|
}
|
||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
new ProgrammableAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_FARMER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
new FarmerAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_FARMER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
new ItemStack[] {null, null, null, new ItemStack(Material.DIAMOND_HOE), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_HOE), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
new ItemStack[] {null, null, null, new ItemStack(Material.DIAMOND_HOE), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_HOE), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
||||||
|
|
||||||
@Override
|
|
||||||
public AndroidType getAndroidType() {
|
|
||||||
return AndroidType.FARMER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFuelEfficiency() {
|
public float getFuelEfficiency() {
|
||||||
return 1;
|
return 1;
|
||||||
@ -2181,14 +2177,9 @@ public final class SlimefunItemSetup {
|
|||||||
}
|
}
|
||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
new ProgrammableAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_WOODCUTTER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
new WoodcutterAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_WOODCUTTER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
new ItemStack[] {null, null, null, new ItemStack(Material.DIAMOND_AXE), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_AXE), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
new ItemStack[] {null, null, null, new ItemStack(Material.DIAMOND_AXE), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_AXE), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
||||||
|
|
||||||
@Override
|
|
||||||
public AndroidType getAndroidType() {
|
|
||||||
return AndroidType.WOODCUTTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFuelEfficiency() {
|
public float getFuelEfficiency() {
|
||||||
return 1;
|
return 1;
|
||||||
@ -2202,14 +2193,9 @@ public final class SlimefunItemSetup {
|
|||||||
}
|
}
|
||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
new ProgrammableAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_FISHERMAN, RecipeType.ENHANCED_CRAFTING_TABLE,
|
new FisherAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_FISHERMAN, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
new ItemStack[] {null, null, null, new ItemStack(Material.FISHING_ROD), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.FISHING_ROD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
new ItemStack[] {null, null, null, new ItemStack(Material.FISHING_ROD), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.FISHING_ROD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
||||||
|
|
||||||
@Override
|
|
||||||
public AndroidType getAndroidType() {
|
|
||||||
return AndroidType.FISHERMAN;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFuelEfficiency() {
|
public float getFuelEfficiency() {
|
||||||
return 1;
|
return 1;
|
||||||
@ -2223,14 +2209,9 @@ public final class SlimefunItemSetup {
|
|||||||
}
|
}
|
||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
new ProgrammableAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_BUTCHER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
new ButcherAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_BUTCHER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER, null, new ItemStack(Material.DIAMOND_SWORD), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_SWORD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER, null, new ItemStack(Material.DIAMOND_SWORD), SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.DIAMOND_SWORD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
||||||
|
|
||||||
@Override
|
|
||||||
public AndroidType getAndroidType() {
|
|
||||||
return AndroidType.FIGHTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFuelEfficiency() {
|
public float getFuelEfficiency() {
|
||||||
return 1;
|
return 1;
|
||||||
@ -2252,7 +2233,6 @@ public final class SlimefunItemSetup {
|
|||||||
new ItemStack[] {SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, new ItemStack(Material.RED_STAINED_GLASS), SlimefunItems.BASIC_CIRCUIT_BOARD, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET})
|
new ItemStack[] {SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, new ItemStack(Material.RED_STAINED_GLASS), SlimefunItems.BASIC_CIRCUIT_BOARD, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET, SlimefunItems.PLASTIC_SHEET})
|
||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
|
|
||||||
new ProgrammableAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_2, RecipeType.ENHANCED_CRAFTING_TABLE,
|
new ProgrammableAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_2, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
new ItemStack[] {SlimefunItems.PLASTIC_SHEET, SlimefunItems.ANDROID_MEMORY_CORE, SlimefunItems.PLASTIC_SHEET, SlimefunItems.COMBUSTION_REACTOR, SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.CHEST), SlimefunItems.PLASTIC_SHEET, SlimefunItems.POWER_CRYSTAL, SlimefunItems.PLASTIC_SHEET}) {
|
new ItemStack[] {SlimefunItems.PLASTIC_SHEET, SlimefunItems.ANDROID_MEMORY_CORE, SlimefunItems.PLASTIC_SHEET, SlimefunItems.COMBUSTION_REACTOR, SlimefunItems.PROGRAMMABLE_ANDROID, new ItemStack(Material.CHEST), SlimefunItems.PLASTIC_SHEET, SlimefunItems.POWER_CRYSTAL, SlimefunItems.PLASTIC_SHEET}) {
|
||||||
|
|
||||||
@ -2274,14 +2254,9 @@ public final class SlimefunItemSetup {
|
|||||||
}
|
}
|
||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
new ProgrammableAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_2_FISHERMAN, RecipeType.ENHANCED_CRAFTING_TABLE,
|
new FisherAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_2_FISHERMAN, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
new ItemStack[] {null, null, null, new ItemStack(Material.FISHING_ROD), SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.FISHING_ROD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
new ItemStack[] {null, null, null, new ItemStack(Material.FISHING_ROD), SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.FISHING_ROD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
||||||
|
|
||||||
@Override
|
|
||||||
public AndroidType getAndroidType() {
|
|
||||||
return AndroidType.FISHERMAN;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFuelEfficiency() {
|
public float getFuelEfficiency() {
|
||||||
return 1.5F;
|
return 1.5F;
|
||||||
@ -2295,14 +2270,9 @@ public final class SlimefunItemSetup {
|
|||||||
}
|
}
|
||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
new ProgrammableAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_2_BUTCHER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
new ButcherAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_2_BUTCHER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER, null, new ItemStack(Material.DIAMOND_SWORD), SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.DIAMOND_SWORD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER, null, new ItemStack(Material.DIAMOND_SWORD), SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.DIAMOND_SWORD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
||||||
|
|
||||||
@Override
|
|
||||||
public AndroidType getAndroidType() {
|
|
||||||
return AndroidType.FIGHTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFuelEfficiency() {
|
public float getFuelEfficiency() {
|
||||||
return 1.5F;
|
return 1.5F;
|
||||||
@ -2316,14 +2286,9 @@ public final class SlimefunItemSetup {
|
|||||||
}
|
}
|
||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
new ProgrammableAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_2_FARMER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
new AdvancedFarmerAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_2_FARMER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER, null, new ItemStack(Material.DIAMOND_HOE), SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.DIAMOND_HOE), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER, null, new ItemStack(Material.DIAMOND_HOE), SlimefunItems.PROGRAMMABLE_ANDROID_2, new ItemStack(Material.DIAMOND_HOE), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
||||||
|
|
||||||
@Override
|
|
||||||
public AndroidType getAndroidType() {
|
|
||||||
return AndroidType.ADVANCED_FARMER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFuelEfficiency() {
|
public float getFuelEfficiency() {
|
||||||
return 1.5F;
|
return 1.5F;
|
||||||
@ -2359,14 +2324,9 @@ public final class SlimefunItemSetup {
|
|||||||
}
|
}
|
||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
new ProgrammableAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_3_FISHERMAN, RecipeType.ENHANCED_CRAFTING_TABLE,
|
new FisherAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_3_FISHERMAN, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
new ItemStack[] {null, null, null, new ItemStack(Material.FISHING_ROD), SlimefunItems.PROGRAMMABLE_ANDROID_3, new ItemStack(Material.FISHING_ROD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
new ItemStack[] {null, null, null, new ItemStack(Material.FISHING_ROD), SlimefunItems.PROGRAMMABLE_ANDROID_3, new ItemStack(Material.FISHING_ROD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
||||||
|
|
||||||
@Override
|
|
||||||
public AndroidType getAndroidType() {
|
|
||||||
return AndroidType.FISHERMAN;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFuelEfficiency() {
|
public float getFuelEfficiency() {
|
||||||
return 1F;
|
return 1F;
|
||||||
@ -2380,14 +2340,9 @@ public final class SlimefunItemSetup {
|
|||||||
}
|
}
|
||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
new ProgrammableAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_3_BUTCHER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
new ButcherAndroid(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.PROGRAMMABLE_ANDROID_3_BUTCHER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER_3, null, new ItemStack(Material.DIAMOND_SWORD), SlimefunItems.PROGRAMMABLE_ANDROID_3, new ItemStack(Material.DIAMOND_SWORD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
new ItemStack[] {null, SlimefunItems.GPS_TRANSMITTER_3, null, new ItemStack(Material.DIAMOND_SWORD), SlimefunItems.PROGRAMMABLE_ANDROID_3, new ItemStack(Material.DIAMOND_SWORD), null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
||||||
|
|
||||||
@Override
|
|
||||||
public AndroidType getAndroidType() {
|
|
||||||
return AndroidType.FIGHTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFuelEfficiency() {
|
public float getFuelEfficiency() {
|
||||||
return 1F;
|
return 1F;
|
||||||
|
@ -129,7 +129,13 @@ public class Category implements Keyed {
|
|||||||
String name = SlimefunPlugin.getLocal().getCategoryName(p, getKey());
|
String name = SlimefunPlugin.getLocal().getCategoryName(p, getKey());
|
||||||
if (name == null) name = item.getItemMeta().getDisplayName();
|
if (name == null) name = item.getItemMeta().getDisplayName();
|
||||||
|
|
||||||
meta.setDisplayName(ChatColor.GREEN + name);
|
if (this instanceof SeasonalCategory) {
|
||||||
|
meta.setDisplayName(ChatColor.GOLD + name);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
meta.setDisplayName(ChatColor.YELLOW + name);
|
||||||
|
}
|
||||||
|
|
||||||
meta.setLore(Arrays.asList("", ChatColor.GRAY + "\u21E8 " + ChatColor.GREEN + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.open-category")));
|
meta.setLore(Arrays.asList("", ChatColor.GRAY + "\u21E8 " + ChatColor.GREEN + SlimefunPlugin.getLocal().getMessage(p, "guide.tooltips.open-category")));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
package me.mrCookieSlime.Slimefun.androids;
|
|
||||||
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
|
||||||
|
|
||||||
public enum ScriptPart {
|
|
||||||
|
|
||||||
// Start and End Parts
|
|
||||||
START(AndroidType.NONE, "ae29422db4047efdb9bac2cdae5a0719eb772fccc88a66d912320b343c341"),
|
|
||||||
REPEAT(AndroidType.NONE, "c8def67a12622ead1decd3d89364257b531896d87e469813131ca235b5c7"),
|
|
||||||
WAIT(AndroidType.NONE, "ee174f41e594e64ea3141c07daf7acf1fa045c230b2b0b0fb3da163db22f455"),
|
|
||||||
|
|
||||||
// Movement
|
|
||||||
GO_FORWARD(AndroidType.NON_FIGHTER, "9bf6db4aeda9d8822b9f736538e8c18b9a4844f84eb45504adfbfee87eb"),
|
|
||||||
GO_UP(AndroidType.NON_FIGHTER, "05a2cab8b68ea57e3af992a36e47c8ff9aa87cc8776281966f8c3cf31a38"),
|
|
||||||
GO_DOWN(AndroidType.NON_FIGHTER, "01586e39f6ffa63b4fb301b65ca7da8a92f7353aaab89d3886579125dfbaf9"),
|
|
||||||
|
|
||||||
//Directions
|
|
||||||
TURN_LEFT(AndroidType.NONE, "185c97dbb8353de652698d24b64327b793a3f32a98be67b719fbedab35e"),
|
|
||||||
TURN_RIGHT(AndroidType.NONE, "1c0ededd7115fc1b23d51ce966358b27195daf26ebb6e45a66c34c69c34091"),
|
|
||||||
|
|
||||||
// Action - Pickaxe
|
|
||||||
DIG_UP(AndroidType.MINER, "e6ce011ac9a7a75b2fcd408ad21a3ac1722f6e2eed8781cafd12552282b88"),
|
|
||||||
DIG_FORWARD(AndroidType.MINER, "6ea2135838461534372f2da6c862d21cd5f3d2c7119f2bb674bbd42791"),
|
|
||||||
DIG_DOWN(AndroidType.MINER, "d862024108c785bc0ef7199ec77c402dbbfcc624e9f41f83d8aed8b39fd13"),
|
|
||||||
|
|
||||||
MOVE_AND_DIG_UP(AndroidType.MINER, "e6ce011ac9a7a75b2fcd408ad21a3ac1722f6e2eed8781cafd12552282b88"),
|
|
||||||
MOVE_AND_DIG_FORWARD(AndroidType.MINER, "6ea2135838461534372f2da6c862d21cd5f3d2c7119f2bb674bbd42791"),
|
|
||||||
MOVE_AND_DIG_DOWN(AndroidType.MINER, "d862024108c785bc0ef7199ec77c402dbbfcc624e9f41f83d8aed8b39fd13"),
|
|
||||||
|
|
||||||
// Action - Sword
|
|
||||||
ATTACK_MOBS_ANIMALS(AndroidType.FIGHTER, "7e6c40f68b775f2efcd7bd9916b327869dcf27e24c855d0a18e07ac04fe1"),
|
|
||||||
ATTACK_MOBS(AndroidType.FIGHTER, "7e6c40f68b775f2efcd7bd9916b327869dcf27e24c855d0a18e07ac04fe1"),
|
|
||||||
ATTACK_ANIMALS(AndroidType.FIGHTER, "7e6c40f68b775f2efcd7bd9916b327869dcf27e24c855d0a18e07ac04fe1"),
|
|
||||||
ATTACK_ANIMALS_ADULT(AndroidType.FIGHTER, "7e6c40f68b775f2efcd7bd9916b327869dcf27e24c855d0a18e07ac04fe1"),
|
|
||||||
|
|
||||||
// Action - Axe
|
|
||||||
CHOP_TREE(AndroidType.WOODCUTTER, "4ba49384dba7b7acdb4f70e9361e6d57cbbcbf720cf4f16c2bb83e4557"),
|
|
||||||
|
|
||||||
// Action - Fishing Rod
|
|
||||||
CATCH_FISH(AndroidType.FISHERMAN, "d4fde511f4454101e4a2a72bc86f12985dfcda76b64bb24dc63a9fa9e3a3"),
|
|
||||||
|
|
||||||
// Action - Hoe
|
|
||||||
FARM_FORWARD(AndroidType.FARMER, "de9a522c3d9e7d85f3d82c375dc37fecc856dbd801eb3bcedc1165198bf"),
|
|
||||||
FARM_DOWN(AndroidType.FARMER, "d4296b333d25319af3f33051797f9e6d821cd19a014fb7137beb86a4e9e96"),
|
|
||||||
|
|
||||||
// Action - ExoticGarden
|
|
||||||
FARM_EXOTIC_FORWARD(AndroidType.ADVANCED_FARMER, "de9a522c3d9e7d85f3d82c375dc37fecc856dbd801eb3bcedc1165198bf"),
|
|
||||||
FARM_EXOTIC_DOWN(AndroidType.ADVANCED_FARMER, "d4296b333d25319af3f33051797f9e6d821cd19a014fb7137beb86a4e9e96"),
|
|
||||||
|
|
||||||
// Action - Interface
|
|
||||||
INTERFACE_ITEMS(AndroidType.NONE, "0a4dbf6625c42be57a8ba2c330954a76bdf22785540e87a5c9672685238ec"),
|
|
||||||
INTERFACE_FUEL(AndroidType.NONE, "432f5282a50745b912be14deda581bd4a09b977a3c32d7e9578491fee8fa7");
|
|
||||||
|
|
||||||
|
|
||||||
private final ItemStack item;
|
|
||||||
private final AndroidType type;
|
|
||||||
|
|
||||||
private ScriptPart(AndroidType type, String texture) {
|
|
||||||
this.type = type;
|
|
||||||
this.item = SkullItem.fromHash(texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getItem() {
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AndroidType getRequiredType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user