Skip to content

Commit

Permalink
Merge branch '1.20.x' of https://github.com/Uraneptus/Sullys-Mod into…
Browse files Browse the repository at this point in the history
… 1.20.x
  • Loading branch information
KekeCreations committed Jan 5, 2024
2 parents 18c8137 + ba3a084 commit f523dbe
Show file tree
Hide file tree
Showing 21 changed files with 190 additions and 19 deletions.
5 changes: 5 additions & 0 deletions src/generated/resources/assets/sullysmod/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
"block.sullysmod.waxed_oxidized_copper_button": "Waxed Oxidized Copper Button",
"block.sullysmod.waxed_weathered_copper_button": "Waxed Weathered Copper Button",
"block.sullysmod.weathered_copper_button": "Weathered Copper Button",
"death.attack.throwing_knife": "%1$s got pierced from a distance",
"death.attack.throwing_knife.player": "%1$s got shanked by %2$s",
"death.attack.tortoise_shell": "%1$s took a Tortoise Shell to the knees",
"death.attack.tortoise_shell.player": "%1$s got bonked to death",
"entity.sullysmod.bouldering_zombie": "Bouldering Zombie",
Expand Down Expand Up @@ -115,6 +117,9 @@
"subtitles.entity.tortoise.hurt_baby": "Tortoise baby hurts",
"subtitles.entity.tortoise_shell.place": "Tortoise Shell placed",
"subtitles.entity.zombie.destroy_egg": "Egg stomped",
"subtitles.item.throwing_knife.hit": "Knife hits entity",
"subtitles.item.throwing_knife.hit_ground": "Knife hits ground",
"subtitles.item.throwing_knife.throw": "Knife flies",
"subtitles.item.vial.fill": "Vial fills",
"subtitles.item.vial.shatter": "Vial shatters",
"sullysmod.jei.grindstone_polishing": "Polishing",
Expand Down
23 changes: 23 additions & 0 deletions src/generated/resources/assets/sullysmod/sounds.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,29 @@
],
"subtitle": "subtitles.entity.tortoise_shell.place"
},
"item.throwing_knife.hit": {
"sounds": [
"sullysmod:item/throwing_knife/hit1",
"sullysmod:item/throwing_knife/hit2",
"sullysmod:item/throwing_knife/hit3"
],
"subtitle": "subtitles.item.throwing_knife.hit"
},
"item.throwing_knife.hit_ground": {
"sounds": [
"sullysmod:item/throwing_knife/hit1",
"sullysmod:item/throwing_knife/hit2",
"sullysmod:item/throwing_knife/hit3"
],
"subtitle": "subtitles.item.throwing_knife.hit_ground"
},
"item.throwing_knife.throw": {
"sounds": [
"sullysmod:item/throwing_knife/throw1",
"sullysmod:item/throwing_knife/throw2"
],
"subtitle": "subtitles.item.throwing_knife.throw"
},
"item.vial.fill": {
"sounds": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"exhaustion": 0.0,
"message_id": "throwing_knife",
"scaling": "when_caused_by_living_non_player"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"modifiers": [
{
"type": "entries",
"config": {
"entries": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:any_of",
"terms": [
{
"condition": "minecraft:location_check",
"predicate": {
"biome": "minecraft:mangrove_swamp"
}
},
{
"condition": "minecraft:location_check",
"predicate": {
"biome": "minecraft:jungle"
}
},
{
"condition": "minecraft:location_check",
"predicate": {
"biome": "minecraft:sparse_jungle"
}
},
{
"condition": "minecraft:location_check",
"predicate": {
"biome": "minecraft:bamboo_jungle"
}
}
]
}
],
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 1.0,
"min": 1.0
},
"function": "minecraft:set_count"
}
],
"name": "sullysmod:piranha",
"weight": 40
}
],
"index": 0,
"replace": false
}
}
],
"priority": "normal",
"selector": "minecraft:gameplay/fishing/fish"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"values": [
"minecraft:bee",
"minecraft:parrot",
"minecraft:bat",
"minecraft:wither",
"minecraft:ender_dragon",
"minecraft:ghast",
"minecraft:vex",
"minecraft:phantom",
"minecraft:allay",
"minecraft:blaze"
]
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
package com.uraneptus.sullysmod.common.entities;

import com.uraneptus.sullysmod.core.other.tags.SMEntityTags;
import com.uraneptus.sullysmod.core.registry.SMDamageTypes;
import com.uraneptus.sullysmod.core.registry.SMEntityTypes;
import com.uraneptus.sullysmod.core.registry.SMItems;
import com.uraneptus.sullysmod.core.registry.SMSounds;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LightningBolt;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.control.FlyingMoveControl;
import net.minecraft.world.entity.ai.navigation.FlyingPathNavigation;
import net.minecraft.world.entity.animal.FlyingAnimal;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.item.ItemStack;
Expand All @@ -25,7 +28,6 @@

import javax.annotation.Nullable;

//TODO reduce hitbox
public class ThrownThrowingKnife extends AbstractArrow {
private ItemStack knifeItem = new ItemStack(SMItems.THROWING_KNIFE.get());

Expand Down Expand Up @@ -53,13 +55,13 @@ public ItemStack getPickupItem() {
protected void onHitEntity(EntityHitResult pResult) {
Entity entity = pResult.getEntity();
float f = 2.0F;
if (entity instanceof LivingEntity livingentity) {
f += EnchantmentHelper.getDamageBonus(this.knifeItem, livingentity.getMobType());
if (entity.getType().is(SMEntityTags.IS_FLYING_MOB) || (entity instanceof Mob mob && (mob.getNavigation() instanceof FlyingPathNavigation || mob instanceof FlyingMob || mob instanceof FlyingAnimal))) {
f += 4.0F;
}

Entity owner = this.getOwner();
DamageSource damagesource = this.damageSources().trident(this, owner == null ? this : owner); //TODO add own damagesource
SoundEvent soundevent = SoundEvents.TRIDENT_HIT; //TODO change sound
DamageSource damagesource = this.damageSources().source(SMDamageTypes.THROWING_KNIFE, this, owner == null ? this : owner);
SoundEvent soundevent = SMSounds.THROWING_KNIFE_HIT.get();
if (entity.hurt(damagesource, f)) {
if (entity.getType() == EntityType.ENDERMAN) {
return;
Expand All @@ -81,7 +83,7 @@ protected void onHitEntity(EntityHitResult pResult) {

@Override
protected SoundEvent getDefaultHitGroundSoundEvent() {
return SoundEvents.TRIDENT_HIT_GROUND; //TODO add own sound
return SMSounds.THROWING_KNIFE_HIT_GROUND.get();
}

@Override
Expand All @@ -100,7 +102,7 @@ public void addAdditionalSaveData(CompoundTag pCompound) {

@Override
protected float getWaterInertia() {
return 0.7F; //This is how projectiles moves through water
return 0.7F;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import com.uraneptus.sullysmod.common.entities.ThrownThrowingKnife;
import com.uraneptus.sullysmod.core.registry.SMSounds;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -46,7 +47,7 @@ public void initializeClient(Consumer<IClientItemExtensions> consumer) {

private static final HumanoidModel.ArmPose THROWING_KNIFE_POSE = HumanoidModel.ArmPose.create("THROWING_KNIFE", false, (model, entity, arm) -> {
if (arm == HumanoidArm.RIGHT) {
model.rightArm.xRot = (model.rightArm.xRot - 2.5F) + (model.head.xRot + 0.5F);
model.rightArm.xRot = (model.rightArm.xRot - 2.8F) + (model.head.xRot + 0.5F);
model.rightArm.yRot = 0.0F + (model.head.yRot + 0.13F);
} else {
model.leftArm.xRot = (model.leftArm.xRot - 2.5F) + (model.head.xRot + 0.5F);
Expand All @@ -73,10 +74,10 @@ public boolean applyForgeHandTransform(PoseStack poseStack, LocalPlayer player,
poseStack.translate(i * 0.56F, -0.52F + equipProcess * -0.6F, -0.72F);
if (player.isUsingItem()) {
ItemStack stack = player.getUseItem();
poseStack.translate(i * -0.28F, 0.55F, 0.07F);
poseStack.translate(i * -0.33F, 0.55F, 0.07F);
poseStack.mulPose(Axis.XP.rotationDegrees(23.0F));
poseStack.mulPose(Axis.YP.rotationDegrees(i * 20.0F));
poseStack.mulPose(Axis.ZP.rotationDegrees(i * 10.0F));
poseStack.mulPose(Axis.YP.rotationDegrees(i * 48.0F));
poseStack.mulPose(Axis.ZP.rotationDegrees(i * 13.0F));
//Rest is copied from trident item rendenderer so don't ask me what all the 'f' variables mean! Idk either
float drawDuration = (float)stack.getUseDuration() - ((float)player.getUseItemRemainingTicks() - partialTick + 1.0F);
float f11 = drawDuration / 10.0F;
Expand Down Expand Up @@ -117,7 +118,7 @@ public void releaseUsing(ItemStack pStack, Level pLevel, LivingEntity pEntityLiv
thrownThrowingKnife.pickup = AbstractArrow.Pickup.CREATIVE_ONLY;
}
pLevel.addFreshEntity(thrownThrowingKnife);
pLevel.playSound(null, thrownThrowingKnife, SoundEvents.TRIDENT_THROW, SoundSource.PLAYERS, 1.0F, 1.0F); //TODO change sound
pLevel.playSound(null, thrownThrowingKnife, SMSounds.THROWING_KNIFE_THROW.get(), SoundSource.PLAYERS, 1.0F, 1.0F);
if (!player.getAbilities().instabuild) {
pStack.shrink(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,16 @@ protected void addTranslations() {
add("subtitles.entity.bouldering_zombie.hurt", "Bouldering Zombie hurts");
add("subtitles.entity.bouldering_zombie.death", "Bouldering Zombie dies");

add("subtitles.item.throwing_knife.hit", "Knife hits entity");
add("subtitles.item.throwing_knife.hit_ground", "Knife hits ground");
add("subtitles.item.throwing_knife.throw", "Knife flies");

//Other
SMTextUtil.TRANSLATABLES.forEach(this::add);
add("death.attack.tortoise_shell", "%1$s took a Tortoise Shell to the knees");
add("death.attack.tortoise_shell.player", "%1$s got bonked to death");

add("death.attack.throwing_knife", "%1$s got pierced from a distance");
add("death.attack.throwing_knife.player", "%1$s got shanked by %2$s"); //Not quite sure about this one yet?
}

protected void addMusicDisc(Supplier<? extends Item> item, String description) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ public void registerSounds() {
sound("item/bottle/fill3").pitch(1.3F),
sound("item/bottle/fill4").pitch(1.3F)
);
addbasicSound(SMSounds.THROWING_KNIFE_HIT,
sound(SullysMod.modPrefix("item/throwing_knife/hit1")),
sound(SullysMod.modPrefix("item/throwing_knife/hit2")),
sound(SullysMod.modPrefix("item/throwing_knife/hit3"))
);
addbasicSound(SMSounds.THROWING_KNIFE_HIT_GROUND,
sound(SullysMod.modPrefix("item/throwing_knife/hit1")),
sound(SullysMod.modPrefix("item/throwing_knife/hit2")),
sound(SullysMod.modPrefix("item/throwing_knife/hit3"))
);
addbasicSound(SMSounds.THROWING_KNIFE_THROW,
sound(SullysMod.modPrefix("item/throwing_knife/throw1")),
sound(SullysMod.modPrefix("item/throwing_knife/throw2"))
);

//Block Sounds
addbasicSound(SMSounds.POLISH_JADE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public SMLootModifierProvider(PackOutput packOutput, CompletableFuture<HolderLoo
@Override
protected void registerEntries(HolderLookup.Provider provider) {
this.entry("add_lanternfish_to_fishing").selects(BuiltInLootTables.FISHING_FISH).addModifier(new LootPoolEntriesModifier(false, 0, Collections.singletonList(createLootEntryWithCondition(SMItems.LANTERNFISH.get(), 55, 1, 1, SMLootConditions.ON_LANTERNFISH_HEIGHT))));
//TODO add piranha to fishing
this.entry("add_piranha_to_fishing").selects(BuiltInLootTables.FISHING_FISH).addModifier(new LootPoolEntriesModifier(false, 0, Collections.singletonList(createLootEntryWithCondition(SMItems.PIRANHA.get(), 40, 1, 1, SMLootConditions.getPiranhaBiomes()))));
this.entry("add_music_disc_scour_to_jungle_temple").selects(BuiltInLootTables.JUNGLE_TEMPLE).addModifier(new LootPoolEntriesModifier(false, 0, Collections.singletonList(createMusicDiscLootEntry(SMItems.MUSIC_DISC_SCOUR.get(), 4))));
this.entry("add_jade_smithing_template_to_jungle_temple").selects(BuiltInLootTables.JUNGLE_TEMPLE).addModifier(new LootPoolEntriesModifier(false, 0, Collections.singletonList(createLootEntry(SMItems.JADE_UPGRADE_SMITHING_TEMPLATE.get(), 4, 1, 2))));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,18 @@ protected void addTags(HolderLookup.Provider pProvider) {
EntityType.WITHER_SKULL,
EntityType.FISHING_BOBBER
).addOptional(new ResourceLocation("botania", "mana_burst"));

tag(SMEntityTags.IS_FLYING_MOB).add(
EntityType.BEE,
EntityType.PARROT,
EntityType.BAT,
EntityType.WITHER,
EntityType.ENDER_DRAGON,
EntityType.GHAST,
EntityType.VEX,
EntityType.PHANTOM,
EntityType.ALLAY,
EntityType.BLAZE
);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
package com.uraneptus.sullysmod.core.other;

import com.uraneptus.sullysmod.core.other.tags.SMBiomeTags;
import net.minecraft.advancements.critereon.LocationPredicate;
import net.minecraft.advancements.critereon.MinMaxBounds;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.Biomes;
import net.minecraft.world.level.storage.loot.predicates.AnyOfCondition;
import net.minecraft.world.level.storage.loot.predicates.LocationCheck;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
import net.minecraftforge.common.Tags;
import net.minecraftforge.registries.ForgeRegistries;

import java.util.ArrayList;
import java.util.List;

public class SMLootConditions {
public static final LootItemCondition.Builder ON_LANTERNFISH_HEIGHT = LocationCheck.checkLocation(LocationPredicate.Builder.location().setY(MinMaxBounds.Doubles.between(-57.0D, 16.0D)));

public static LootItemCondition.Builder getPiranhaBiomes() {
return biomeConditionCheck(Biomes.MANGROVE_SWAMP)
.or(biomeConditionCheck(Biomes.JUNGLE))
.or(biomeConditionCheck(Biomes.SPARSE_JUNGLE))
.or(biomeConditionCheck(Biomes.BAMBOO_JUNGLE));
}

public static LootItemCondition.Builder biomeConditionCheck(ResourceKey<Biome> biome) {
return LocationCheck.checkLocation(LocationPredicate.Builder.location().setBiome(biome));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ public class SMEntityTags {
public static final TagKey<EntityType<?>> CANNOT_BOUNCE = TagUtil.entityTypeTag(SullysMod.MOD_ID, "cannot_bounce");
public static final TagKey<EntityType<?>> CANNOT_BE_FLUNG = TagUtil.entityTypeTag(SullysMod.MOD_ID, "cannot_be_flung");
public static final TagKey<EntityType<?>> ATTACKS_BABY_TORTOISES = TagUtil.entityTypeTag(SullysMod.MOD_ID, "attacks_baby_tortoises");
public static final TagKey<EntityType<?>> IS_FLYING_MOB = TagUtil.entityTypeTag(SullysMod.MOD_ID, "is_flying_mob");
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class SMDamageTypes {
public static Map<ResourceKey<DamageType>, DamageType> damageTypeMap = new HashMap<>();

public static final ResourceKey<DamageType> TORTOISE_SHELL = register(new DamageType("tortoise_shell", 0));
public static final ResourceKey<DamageType> THROWING_KNIFE = register(new DamageType("throwing_knife", 0));

private static ResourceKey<DamageType> register(DamageType damageType) {
ResourceKey<DamageType> key = ResourceKey.create(Registries.DAMAGE_TYPE, SullysMod.modPrefix(damageType.msgId()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ public class SMEntityTypes {
public static final RegistryObject<EntityType<BoulderingZombie>> BOULDERING_ZOMBIE = HELPER.createLivingEntity("bouldering_zombie", BoulderingZombie::new, MobCategory.MONSTER, 0.6F, 1.95F);
public static final RegistryObject<EntityType<JungleSpider>> JUNGLE_SPIDER = HELPER.createLivingEntity("jungle_spider", JungleSpider::new, MobCategory.MONSTER, 0.85F, 0.9F);
public static final RegistryObject<EntityType<Piranha>> PIRANHA = HELPER.createLivingEntity("piranha", Piranha::new, MobCategory.WATER_AMBIENT, 0.65F, 0.4F);
public static final RegistryObject<EntityType<ThrownThrowingKnife>> THROWN_THROWING_KNIFE = HELPER.createEntity("thrown_throwing_knife", ThrownThrowingKnife::new, ThrownThrowingKnife::new, MobCategory.MISC, 1.2F, 0.9F);
public static final RegistryObject<EntityType<ThrownThrowingKnife>> THROWN_THROWING_KNIFE = HELPER.createEntity("thrown_throwing_knife", ThrownThrowingKnife::new, ThrownThrowingKnife::new, MobCategory.MISC, 0.5F, 0.6F);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public class SMSounds {
public static final RegistryObject<SoundEvent> POLISH_JADE = HELPER.createSoundEvent("block.grindstone.polish_jade");
public static final RegistryObject<SoundEvent> VIAL_SHATTERS = HELPER.createSoundEvent("item.vial.shatter");
public static final RegistryObject<SoundEvent> VIAL_FILLS = HELPER.createSoundEvent("item.vial.fill");
public static final RegistryObject<SoundEvent> THROWING_KNIFE_HIT = HELPER.createSoundEvent("item.throwing_knife.hit");
public static final RegistryObject<SoundEvent> THROWING_KNIFE_HIT_GROUND = HELPER.createSoundEvent("item.throwing_knife.hit_ground");
public static final RegistryObject<SoundEvent> THROWING_KNIFE_THROW = HELPER.createSoundEvent("item.throwing_knife.throw");

//Block Sounds
public static final RegistryObject<SoundEvent> JADE_RICOCHET = HELPER.createSoundEvent("block.jade.ricochet");
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit f523dbe

Please sign in to comment.