Skip to content

Commit

Permalink
增强屠刀,增加触手钉锤以及掉落
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicHarp committed Oct 13, 2024
1 parent 06c51df commit dfeb6bb
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,7 @@ protected void addTranslations() {
add(Swords.LIGHTS_BANE.get(), "魔光剑");
add(Swords.BLOOD_BUTCHERER.get(), "血腥屠刀");
add(Swords.KATANA.get(), "武士刀");
add(Swords.TENTACLE_MACE.get(), "触手钉锤");
add(Swords.ICE_BLADE.get(), "冰雪剑");
add(Swords.EXOTIC_SCIMITAR.get(), "异域弯刀");
add(Swords.FAKE_SWORD.get(), "假剑");
Expand Down Expand Up @@ -2069,6 +2070,7 @@ protected void addTranslations() {
add(ModEffects.POTION_SICKNESS.get(), "耐药性");
add(ModEffects.CEREBRAL_MINDTRICK.get(), "控脑术");
add(ModEffects.BLOOD_BUTCHERED.get(), "血腥屠宰");
add(ModEffects.TENTACLE_SPIKES.get(), "触手钉刺");
add(ModEffects.BROKEN_ARMOR.get(), "破损盔甲");
add(ModEffects.STONED.get(), "石化");
// 雕像
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/confluence/mod/effect/ModEffects.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public final class ModEffects {
public static final RegistryObject<ShineEffect> SHINE = EFFECTS.register("shine", ShineEffect::new);
public static final RegistryObject<ShimmerEffect> SHIMMER = EFFECTS.register("shimmer", ShimmerEffect::new);
public static final RegistryObject<BloodButcheredEffect> BLOOD_BUTCHERED = EFFECTS.register("blood_butchered", BloodButcheredEffect::new);
public static final RegistryObject<TentacleSpikesEffect> TENTACLE_SPIKES = EFFECTS.register("tentacle_spikes", TentacleSpikesEffect::new);
public static final RegistryObject<MobEffect> SPELUNKER = EFFECTS.register("spelunker", ()->new NormalEffect(MobEffectCategory.BENEFICIAL, Color.yellow.getRGB()));
public static final RegistryObject<MobEffect> HUNTER = EFFECTS.register("hunter", ()->new NormalEffect(MobEffectCategory.BENEFICIAL, Color.orange.getRGB()));
public static final RegistryObject<MobEffect> DANGER_SENSE = EFFECTS.register("danger_sense", ()->new NormalEffect(MobEffectCategory.BENEFICIAL, Color.PINK.getRGB()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void applyEffectTick(@NotNull LivingEntity pLivingEntity, int pAmplifier)

if (tickCount % 35 == 0){
tickCount = 0;
damage = pAmplifier + 2.0F;
damage = pAmplifier + 4.0F;
pLivingEntity.hurt(pLivingEntity.level().damageSources().magic(), damage);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.confluence.mod.effect.harmful;

import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectCategory;
import net.minecraft.world.entity.LivingEntity;
import org.jetbrains.annotations.NotNull;

public class TentacleSpikesEffect extends MobEffect {
private static int tickCount = 0;

public TentacleSpikesEffect() {
super(MobEffectCategory.HARMFUL, 0xFF0000);
}

@Override
public void applyEffectTick(@NotNull LivingEntity pLivingEntity, int pAmplifier) {
float damage;

if (tickCount % 35 == 0){
tickCount = 0;
damage = pAmplifier + 2.0F;
pLivingEntity.hurt(pLivingEntity.level().damageSources().magic(), damage);
}

++tickCount;

}

@Override
public boolean isDurationEffectTick(int pDuration, int pAmplifier) {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public static AttributeSupplier.Builder createAttributes() {
.add(Attributes.MOVEMENT_SPEED, 0.38) // 移动速度
.add(Attributes.FOLLOW_RANGE, 32) // 跟随距离
.add(Attributes.SPAWN_REINFORCEMENTS_CHANCE, 0.01) // 召唤物品的几率
.add(Attributes.KNOCKBACK_RESISTANCE, 0.5); // 击退抗性
.add(Attributes.KNOCKBACK_RESISTANCE, 0.8); // 击退抗性
}
public static boolean checkBloodCrawlerSpawn(EntityType<? extends BloodCrawler> type, LevelAccessor pLevel, MobSpawnType pSpawnType, BlockPos pPos, RandomSource pRandom) {
if (!(pLevel instanceof Level level)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static AttributeSupplier.Builder createAttributes() {
.add(Attributes.MAX_HEALTH, 100.0)
.add(Attributes.FOLLOW_RANGE, 32) // 跟随距离
.add(Attributes.SPAWN_REINFORCEMENTS_CHANCE, 0.01) // 召唤物品的几率
.add(Attributes.KNOCKBACK_RESISTANCE, 1); // 击退抗性
.add(Attributes.KNOCKBACK_RESISTANCE, 0.8); // 击退抗性
}

@Override
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/org/confluence/mod/event/ForgeEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
import org.confluence.mod.item.sword.BloodButchereSword;
import org.confluence.mod.item.sword.BreathingReed;
import org.confluence.mod.item.sword.DeveloperSword;
import org.confluence.mod.item.sword.TentacleMaceSword;
import org.confluence.mod.misc.ModAttributes;
import org.confluence.mod.misc.ModConfigs;
import org.confluence.mod.misc.ModDamageTypes;
Expand Down Expand Up @@ -306,6 +307,19 @@ public static void livingHeal(LivingHealEvent event) {
public static void livingAttack(LivingAttackEvent event) {
DamageSource damageSource = event.getSource();
LivingEntity damagingEntity = event.getEntity();
if (damageSource.getEntity() instanceof LivingEntity livingEntity) {
if (livingEntity.getItemInHand(event.getEntity().getUsedItemHand()).getItem() instanceof TentacleMaceSword) {
if (damagingEntity.hasEffect(ModEffects.TENTACLE_SPIKES.get())) {
if (damagingEntity.getEffect(ModEffects.TENTACLE_SPIKES.get()).getAmplifier() < 4) {
damagingEntity.addEffect(new MobEffectInstance(ModEffects.TENTACLE_SPIKES.get(), 180, damagingEntity.getEffect(ModEffects.TENTACLE_SPIKES.get()).getAmplifier() + 1, false, false, false));
} else {
damagingEntity.addEffect(new MobEffectInstance(ModEffects.TENTACLE_SPIKES.get(), 180, 4, false, false, false));
}
} else {
damagingEntity.addEffect(new MobEffectInstance(ModEffects.TENTACLE_SPIKES.get(), 180, 0, false, false, false));
}
}
}
if (damageSource.getEntity() instanceof LivingEntity livingEntity) {
if (livingEntity.getItemInHand(event.getEntity().getUsedItemHand()).getItem() instanceof BloodButchereSword) {
if (damagingEntity.hasEffect(ModEffects.BLOOD_BUTCHERED.get())) {
Expand Down Expand Up @@ -346,6 +360,8 @@ public static void livingAttack(LivingAttackEvent event) {
}
}



@SubscribeEvent
public static void onLivingDamage(LivingDamageEvent event) {
LivingEntity damagingEntity = event.getEntity();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/confluence/mod/item/sword/Swords.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public enum Swords implements EnumRegister<SwordItem> {
STYLISH_SCISSORS("stylish_scissors", () -> new RegularBroadSwordItem(ModTiers.TITANIUM, 3, -1.2F, new Item.Properties().rarity(ModRarity.GREEN))),
EXOTIC_SCIMITAR("exotic_scimitar", () -> new ReversalBoardSwordItem(ModTiers.TITANIUM, 5, -0.3F, new Item.Properties().rarity(ModRarity.GREEN))),
KATANA("katana", () -> new BigRegularBroadSwordItem(ModTiers.TITANIUM, 4, -0.3F, new Item.Properties().rarity(ModRarity.BLUE))),
TENTACLE_MACE("tentacle_mace", () -> new TentacleMaceSword(ModTiers.TITANIUM, 5, -0.3F, new Item.Properties().rarity(ModRarity.GREEN))),


CROWBAR("crowbar", CrowbarItem::new),
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/org/confluence/mod/item/sword/TentacleMaceSword.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.confluence.mod.item.sword;

import net.minecraft.world.item.SwordItem;
import net.minecraft.world.item.Tier;
import org.confluence.mod.datagen.limit.CustomItemModel;
import org.confluence.mod.datagen.limit.Image24x;
import org.confluence.mod.datagen.limit.ReversalImage16x;

public class TentacleMaceSword extends SwordItem implements ReversalImage16x {
public TentacleMaceSword(Tier tier, int rawDamage, float rawSpeed, Properties properties) {
super(tier, rawDamage, rawSpeed, properties);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,29 @@
"weight": 67
}
]
},
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "confluence:tentacle_mace",
"weight": 19,
"functions": [
{
"function": "set_count",
"count": {
"min": 1,
"max": 1
}
}
]
},
{
"type": "minecraft:empty",
"weight": 9981
}
]
}
],
"random_sequence": "confluence:entity/blood_crawler"
Expand Down

0 comments on commit dfeb6bb

Please sign in to comment.