Skip to content

Commit

Permalink
4.1.3 offical
Browse files Browse the repository at this point in the history
  • Loading branch information
tcfplayz committed Nov 15, 2023
1 parent 00ffac2 commit ba1bc27
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ fabric_version=0.90.4+1.20.1
JDA_version=5.0.0-beta.17
placeholder_version=2.1.3+1.20.1

mod_version=4.1.2
mod_version=4.1.3
maven_group=ml.spmc
archives_base_name=SMPMod
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,42 @@ private static void tree(ServerWorld world, PlayerEntity player, BlockState stat
world.spawnEntity(entity);
player.sendMessage(Text.literal("The gods of the trees has decided to strike you...").formatted(Formatting.DARK_RED));
if (UtilClass.probabilityCalc(5, player)) {
ItemStack item = new ItemStack(Items.LEATHER_CHESTPLATE, 1);
item.getOrCreateSubNbt("display").putInt("color", 0);
item.getOrCreateSubNbt("Trim").putString("material", "minecraft:diamond");
item.getOrCreateSubNbt("Trim").putString("pattern", "minecraft:silence");
item.addEnchantment(Enchantments.PROTECTION, 8);
item.addEnchantment(Enchantments.UNBREAKING, 10);
player.getInventory().setStack(player.getInventory().getEmptySlot(), item);
player.sendMessage(Text.literal("It seems like you have been struck by the gods, so here's a chestplate for you!").formatted(Formatting.BLUE));
double random = player.getRandom().nextDouble();
if (random >= 0.75) {
ItemStack item = new ItemStack(Items.LEATHER_HELMET, 1);
treeTreasure(player, item);
player.sendMessage(Text.literal("It seems like you have been struck by the gods, so here's a helmet for you!").formatted(Formatting.BLUE));
} else if (random < 0.75 && random >= 0.5) {
ItemStack item = new ItemStack(Items.LEATHER_CHESTPLATE, 1);
treeTreasure(player, item);
player.sendMessage(Text.literal("It seems like you have been struck by the gods, so here's a chestplate for you!").formatted(Formatting.BLUE));

} else if (random < 0.5 && random >= 0.25) {
ItemStack item = new ItemStack(Items.LEATHER_LEGGINGS, 1);
treeTreasure(player, item);
player.sendMessage(Text.literal("It seems like you have been struck by the gods, so here's leggings for you!").formatted(Formatting.BLUE));

} else {
ItemStack item = new ItemStack(Items.LEATHER_BOOTS, 1);
treeTreasure(player, item);
player.sendMessage(Text.literal("It seems like you have been struck by the gods, so here's boots for you!").formatted(Formatting.BLUE));

}
}
}
}
}
}

private static void treeTreasure(PlayerEntity player, ItemStack item) {
item.getOrCreateSubNbt("display").putInt("color", 0);
item.getOrCreateSubNbt("Trim").putString("material", "minecraft:diamond");
item.getOrCreateSubNbt("Trim").putString("pattern", "minecraft:silence");
item.addEnchantment(Enchantments.PROTECTION, 8);
item.addEnchantment(Enchantments.UNBREAKING, 10);
player.getInventory().setStack(player.getInventory().getEmptySlot(), item);
}

private static void treasure(ServerWorld world, PlayerEntity player, BlockState state, BlockPos pos) {
if (!(player.isCreative() || player.isInLava() || player.isClimbing())) {
Block block = state.getBlock();
Expand Down

0 comments on commit ba1bc27

Please sign in to comment.