Skip to content

Commit

Permalink
Loot Drop rates lowered
Browse files Browse the repository at this point in the history
Loot table now allows for enchanted items
Storm status effect will now only spawn lightning if distance to player is more than 5 blocks. Storm radius increased by 5 blocks in all directions to compensate
Rapier speed amplifier reduced to 1 from 3
The Watcher has had its attack speed reduced by .1
Brimstone Claymore has had its attack range increased
  • Loading branch information
Sweenus committed Aug 19, 2022
1 parent 8034412 commit 65d5c99
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public static void init() {
INT_OPTIONS.put("plague_chance", 15);


FLOAT_OPTIONS.put("standard_loot_table_weight", 0.1f);
FLOAT_OPTIONS.put("rare_loot_table_weight", 0.05f);
FLOAT_OPTIONS.put("unique_loot_table_weight", 0.005f);
FLOAT_OPTIONS.put("standard_loot_table_weight", 0.08f);
FLOAT_OPTIONS.put("rare_loot_table_weight", 0.008f);
FLOAT_OPTIONS.put("unique_loot_table_weight", 0.002f);
FLOAT_OPTIONS.put("omen_absorption_amount", 1f);
FLOAT_OPTIONS.put("watcher_restore_amount", 0.5f);
}
Expand Down
22 changes: 14 additions & 8 deletions src/main/java/net/sweenus/simplyswords/effect/StormEffect.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
package net.sweenus.simplyswords.effect;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.client.render.entity.LightningEntityRenderer;
import net.minecraft.entity.*;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.minecraft.predicate.entity.EntityPredicates;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;
import net.sweenus.simplyswords.config.SimplySwordsConfig;

public class StormEffect extends StatusEffect {
public StormEffect(StatusEffectCategory statusEffectCategory, int color) {super (statusEffectCategory, color); }

@Override
public void applyUpdateEffect(LivingEntity pLivingEntity, int pAmplifier) {
if (!pLivingEntity.world.isClient()) {
Expand All @@ -24,15 +23,20 @@ public void applyUpdateEffect(LivingEntity pLivingEntity, int pAmplifier) {
double y = pLivingEntity.getY();
double z = pLivingEntity.getZ();
var pPlayer = pLivingEntity.getAttacker();
Box box = new Box(x + 10, y +5, z + 10, x - 10, y - 5, z - 10);
Box box = new Box(x + 15, y +5, z + 15, x - 15, y - 5, z - 15);

//for(Entity e: world.getEntitiesByType(pLivingEntity.getType(), box, EntityPredicates.VALID_ENTITY))
for(Entity e: world.getOtherEntities(pPlayer, box, EntityPredicates.VALID_ENTITY))
for(Entity e: world.getOtherEntities(pPlayer, box, EntityPredicates.VALID_LIVING_ENTITY))
{
if (e != null) {
if (e.isTouchingWaterOrRain()) {
var stormtarget = e.getBlockPos();
Entity storm = EntityType.LIGHTNING_BOLT.spawn(world, null, null, null, stormtarget, SpawnReason.TRIGGERED, true, true);
if (e.distanceTo(pPlayer) >= 5 ){
Entity storm = EntityType.LIGHTNING_BOLT.spawn(world, null, null, null, stormtarget, SpawnReason.TRIGGERED, true, true);
}
//e.damage(DamageSource.LIGHTNING_BOLT, 5f);


}
}
}
Expand All @@ -43,6 +47,8 @@ public void applyUpdateEffect(LivingEntity pLivingEntity, int pAmplifier) {

}



@Override
public boolean canApplyUpdateEffect(int pDuration, int pAmplifier) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/sweenus/simplyswords/item/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public class ModItems {
new FabricItemSettings().group(ModItemGroup.SIMPLYSWORDS).rarity(Rarity.EPIC)));

public static final Item WATCHER_CLAYMORE = registerItem( "watcher_claymore",
new WatcherSwordItem(ToolMaterials.NETHERITE, 6, -2.7f,
new WatcherSwordItem(ToolMaterials.NETHERITE, 6, -2.8f,
new FabricItemSettings().group(ModItemGroup.SIMPLYSWORDS).rarity(Rarity.EPIC)));

public static final Item STORMS_EDGE = registerItem( "storms_edge",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package net.sweenus.simplyswords.item.custom;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LightningEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.Packet;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text;
import net.minecraft.world.World;
import net.sweenus.simplyswords.item.ModItems;

public class SafeLightning extends Entity {

public SafeLightning(EntityType<?> type, World world) {
super(type, world);
}

@Override
protected void initDataTracker() {

}

@Override
protected void readCustomDataFromNbt(NbtCompound nbt) {

}

@Override
protected void writeCustomDataToNbt(NbtCompound nbt) {

}

@Override
public void onStruckByLightning(ServerWorld world, LightningEntity lightning) {
/*this.setFireTicks(this.fireTicks + 1);
if (this.fireTicks == 0) {
this.setOnFireFor(8);
}*/

var equips = getItemsEquipped();
if (equips == ModItems.STORMS_EDGE) {
this.damage(DamageSource.LIGHTNING_BOLT, 0.0F);
this.sendMessage(Text.translatable("message.simplyswords.testlightning"));
}
}

@Override
public Packet<?> createSpawnPacket() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack
int sduration = SimplySwordsConfig.getIntValue("speed_duration");

if (attacker.getRandom().nextInt(100) <= shitchance) {
attacker.addStatusEffect(new StatusEffectInstance(StatusEffects.SPEED, sduration, 3), attacker);
attacker.addStatusEffect(new StatusEffectInstance(StatusEffects.SPEED, sduration, 1), attacker);
}

return super.postHit(stack, target, attacker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;
Expand All @@ -22,7 +23,7 @@ public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attack
int phitchance = SimplySwordsConfig.getIntValue("storm_chance");

if (attacker.getRandom().nextInt(100) <= phitchance) {
target.addStatusEffect(new StatusEffectInstance(ModEffects.STORM, 1, 1), attacker);
target.addStatusEffect(new StatusEffectInstance(ModEffects.STORM, 2, 1), attacker);
}

return super.postHit(stack, target, attacker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import net.fabricmc.fabric.api.loot.v2.LootTableEvents;
import net.minecraft.loot.LootPool;
import net.minecraft.loot.function.EnchantRandomlyLootFunction;
import net.minecraft.loot.function.EnchantWithLevelsLootFunction;
import net.minecraft.loot.function.LootFunction;
import net.sweenus.simplyswords.config.SimplySwordsConfig;
import net.sweenus.simplyswords.item.ModItems;
import net.minecraft.loot.condition.RandomChanceLootCondition;
Expand Down Expand Up @@ -47,6 +50,7 @@ public static void modifyLootTables() {
LootPool.Builder pool = LootPool.builder()
.rolls(ConstantLootNumberProvider.create(1))
.conditionally(RandomChanceLootCondition.builder(SimplySwordsConfig.getFloatValue("standard_loot_table_weight"))) // 1 = 100% of the time
.apply(EnchantRandomlyLootFunction.builder())
.with(ItemEntry.builder(ModItems.IRON_LONGSWORD))
.with(ItemEntry.builder(ModItems.IRON_TWINBLADE))
.with(ItemEntry.builder(ModItems.IRON_RAPIER))
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/simplyswords/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

"itemGroup.simplyswords.simplyswords": "Simply Swords",

"message.simplyswords.testlightning": "We have not been damaged",


"effect.simplyswords.freeze": "Freeze",
"effect.simplyswords.burn": "Brimstone",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"parent": "bettercombat:heavy_axe",
"attributes" : {
"pose": "bettercombat:pose_two_handed_sword",
"attack_range": 3.5,
"category": "claymore",
"two_handed": true,
"attacks": [
Expand Down

0 comments on commit 65d5c99

Please sign in to comment.