Skip to content

Commit

Permalink
Bow update
Browse files Browse the repository at this point in the history
- Ajouts des nouveaux arcs côté serveur
- Déduplication du code côté client
  • Loading branch information
Dabsunter committed Jul 13, 2017
1 parent 6d66cc0 commit 0f8aebc
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
5 changes: 4 additions & 1 deletion PaperSpigot-API/src/main/java/org/bukkit/Material.java
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,10 @@ public enum Material {
DIAMOND_GLOBAL_TOOL(559, 1, 1561),
PEPPERS_ITEM(560),
UNCLAIM_FINDER(561),
//TODO: Ajouter les arcs
ZINC_BOW(562, 1, 784),
CRONYXE_BOW(563, 1, 884),
KOBALT_BOW(564, 1, 984),
ELDARIUM_BOW(565, 1, 1084),
ELDARIUM_NUGGET(566),
MILK_DONUT(567),
CHOCOLATE_DONUT(568),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ public static void l() {
REGISTRY.a(id++, "diamond_global_tool", new ItemGlobalTool(EnumToolMaterial.DIAMOND).c("gtoolDiamond").setTextureName("diamond_global_tool"));
REGISTRY.a(id++, "pepper", new ItemSeedFood(4, 0.6F, Blocks.PEPPERS, Blocks.SOIL).j().a(12, 360, 0, 1.0F).e(PotionBrewer.hasteEffect).c("peppers").setTextureName("peppers"));
REGISTRY.a(id++, "unclaim_finder", new Item().c("unclaimFinder").a(CreativeModeTab.f).setTextureName("unclaim_finder"));
id += 4; //TODO: Ajouter les arcs
REGISTRY.a(id++, "zinc_bow", new ItemBow().setArrowDamage(7.0).setMaxDurability(784).c("bowZinc").setTextureName("bow_zinc"));
REGISTRY.a(id++, "cronyxe_bow", new ItemBow().setArrowDamage(8.0).setMaxDurability(884).c("bowCronyxe").setTextureName("bow_cronyxe"));
REGISTRY.a(id++, "kobalt_bow", new ItemBow().setArrowDamage(9.0).setMaxDurability(984).c("bow_kobalt").setTextureName("bow_kobalt"));
REGISTRY.a(id++, "eldarium_bow", new ItemBow().setArrowDamage(10.0).setMaxDurability(1084).c("bowEldarium").setTextureName("bow_eldarium"));
REGISTRY.a(id++, "eldarium_nugget", new Item().c("eldariumNugget").setTextureName("eldarium_nugget").a(CreativeModeTab.l));
REGISTRY.a(id++, "milk_donut", new ItemFood(10, false).j().c("donutMilk").setTextureName("milk_donut"));
REGISTRY.a(id++, "chocolate_donut", new ItemFood(11, false).j().a(5, 360, 0, 1.0F).c("donutChoc").setTextureName("chocolate_donut"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ public class ItemBow extends Item {

public static final String[] a = new String[] { "pulling_0", "pulling_1", "pulling_2"};

private double arrowDamage = 2.0;
private int arrowKnockback = 0;

public ItemBow() {
this.maxStackSize = 1;
this.setMaxDurability(384);
Expand All @@ -29,6 +32,9 @@ public void a(ItemStack itemstack, World world, EntityHuman entityhuman, int i)
}

EntityArrow entityarrow = new EntityArrow(world, entityhuman, f * 2.0F);
// Eldaria - apply custom values
entityarrow.b(arrowDamage);
entityarrow.knockbackStrength = arrowKnockback;

if (f == 1.0F) {
entityarrow.setCritical(true);
Expand All @@ -43,7 +49,7 @@ public void a(ItemStack itemstack, World world, EntityHuman entityhuman, int i)
int l = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, itemstack);

if (l > 0) {
entityarrow.setKnockbackStrength(l);
entityarrow.setKnockbackStrength(entityarrow.knockbackStrength + l);
}

if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, itemstack) > 0) {
Expand Down Expand Up @@ -106,4 +112,22 @@ public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
public int c() {
return 1;
}

public double getArrowDamage() {
return arrowDamage;
}

public ItemBow setArrowDamage(double arrowDamage) {
this.arrowDamage = arrowDamage;
return this;
}

public int getArrowKnockback() {
return arrowKnockback;
}

public ItemBow setArrowKnockback(int arrowKnockback) {
this.arrowKnockback = arrowKnockback;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ public class Items
public static final Item TOMAHAWK = (Item)Item.REGISTRY.get("tomahawk");
public static final Item CHEST_ORB = (Item)Item.REGISTRY.get("chest_orb");
public static final Item PEPPER = (Item)Item.REGISTRY.get("pepper");
//TODO: ajouter les arcs
public static final Item ZINC_BOW = (Item)Item.REGISTRY.get("zinc_bow");
public static final Item CRONYXE_BOW = (Item)Item.REGISTRY.get("cronyxe_bow");
public static final Item KOBALT_BOW = (Item)Item.REGISTRY.get("kobalt_bow");
public static final Item ELDARIUM_BOW = (Item)Item.REGISTRY.get("eldarium_bow");
public static final Item ELDARIUM_NUGGET = (Item)Item.REGISTRY.get("eldarium_nugget");
public static final Item wooden_global_tool = (Item)Item.REGISTRY.get("wooden_global_tool");
public static final Item iron_global_tool = (Item)Item.REGISTRY.get("iron_global_tool");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,14 @@ public void a(CraftingManager craftingmanager) {

craftingmanager.registerShapedRecipe(new ItemStack(Items.BOW, 1), new Object[] { " #X", "# X", " #X", Character.valueOf('X'), Items.STRING, Character.valueOf('#'), Items.STICK});
craftingmanager.registerShapedRecipe(new ItemStack(Items.ARROW, 4), new Object[] { "X", "#", "Y", Character.valueOf('Y'), Items.FEATHER, Character.valueOf('X'), Items.FLINT, Character.valueOf('#'), Items.STICK});

// --- Arcs Eldaria ---

craftingmanager.registerShapedRecipe(new ItemStack(Items.ZINC_BOW), " #X", "# X", " #X", 'X', Items.STRING, '#', Items.ZINC);
craftingmanager.registerShapedRecipe(new ItemStack(Items.CRONYXE_BOW), " #X", "# X", " #X", 'X', Items.STRING, '#', Items.CRONYXE);
craftingmanager.registerShapedRecipe(new ItemStack(Items.KOBALT_BOW), " #X", "# X", " #X", 'X', Items.STRING, '#', Items.KOBALT);
craftingmanager.registerShapedRecipe(new ItemStack(Items.ELDARIUM_BOW), " #X", "# X", " #X", 'X', Items.STRING, '#', Items.ELDARIUM);

// --------------------
}
}

0 comments on commit 0f8aebc

Please sign in to comment.