From bd2918c86caf6dac7d478d44988fbaf9cbef2c91 Mon Sep 17 00:00:00 2001 From: Maxx <53229958+MBatt1@users.noreply.github.com> Date: Sun, 5 May 2024 11:46:17 -0500 Subject: [PATCH 1/9] #792 and #798 --- gradle.properties | 2 +- .../blocks/mechanical/NitraBlock.java | 21 ++++++++++++++----- .../entities/ParadiseLostEntityTypes.java | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 017d3e7d..c313da16 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ # suppress inspection "UnusedProperty" for whole file org.gradle.jvmargs=-Xmx2G -paradiseLostVersion=2.2.0-beta+1.19.2 +paradiseLostVersion=2.2.1-beta+1.19.2 minecraftVersion=1.19.2 yarnVersion=1.19.2+build.28 diff --git a/src/main/java/net/id/paradiselost/blocks/mechanical/NitraBlock.java b/src/main/java/net/id/paradiselost/blocks/mechanical/NitraBlock.java index 637f9230..d0f3d473 100644 --- a/src/main/java/net/id/paradiselost/blocks/mechanical/NitraBlock.java +++ b/src/main/java/net/id/paradiselost/blocks/mechanical/NitraBlock.java @@ -4,19 +4,25 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.block.SandBlock; import net.minecraft.entity.Entity; +import net.minecraft.entity.FallingBlockEntity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.projectile.ProjectileEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; +import net.minecraft.particle.ParticleTypes; +import net.minecraft.server.world.ServerWorld; +import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; import net.minecraft.stat.Stats; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; import net.minecraft.world.World; import net.minecraft.world.event.GameEvent; import net.minecraft.world.explosion.Explosion; @@ -31,8 +37,7 @@ public NitraBlock(Settings settings) { public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) { if (!oldState.isOf(state.getBlock())) { if (world.isReceivingRedstonePower(pos)) { - ignite(world, pos, 2F); - world.removeBlock(pos, false); + world.createAndScheduleBlockTick(pos, this, 1); } } @@ -40,8 +45,7 @@ public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState public void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { if (world.isReceivingRedstonePower(pos)) { - ignite(world, pos, 2F); - world.removeBlock(pos, false); + world.createAndScheduleBlockTick(pos, this, 1); } } @@ -49,17 +53,24 @@ public void neighborUpdate(BlockState state, World world, BlockPos pos, Block so public void onDestroyedByExplosion(World world, BlockPos pos, Explosion explosion) { float sourcePower = ((ExplosionExtensions) explosion).getPower(); if (!world.isClient && sourcePower > 0.5F) { - System.out.println(sourcePower); ignite(world, pos, sourcePower - 0.5F); } } + public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + ignite(world, pos, 2F, null); + world.setBlockState(pos, Blocks.AIR.getDefaultState(), 11); + world.spawnParticles(ParticleTypes.EXPLOSION_EMITTER, pos.getX(), pos.getY(), pos.getZ(), 1, 0.0, 0.0, 0.0, 0.0); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F, (1.0F + (world.random.nextFloat() - world.random.nextFloat()) * 0.2F) * 0.7F); + } + public static void ignite(World world, BlockPos pos, float power) { ignite(world, pos, power, null); } private static void ignite(World world, BlockPos pos, float power, @Nullable LivingEntity igniter) { Explosion explosion = new Explosion(world, igniter, null, null, pos.getX(), pos.getY() + 0.5D, pos.getZ(), power, false, Explosion.DestructionType.BREAK); + System.out.println(world.isClient); if (!world.isClient) { explosion.collectBlocksAndDamageEntities(); world.emitGameEvent(igniter, GameEvent.PRIME_FUSE, pos); diff --git a/src/main/java/net/id/paradiselost/entities/ParadiseLostEntityTypes.java b/src/main/java/net/id/paradiselost/entities/ParadiseLostEntityTypes.java index 0a4c8327..3fc31497 100644 --- a/src/main/java/net/id/paradiselost/entities/ParadiseLostEntityTypes.java +++ b/src/main/java/net/id/paradiselost/entities/ParadiseLostEntityTypes.java @@ -47,7 +47,7 @@ public class ParadiseLostEntityTypes { ParadiseLostEntityTypes.of(SliderEntity::new, MISC, changing(0.98F, 0.98F), 10).trackedUpdateRate(20)); // Hostile - public static final EntityType ENVOY = add("envoy", of(EnvoyEntity::new, MONSTER, changing(1f, 2f), 7), + public static final EntityType ENVOY = add("envoy", of(EnvoyEntity::new, MONSTER, changing(0.6F, 1.95F), 10), attributes(EnvoyEntity::createEnvoyAttributes), spawnRestrictions(EnvoyEntity::canMobSpawn)); // passive From dd312f216ef02480affa1b72876fa907b69e3b18 Mon Sep 17 00:00:00 2001 From: Maxx <53229958+MBatt1@users.noreply.github.com> Date: Sun, 5 May 2024 11:47:42 -0500 Subject: [PATCH 2/9] #792 for real ? --- src/main/resources/assets/paradise_lost/lang/en_us.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/resources/assets/paradise_lost/lang/en_us.json b/src/main/resources/assets/paradise_lost/lang/en_us.json index 81c8d6da..5f33c47f 100644 --- a/src/main/resources/assets/paradise_lost/lang/en_us.json +++ b/src/main/resources/assets/paradise_lost/lang/en_us.json @@ -245,11 +245,8 @@ "entity.paradise_lost.floating_block": "Floating Block", - "entity.paradise_lost.hellenrose": "Hellenrose", "entity.paradise_lost.moa": "Moa", - "entity.paradise_lost.rook": "Rook", - "entity.paradise_lost.poison_dart": "Poison Dart", - "entity.paradise_lost.poison_needle": "Poison Needle", + "entity.paradise_lost.envoy": "Rook", "item.paradise_lost.golden_amber": "Golden Amber", From 84d94b0b844fa702cfcc4f8f4901100e1a39a2d5 Mon Sep 17 00:00:00 2001 From: Maxx <53229958+MBatt1@users.noreply.github.com> Date: Sun, 5 May 2024 12:02:11 -0500 Subject: [PATCH 3/9] #795 --- .../net/id/paradiselost/api/FloatingBlockHelper.java | 2 +- .../entities/block/FloatingBlockEntity.java | 10 ++++++---- .../net/id/paradiselost/tag/ParadiseLostBlockTags.java | 2 +- .../paradise_lost/tags/blocks/decaying_floaters.json | 7 +++++++ 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 src/main/resources/data/paradise_lost/tags/blocks/decaying_floaters.json diff --git a/src/main/java/net/id/paradiselost/api/FloatingBlockHelper.java b/src/main/java/net/id/paradiselost/api/FloatingBlockHelper.java index 422a003b..b68002b6 100644 --- a/src/main/java/net/id/paradiselost/api/FloatingBlockHelper.java +++ b/src/main/java/net/id/paradiselost/api/FloatingBlockHelper.java @@ -54,7 +54,7 @@ public interface FloatingBlockHelper { World world = entity.world; BlockPos pos = entity.getBlockPos(); int distFromTop = world.getTopY() - pos.getY(); - return !entity.isFastFloater() && distFromTop <= 50; + return !entity.isInTag(ParadiseLostBlockTags.DECAYING_FLOATERS) && distFromTop <= 50; }; /** diff --git a/src/main/java/net/id/paradiselost/entities/block/FloatingBlockEntity.java b/src/main/java/net/id/paradiselost/entities/block/FloatingBlockEntity.java index f7a322a5..e98b0273 100644 --- a/src/main/java/net/id/paradiselost/entities/block/FloatingBlockEntity.java +++ b/src/main/java/net/id/paradiselost/entities/block/FloatingBlockEntity.java @@ -4,12 +4,14 @@ import net.id.paradiselost.entities.ParadiseLostEntityTypes; import net.id.paradiselost.tag.ParadiseLostBlockTags; import net.id.incubus_core.blocklikeentities.api.BlockLikeEntity; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.FallingBlock; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.MovementType; import net.minecraft.nbt.NbtCompound; +import net.minecraft.tag.TagKey; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3i; import net.minecraft.world.World; @@ -65,7 +67,7 @@ public void postTickMovement() { if (!this.hasNoGravity()) { if (!isDropping() && !shouldBeginDropping()) { - if (isFastFloater()) { + if (isInTag(ParadiseLostBlockTags.FAST_FLOATERS)) { this.setVelocity(this.getVelocity().add(0.0D, 0.05D, 0.0D)); } else { this.setVelocity(this.getVelocity().add(0.0D, 0.03D, 0.0D)); @@ -140,9 +142,9 @@ public void breakApart() { super.breakApart(); this.getOnEndFloating().accept(Math.abs(this.lastYVelocity), false); } - - public boolean isFastFloater() { - return this.getBlockState().isIn(ParadiseLostBlockTags.FAST_FLOATERS) && !this.partOfSet; + + public boolean isInTag(TagKey tag) { + return this.getBlockState().isIn(tag) && !this.partOfSet; } @Override diff --git a/src/main/java/net/id/paradiselost/tag/ParadiseLostBlockTags.java b/src/main/java/net/id/paradiselost/tag/ParadiseLostBlockTags.java index a76083e3..16004906 100644 --- a/src/main/java/net/id/paradiselost/tag/ParadiseLostBlockTags.java +++ b/src/main/java/net/id/paradiselost/tag/ParadiseLostBlockTags.java @@ -14,9 +14,9 @@ public class ParadiseLostBlockTags { public static final TagKey NON_FLOATERS = register("non_floaters"); public static final TagKey PUSH_FLOATERS = register("push_floaters"); public static final TagKey HURTABLE_FLOATERS = register("hurtable_floaters"); + public static final TagKey DECAYING_FLOATERS = register("decaying_floaters"); //Plants - public static final TagKey LICHEN_SPREADABLES = register("plants/lichen_spreadable"); public static final TagKey FUNGI_CLINGABLES = register("plants/fungi_clingable"); public static final TagKey GENERIC_VALID_GROUND = register("plants/generic_valid_ground"); public static final TagKey SWEDROOT_PLANTABLE = register("plants/swedroot_plantable"); diff --git a/src/main/resources/data/paradise_lost/tags/blocks/decaying_floaters.json b/src/main/resources/data/paradise_lost/tags/blocks/decaying_floaters.json new file mode 100644 index 00000000..dab2ba9f --- /dev/null +++ b/src/main/resources/data/paradise_lost/tags/blocks/decaying_floaters.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "paradise_lost:levita", + "paradise_lost:levita_ore" + ] +} From 3fe61f30597f299bac04315dbf4373f49df29bb2 Mon Sep 17 00:00:00 2001 From: Maxx <53229958+MBatt1@users.noreply.github.com> Date: Sun, 5 May 2024 12:40:27 -0500 Subject: [PATCH 4/9] #793 --- .../blocks/ParadiseLostBlockActions.java | 4 ++-- .../blocks/ParadiseLostBlocks.java | 16 ++++++++------ .../decorative/ParadiseLostDirtPathBlock.java | 13 +++++++++--- .../paradiselost/items/ParadiseLostItems.java | 1 + .../blockstates/frozen_path.json | 13 ++++++++++++ .../assets/paradise_lost/lang/en_us.json | 3 ++- .../models/block/frozen_path.json | 9 ++++++++ .../models/item/frozen_path.json | 3 +++ .../textures/block/frozen_path_side.png | Bin 0 -> 618 bytes .../textures/block/frozen_path_top.png | Bin 0 -> 486 bytes .../textures/item/halflight_cheesecake.png | Bin 480 -> 472 bytes .../loot_tables/blocks/frozen_path.json | 20 ++++++++++++++++++ .../tags/blocks/mineable_by_shovel.json | 1 + 13 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 src/main/resources/assets/paradise_lost/blockstates/frozen_path.json create mode 100644 src/main/resources/assets/paradise_lost/models/block/frozen_path.json create mode 100644 src/main/resources/assets/paradise_lost/models/item/frozen_path.json create mode 100644 src/main/resources/assets/paradise_lost/textures/block/frozen_path_side.png create mode 100644 src/main/resources/assets/paradise_lost/textures/block/frozen_path_top.png create mode 100644 src/main/resources/data/paradise_lost/loot_tables/blocks/frozen_path.json diff --git a/src/main/java/net/id/paradiselost/blocks/ParadiseLostBlockActions.java b/src/main/java/net/id/paradiselost/blocks/ParadiseLostBlockActions.java index 12a2cabe..6b1c3c16 100644 --- a/src/main/java/net/id/paradiselost/blocks/ParadiseLostBlockActions.java +++ b/src/main/java/net/id/paradiselost/blocks/ParadiseLostBlockActions.java @@ -41,7 +41,7 @@ protected static Action coarseTillable() { return (id, block) -> TillableBlockRegistry.register(block, HoeItem::canTillFarmland, ParadiseLostBlocks.DIRT.getDefaultState()); } - protected static Action flattenable() { - return (id, block) -> FlattenableBlockRegistry.register(block, ParadiseLostBlocks.DIRT_PATH.getDefaultState()); + protected static Action flattenable(Block turnInto) { + return (id, block) -> FlattenableBlockRegistry.register(block, turnInto.getDefaultState()); } } diff --git a/src/main/java/net/id/paradiselost/blocks/ParadiseLostBlocks.java b/src/main/java/net/id/paradiselost/blocks/ParadiseLostBlocks.java index 3752e43a..c6295fcb 100644 --- a/src/main/java/net/id/paradiselost/blocks/ParadiseLostBlocks.java +++ b/src/main/java/net/id/paradiselost/blocks/ParadiseLostBlocks.java @@ -41,16 +41,20 @@ protected static Settings unbreakable(AbstractBlock.Settings settings) { private static Settings grassBlock() { return copy(Blocks.GRASS_BLOCK).mapColor(MapColor.LICHEN_GREEN).strength(0.4f); } + private static Settings permafrost() { + return copy(Blocks.DIRT).strength(2f).sounds(BlockSoundGroup.GILDED_BLACKSTONE); + } - public static final ParadiseLostGrassBlock HIGHLANDS_GRASS = add("highlands_grass", new ParadiseLostGrassBlock(grassBlock()), cutoutMippedRenderLayer, tillable(), flattenable()); - public static final ParadiseLostSnowyBlock FROZEN_GRASS = add("frozen_grass", new ParadiseLostSnowyBlock(grassBlock().mapColor(MapColor.WHITE).strength(2F).sounds(BlockSoundGroup.GILDED_BLACKSTONE)), flattenable()); + public static final ParadiseLostDirtPathBlock DIRT_PATH = add("grass_path", new ParadiseLostDirtPathBlock(copy(Blocks.DIRT_PATH), () -> ParadiseLostBlocks.DIRT)); + public static final ParadiseLostDirtPathBlock PERMAFROST_PATH = add("frozen_path", new ParadiseLostDirtPathBlock(permafrost(), () -> ParadiseLostBlocks.PERMAFROST)); + public static final ParadiseLostGrassBlock HIGHLANDS_GRASS = add("highlands_grass", new ParadiseLostGrassBlock(grassBlock()), cutoutMippedRenderLayer, tillable(), flattenable(ParadiseLostBlocks.DIRT_PATH)); + public static final ParadiseLostSnowyBlock FROZEN_GRASS = add("frozen_grass", new ParadiseLostSnowyBlock(grassBlock().mapColor(MapColor.WHITE).strength(2F).sounds(BlockSoundGroup.GILDED_BLACKSTONE)), flattenable(ParadiseLostBlocks.PERMAFROST_PATH)); // Soil Blocks - public static final Block DIRT = add("dirt", new Block(copy(Blocks.DIRT).strength(0.3f)), tillable(), flattenable()); - public static final Block COARSE_DIRT = add("coarse_dirt", new Block(copy(Blocks.DIRT).strength(0.3f)), coarseTillable(), flattenable()); + public static final Block DIRT = add("dirt", new Block(copy(Blocks.DIRT).strength(0.3f)), tillable(), flattenable(ParadiseLostBlocks.DIRT_PATH)); + public static final Block COARSE_DIRT = add("coarse_dirt", new Block(copy(Blocks.DIRT).strength(0.3f)), coarseTillable(), flattenable(ParadiseLostBlocks.DIRT_PATH)); public static final FloatingBlock LEVITA = add("levita", new FloatingBlock(false, copy(Blocks.GRAVEL).strength(0.3f))); - public static final Block PERMAFROST = add("permafrost", new Block(copy(Blocks.DIRT).strength(2f).sounds(BlockSoundGroup.GILDED_BLACKSTONE)), flattenable()); + public static final Block PERMAFROST = add("permafrost", new Block(permafrost()), flattenable(ParadiseLostBlocks.PERMAFROST_PATH)); public static final FarmlandBlock FARMLAND = add("farmland", new ParadiseLostFarmlandBlock(copy(Blocks.FARMLAND))); - public static final ParadiseLostDirtPathBlock DIRT_PATH = add("grass_path", new ParadiseLostDirtPathBlock(copy(Blocks.DIRT_PATH))); public static final Block PACKED_SWEDROOT = add("packed_swedroot", new Block(of(Material.WOOD).strength(2f).sounds(BlockSoundGroup.SHROOMLIGHT))); // Glass Blocks diff --git a/src/main/java/net/id/paradiselost/blocks/decorative/ParadiseLostDirtPathBlock.java b/src/main/java/net/id/paradiselost/blocks/decorative/ParadiseLostDirtPathBlock.java index 84845a95..a09b9113 100644 --- a/src/main/java/net/id/paradiselost/blocks/decorative/ParadiseLostDirtPathBlock.java +++ b/src/main/java/net/id/paradiselost/blocks/decorative/ParadiseLostDirtPathBlock.java @@ -1,19 +1,26 @@ package net.id.paradiselost.blocks.decorative; -import net.id.paradiselost.blocks.ParadiseLostBlocks; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.DirtPathBlock; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.random.Random; +import java.util.function.Function; +import java.util.function.Supplier; + public class ParadiseLostDirtPathBlock extends DirtPathBlock { - public ParadiseLostDirtPathBlock(Settings settings) { + + private Supplier returnTo; + + public ParadiseLostDirtPathBlock(Settings settings, Supplier returnTo) { super(settings); + this.returnTo = returnTo; } @Override public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - world.setBlockState(pos, pushEntitiesUpBeforeBlockChange(state, ParadiseLostBlocks.DIRT.getDefaultState(), world, pos)); + world.setBlockState(pos, pushEntitiesUpBeforeBlockChange(state, this.returnTo.get().getDefaultState(), world, pos)); } } diff --git a/src/main/java/net/id/paradiselost/items/ParadiseLostItems.java b/src/main/java/net/id/paradiselost/items/ParadiseLostItems.java index e1a3df50..a7fc85f6 100644 --- a/src/main/java/net/id/paradiselost/items/ParadiseLostItems.java +++ b/src/main/java/net/id/paradiselost/items/ParadiseLostItems.java @@ -412,6 +412,7 @@ private static FabricItemSettings decoration() { // path & farmland public static final BlockItem FARMLAND = add("farmland", ParadiseLostBlocks.FARMLAND, decoration); public static final BlockItem DIRT_PATH = add("grass_path", ParadiseLostBlocks.DIRT_PATH, decoration); + public static final BlockItem PERMAFROST_PATH = add("frozen_path", ParadiseLostBlocks.PERMAFROST_PATH, decoration); // signs, wall stuff. public static final SignItem AUREL_SIGN = add("aurel_sign", new SignItem(sign, ParadiseLostBlocks.AUREL_SIGNS.sign(), ParadiseLostBlocks.AUREL_SIGNS.wallSign())); public static final SignItem MOTHER_AUREL_SIGN = add("mother_aurel_sign", new SignItem(sign, ParadiseLostBlocks.MOTHER_AUREL_SIGNS.sign(), ParadiseLostBlocks.MOTHER_AUREL_SIGNS.wallSign())); diff --git a/src/main/resources/assets/paradise_lost/blockstates/frozen_path.json b/src/main/resources/assets/paradise_lost/blockstates/frozen_path.json new file mode 100644 index 00000000..0385b927 --- /dev/null +++ b/src/main/resources/assets/paradise_lost/blockstates/frozen_path.json @@ -0,0 +1,13 @@ +{ + "variants": { + "": [ + { + "model": "paradise_lost:block/frozen_path" + }, + { + "model": "paradise_lost:block/frozen_path", + "y": 180 + } + ] + } +} diff --git a/src/main/resources/assets/paradise_lost/lang/en_us.json b/src/main/resources/assets/paradise_lost/lang/en_us.json index 5f33c47f..a2da5e22 100644 --- a/src/main/resources/assets/paradise_lost/lang/en_us.json +++ b/src/main/resources/assets/paradise_lost/lang/en_us.json @@ -32,7 +32,8 @@ "block.paradise_lost.permafrost": "Permafrost", "block.paradise_lost.levita": "Levita", "block.paradise_lost.farmland": "Paradise Farmland", - "block.paradise_lost.grass_path": "Paradise Grass Path", + "block.paradise_lost.grass_path": "Highlands Grass Path", + "block.paradise_lost.frozen_path": "Frozen Path", "block.paradise_lost.packed_swedroot": "Packed Swedroot", "block.paradise_lost.cold_cloud": "Cold Cloud", diff --git a/src/main/resources/assets/paradise_lost/models/block/frozen_path.json b/src/main/resources/assets/paradise_lost/models/block/frozen_path.json new file mode 100644 index 00000000..2fd13c63 --- /dev/null +++ b/src/main/resources/assets/paradise_lost/models/block/frozen_path.json @@ -0,0 +1,9 @@ +{ + "parent": "block/dirt_path", + "textures": { + "particle": "paradise_lost:block/permafrost", + "top": "paradise_lost:block/frozen_path_top", + "side": "paradise_lost:block/frozen_path_side", + "bottom": "paradise_lost:block/permafrost" + } +} diff --git a/src/main/resources/assets/paradise_lost/models/item/frozen_path.json b/src/main/resources/assets/paradise_lost/models/item/frozen_path.json new file mode 100644 index 00000000..fcc81e39 --- /dev/null +++ b/src/main/resources/assets/paradise_lost/models/item/frozen_path.json @@ -0,0 +1,3 @@ +{ + "parent": "paradise_lost:block/frozen_path" +} diff --git a/src/main/resources/assets/paradise_lost/textures/block/frozen_path_side.png b/src/main/resources/assets/paradise_lost/textures/block/frozen_path_side.png new file mode 100644 index 0000000000000000000000000000000000000000..ed39002a0bfae33262ec698ac12276b4cc7bcf5e GIT binary patch literal 618 zcmV-w0+s!VP)Px%BuPX;R5*>Ll1)z&Q5c0ErW0Grv@>*W(G;7A6a0XrAu*Z&E{qEo{3`yB3l}DA z3?u?dLRS*MkTj7LTAbb~GwoPf)6TdUW&qKZcXjW3&Ux>-=f3ctYi#$69ma=zUP}Nq z9b6#}2g>-~h65!LTwa}yf32qW{n7b00t?0LKker88g|1Yqos&-YFGN? zghuPTM^0$8>CyK`WV958VwQI6;v9=&Zddv!)eoC=rB8WA03@WoKVrYyydpAk88+6} zD9;GG(&x?kYsOw~?1TWHc0L2}{KX1JF2md1O=^2JtcnG|t=m%ooE+IW4T&o~455>n zzqhm+jD?*2?BTXOnm_8;ofZJ$uYj{o4{KV3Oq9*x*F#+C5e$ZmPh?TuQ!fe0s#rJ; zNo}u&A#~i+=$7sG2N;t!q@aE5P?$CWaHWT02pzL5m|vVrtX*!%2#m?7nJYaC(*_rwKaS0pmgHd)?$~V?55_H`s6)S`M@$?*IS*07*qoM6N<$ Ef`e2O!~g&Q literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/paradise_lost/textures/block/frozen_path_top.png b/src/main/resources/assets/paradise_lost/textures/block/frozen_path_top.png new file mode 100644 index 0000000000000000000000000000000000000000..5a4482f1876519e323edbc8530bba1b5ded6b02b GIT binary patch literal 486 zcmV@P)Px$ph-kQR5*=wlR=N0Fc5{m#6%Ecyi$~~61_C4dhP!|_uAW@Ds5MrOQ@EhNC88! zN|GMvcp+7NGG^YqnfGR9U%&mlMOtBu1|SHp^lpxvB0mFAmzHER#H87S|3CXt+FS4D zJ`f<%iuE@3-=||sXD`&H<gFPVe4>jL~#ek!geI_;nlhPxtIPQm}V&9lRNd9Z%I9XlVNuq3* zAg#~Efk-Rr(vs~GjM3DkrEMIMRwNsZS}y$e(88ci0I+{9xcvJ4cSx=T;gw{gX&Z+z z8e{Mxi)L~UUY-sBsO5qpKTkx2&WDodKBBhv=eJA0n!(l*ZD z{~4tFWfJS^(xR3N|1P5(+=IuUNGncn?Zg3DG>M;mKeV^~b3wcc8L#zNG#CbLyrubT cO{5in0JJX+zr~R1u>b%707*qoM6N<$g50s=5C8xG literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/paradise_lost/textures/item/halflight_cheesecake.png b/src/main/resources/assets/paradise_lost/textures/item/halflight_cheesecake.png index bf610dc50aef133541cb402519b3054503f21cbd..1b5aff35064bae90c2fd5efd06decc835f39a869 100644 GIT binary patch delta 433 zcmV;i0Z#tl1K0zQF@KUtL_t(IjjfZ-D+FO2$3M@oUYf?5W;xiJm5Yng9vmDfM{!k- z4jlKOD9Y7Kt&$umaw2ha_7||Jy%3w3;$TgKOP zE+i8}UL`}u+6j5&Brxi=2>?u^KuvvvG)L6NP{`86IC-b&cVeom%G09??p=|QscHWL zOEt<@y152mV__bEyi;T==Ly-$sje!&m7@yfoeld^K2Mt`CNcem;QH2bQ_6pFGg zr%a*9&Y8)OVF;0kMxA!8j?MU#w&6A%2Tn8yD$Ih9F9q*A3(pKIx@85qn9#{`G0k|3Tt_-6E!vLJH#ixY< z4n|jLTOJ3XTYn93w6_gQTL45pb^%~so+J7@gfqSN6D=4<4Mq6VH%M&b2WluH=e)c9 zPvPbYD|_nZ7YuWJxX;|zDYrpmP+??#QM&M{0RTSK)=Su@20Tp`$40ow+U_F7V^xms zS1_+_zI>YikTaHKUY-N6K05=zMb>6B=?J;X@mQ4upfdXv%E`R8(ftZW(hYVq={&6R jWA%54il3l2+*_Wx00000NkvXXu0mjfwu#SJ diff --git a/src/main/resources/data/paradise_lost/loot_tables/blocks/frozen_path.json b/src/main/resources/data/paradise_lost/loot_tables/blocks/frozen_path.json new file mode 100644 index 00000000..f2fd467e --- /dev/null +++ b/src/main/resources/data/paradise_lost/loot_tables/blocks/frozen_path.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1.0, + "bonus_rolls": 0.0, + "entries": [ + { + "type": "minecraft:item", + "name": "paradise_lost:permafrost" + } + ], + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ] + } + ] +} diff --git a/src/main/resources/data/paradise_lost/tags/blocks/mineable_by_shovel.json b/src/main/resources/data/paradise_lost/tags/blocks/mineable_by_shovel.json index aa8e425f..d282f0b4 100644 --- a/src/main/resources/data/paradise_lost/tags/blocks/mineable_by_shovel.json +++ b/src/main/resources/data/paradise_lost/tags/blocks/mineable_by_shovel.json @@ -3,6 +3,7 @@ "values": [ "paradise_lost:levita", "paradise_lost:grass_path", + "paradise_lost:frozen_path", "paradise_lost:farmland", "paradise_lost:levita_brick", "paradise_lost:levita_brick_slab", From f1a9078aa3b31becca7d5f9b187204e1888c23d7 Mon Sep 17 00:00:00 2001 From: Maxx <53229958+MBatt1@users.noreply.github.com> Date: Sun, 5 May 2024 12:52:59 -0500 Subject: [PATCH 5/9] oops --- src/main/resources/assets/paradise_lost/lang/en_us.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/paradise_lost/lang/en_us.json b/src/main/resources/assets/paradise_lost/lang/en_us.json index a2da5e22..aa539bee 100644 --- a/src/main/resources/assets/paradise_lost/lang/en_us.json +++ b/src/main/resources/assets/paradise_lost/lang/en_us.json @@ -247,7 +247,7 @@ "entity.paradise_lost.floating_block": "Floating Block", "entity.paradise_lost.moa": "Moa", - "entity.paradise_lost.envoy": "Rook", + "entity.paradise_lost.envoy": "Envoy", "item.paradise_lost.golden_amber": "Golden Amber", From b46cc87961eef0d0b83aae359b131947561d23f4 Mon Sep 17 00:00:00 2001 From: Maxx <53229958+MBatt1@users.noreply.github.com> Date: Sun, 5 May 2024 13:01:01 -0500 Subject: [PATCH 6/9] remove unused translation tags --- .../assets/paradise_lost/lang/en_us.json | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/src/main/resources/assets/paradise_lost/lang/en_us.json b/src/main/resources/assets/paradise_lost/lang/en_us.json index aa539bee..d53fc00a 100644 --- a/src/main/resources/assets/paradise_lost/lang/en_us.json +++ b/src/main/resources/assets/paradise_lost/lang/en_us.json @@ -179,10 +179,6 @@ "block.paradise_lost.lavender_wisteria_sapling": "Lavender Wisteria Sapling", "block.paradise_lost.lavender_wisteria_hanger": "Lavender Wisteria Hangers", - "block.paradise_lost.boreal_wisteria_leaves": "Boreal Wisteria Leaves", - "block.paradise_lost.boreal_wisteria_sapling": "Boreal Wisteria Sapling", - "block.paradise_lost.boreal_wisteria_hanger": "Boreal Wisteria Hanger", - "block.paradise_lost.grass_plant": "Gale Grass", "block.paradise_lost.grass_flowering": "Flowering Gale Grass", "block.paradise_lost.short_grass": "Stubby Gale Grass", @@ -251,7 +247,6 @@ "item.paradise_lost.golden_amber": "Golden Amber", - "item.paradise_lost.hellenrose_petal": "Hellenrose Petal", "item.paradise_lost.nightmare_fuel": "Nightmare Fuel", "item.paradise_lost.nightmare_fuel.tooltip": "Warm to the touch", "item.paradise_lost.crow_eye": "Crow's Eye", @@ -320,7 +315,6 @@ "item.paradise_lost.amadrys_bread_glazed": "Glazed Amadrys Loaf", "item.paradise_lost.swedroot": "Swedroot", "item.paradise_lost.flaxseed" : "Flaxseed", - "item.paradise_lost.mystery_milk": "Mystery Milk", "item.paradise_lost.gingerbread_man": "Gingerbread Man", "item.paradise_lost.moa_meat": "Moa Chop", "item.paradise_lost.moa_meat_cooked": "Cooked Moa Chop", @@ -334,9 +328,6 @@ "item.paradise_lost.aurel_water_bucket": "Aurel Water Bucket", "item.paradise_lost.aurel_milk_bucket": "Aurel Milk Bucket", - "item.paradise_lost.vial": "Quicksoil Vial", - "item.paradise_lost.cloud_vial": "Cloud Vial", - "item.paradise_lost.hellenrose_spawn_egg": "Hellenrose Spawn Egg", "item.paradise_lost.envoy_spawn_egg": "Envoy Spawn Egg", "item.paradise_lost.moa_spawn_egg": "Moa Spawn Egg", @@ -408,9 +399,6 @@ "commands.paradise_lost.moastat.set": "Set %1$s to %2$s", "commands.paradise_lost.gravitate.failure" : "Couldn't float the block(s)", "commands.paradise_lost.gravitate.success" : "Successfully floated the block(s)", - "commands.paradise_lost.LUV.success.query" : "LUV%1$s", - "commands.paradise_lost.LUV.success.set" : "%1$s's LUV is now %2$s", - "commands.paradise_lost.LUV.failure.set" : "You have no right!", "commands.paradise_lost.lore.get.locked" : "locked", "commands.paradise_lost.lore.get.hidden" : "hidden", "commands.paradise_lost.lore.get.free" : "free", @@ -424,11 +412,6 @@ "info.paradise_lost.bloodstone.abstentine": "Peer into the soul", - "effect.paradise_lost.simmering": "Simmering", - - - "condition.paradise_lost.condition.venom": "Venom", - "subtitles.paradise_lost.block.blackcurrant_bush.pick_blueberries": "Blackcurrants pop", "subtitles.paradise_lost.block.portal.ambient": "Paradise portal whooshes", @@ -442,16 +425,6 @@ "subtitles.paradise_lost.block.orange_leaves.drop_fruit": "Orange leaves drop fruit", "subtitles.paradise_lost.block.orange_leaves.break_differently": "Orange leaves broken", - "subtitles.paradise_lost.block.lichen.spreads": "Lichen spreads", - - "subtitles.paradise_lost.block.spring_water.ambient": "Spring water flows", - "subtitles.paradise_lost.block.spring_water.ambient.2": "Spring water bubbles", - - "subtitles.paradise_lost.effect.simmering.simmer": "Entity simmers", - - "subtitles.paradise_lost.entity.hellenrose.death": "Hellenrose dies", - "subtitles.paradise_lost.entity.hellenrose.shoot": "Hellenrose shoots", - "subtitles.paradise_lost.entity.moa.ambient": "Moa chirps", "subtitles.paradise_lost.entity.moa.gliding": "Moa glides", "subtitles.paradise_lost.entity.moa.death": "Moa dies", @@ -460,10 +433,6 @@ "subtitles.paradise_lost.entity.moa.lay_egg": "Moa lays egg", "subtitles.paradise_lost.entity.moa.egg_hatch": "Moa egg hatches", "subtitles.paradise_lost.entity.moa.step": "Moa walks", - - "subtitles.paradise_lost.entity.nightmare.hurt": "Nightmare hurts", - "subtitles.paradise_lost.entity.nightmare.ambient": "Magpie coos", - "subtitles.paradise_lost.entity.nightmare.death": "Nightmare dissipates", "subtitles.paradise_lost.entity.envoy.damage": "Envoy Chimes", From c2104dbc178e65ccec2111b73f4651c921f213e0 Mon Sep 17 00:00:00 2001 From: Maxx <53229958+MBatt1@users.noreply.github.com> Date: Sun, 5 May 2024 15:59:27 -0500 Subject: [PATCH 7/9] #797 --- .../mixin/entity/PotionEntityMixin.java | 82 +++++++++++++++++++ .../mixin/item/PotionItemMixin.java | 18 ++-- .../paradiselost/util/BloomedCalciteUtil.java | 29 +++++++ src/main/resources/paradise_lost.mixins.json | 1 + 4 files changed, 117 insertions(+), 13 deletions(-) create mode 100644 src/main/java/net/id/paradiselost/mixin/entity/PotionEntityMixin.java create mode 100644 src/main/java/net/id/paradiselost/util/BloomedCalciteUtil.java diff --git a/src/main/java/net/id/paradiselost/mixin/entity/PotionEntityMixin.java b/src/main/java/net/id/paradiselost/mixin/entity/PotionEntityMixin.java new file mode 100644 index 00000000..9d351988 --- /dev/null +++ b/src/main/java/net/id/paradiselost/mixin/entity/PotionEntityMixin.java @@ -0,0 +1,82 @@ +package net.id.paradiselost.mixin.entity; + +import net.id.paradiselost.util.BloomedCalciteUtil; +import net.minecraft.block.Blocks; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.entity.effect.StatusEffects; +import net.minecraft.entity.projectile.thrown.PotionEntity; +import net.minecraft.entity.projectile.thrown.ThrownItemEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionUtil; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + +@Mixin(PotionEntity.class) +public class PotionEntityMixin extends ThrownItemEntity { + + public PotionEntityMixin(EntityType entityType, World world) { + super(entityType, world); + } + + @Inject(method = "onBlockHit", at = @At("TAIL"), cancellable = true) + protected void onBlockHit(BlockHitResult blockHitResult, CallbackInfo ci) { + if (!this.world.isClient) { + ItemStack itemStack = this.getStack(); + List list = PotionUtil.getPotionEffects(itemStack); + boolean healingPotion = list.stream().anyMatch((e) -> e.getEffectType() == StatusEffects.INSTANT_HEALTH); + Direction direction = blockHitResult.getSide(); + BlockPos blockPos = blockHitResult.getBlockPos(); + BlockPos landBlock = blockPos.offset(direction); + if (healingPotion) { + List affected = new LinkedList<>(); + if (world.getBlockState(landBlock.up()).isOf(Blocks.CALCITE)) { + affected.add(landBlock.up()); + } + if (world.getBlockState(landBlock.down()).isOf(Blocks.CALCITE)) { + affected.add(landBlock.down()); + } + addIfValid(landBlock, affected); + addIfValid(landBlock.up(), affected); + addIfValid(landBlock.down(), affected); + for (Direction dir : Direction.Type.HORIZONTAL) { + addIfValid(landBlock.up().offset(dir), affected); + addIfValid(landBlock.down().offset(dir), affected); + } + for (BlockPos pos : new BlockPos[] {landBlock, landBlock.north(), landBlock.south()}) { + addIfValid(pos, affected); + addIfValid(pos.east(), affected); + addIfValid(pos.west(), affected); + } + if (!affected.isEmpty()) { + Collections.shuffle(affected); + BloomedCalciteUtil.applyHealing(this.getOwner(), world, affected.get(0), this.world.random, itemStack); + if (affected.size() > 1 && this.world.random.nextBoolean()) BloomedCalciteUtil.applyHealing(this.getOwner(), world, affected.get(1), this.world.random, itemStack); + } + } + + } + } + + private void addIfValid(BlockPos pos, List list) { + if (world.getBlockState(pos).isOf(Blocks.CALCITE)) { + list.add(pos); + } + } + + @Override + public Item getDefaultItem() { + return null; + } +} diff --git a/src/main/java/net/id/paradiselost/mixin/item/PotionItemMixin.java b/src/main/java/net/id/paradiselost/mixin/item/PotionItemMixin.java index db5e5773..1c0683e2 100644 --- a/src/main/java/net/id/paradiselost/mixin/item/PotionItemMixin.java +++ b/src/main/java/net/id/paradiselost/mixin/item/PotionItemMixin.java @@ -1,10 +1,13 @@ package net.id.paradiselost.mixin.item; import net.id.paradiselost.blocks.ParadiseLostBlocks; +import net.id.paradiselost.util.BloomedCalciteUtil; +import net.kyrptonaught.customportalapi.mixin.portalLighters.PotionEntityMixin; import net.minecraft.advancement.criterion.Criteria; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.projectile.thrown.PotionEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUsage; import net.minecraft.item.ItemUsageContext; @@ -36,21 +39,10 @@ public void useOnBlock(ItemUsageContext context, CallbackInfoReturnable Date: Mon, 6 May 2024 20:26:15 -0500 Subject: [PATCH 8/9] treetap adjustments #796 --- .../blockentity/TreeTapBlockEntity.java | 30 +++++++++++++++---- .../id/paradiselost/recipe/TreeTapRecipe.java | 8 ++++- .../recipe/TreeTapRecipeSerializer.java | 15 ++++++---- .../paradise_lost/recipes/tree_tap/honey.json | 1 + .../paradise_lost/recipes/tree_tap/stew.json | 1 + .../paradise_lost/recipes/tree_tap/water.json | 1 + .../recipes/tree_tap/water_aurel_bucket.json | 12 ++++++++ .../recipes/tree_tap/water_bucket.json | 12 ++++++++ 8 files changed, 68 insertions(+), 12 deletions(-) create mode 100644 src/main/resources/data/paradise_lost/recipes/tree_tap/water_aurel_bucket.json create mode 100644 src/main/resources/data/paradise_lost/recipes/tree_tap/water_bucket.json diff --git a/src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java b/src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java index f886dfa2..3b4476d2 100644 --- a/src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java +++ b/src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java @@ -1,8 +1,12 @@ package net.id.paradiselost.blocks.blockentity; +import net.id.paradiselost.blocks.mechanical.TreeTapBlock; import net.id.paradiselost.recipe.ParadiseLostRecipeTypes; import net.id.paradiselost.recipe.TreeTapRecipe; +import net.minecraft.block.BeehiveBlock; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.HopperBlockEntity; import net.minecraft.block.entity.LootableContainerBlockEntity; @@ -28,7 +32,6 @@ import net.minecraft.util.math.Direction; import org.jetbrains.annotations.Nullable; -import java.util.List; import java.util.Optional; public class TreeTapBlockEntity extends LootableContainerBlockEntity implements SidedInventory { @@ -134,12 +137,29 @@ public void tryCraft() { Optional recipe = this.world.getRecipeManager().getFirstMatch(ParadiseLostRecipeTypes.TREE_TAP_RECIPE_TYPE, this, this.world); if (recipe.isPresent() && world.random.nextInt(recipe.get().getChance()) == 0) { ItemStack output = recipe.get().craft(this); - stack.decrement(1); + Block convertBlock = recipe.get().getOutputBlock(); + BlockPos attachedPos = this.pos.offset(world.getBlockState(this.pos).get(TreeTapBlock.FACING).getOpposite()); + BlockState attachedBlock = world.getBlockState(attachedPos); + if (convertBlock != Blocks.BEE_NEST) { + stack.decrement(1); - if (!world.isClient) world.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, 0.5f, world.getRandom().nextFloat() * 0.4f + 0.8f); + if (convertBlock != world.getBlockState(this.pos).getBlock()) { + world.setBlockState(attachedPos, convertBlock.getDefaultState(), 0); + } + if (!world.isClient) world.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, 0.5f, world.getRandom().nextFloat() * 0.4f + 0.8f); - this.inventory.set(0, output); - inventoryChanged(); + this.inventory.set(0, output); + inventoryChanged(); + } else if (attachedBlock.get(BeehiveBlock.HONEY_LEVEL) == 5) { + stack.decrement(1); + + world.setBlockState(attachedPos, attachedBlock.with(BeehiveBlock.HONEY_LEVEL, 0)); + + if (!world.isClient) world.playSound(null, pos, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.BLOCKS, 0.5f, world.getRandom().nextFloat() * 0.4f + 0.8f); + + this.inventory.set(0, output); + inventoryChanged(); + } } tryTansferItemsOut(); } diff --git a/src/main/java/net/id/paradiselost/recipe/TreeTapRecipe.java b/src/main/java/net/id/paradiselost/recipe/TreeTapRecipe.java index 2f41e1bf..3203e2e5 100644 --- a/src/main/java/net/id/paradiselost/recipe/TreeTapRecipe.java +++ b/src/main/java/net/id/paradiselost/recipe/TreeTapRecipe.java @@ -18,14 +18,16 @@ public class TreeTapRecipe implements Recipe { protected final Ingredient ingredient; protected final ItemStack output; protected final Block tappedBlock; + protected final Block resultBlock; protected final int chance; - public TreeTapRecipe(Identifier id, String group, Ingredient ingredient, ItemStack output, Block tappedBlock, int chance) { + public TreeTapRecipe(Identifier id, String group, Ingredient ingredient, ItemStack output, Block tappedBlock, Block resultBlock, int chance) { this.id = id; this.group = group; this.ingredient = ingredient; this.output = output; this.tappedBlock = tappedBlock; + this.resultBlock = resultBlock; this.chance = chance; } @@ -53,6 +55,10 @@ public ItemStack getOutput() { return output; } + public Block getOutputBlock() { + return resultBlock; + } + @Override public String getGroup() { return group; diff --git a/src/main/java/net/id/paradiselost/recipe/TreeTapRecipeSerializer.java b/src/main/java/net/id/paradiselost/recipe/TreeTapRecipeSerializer.java index fac13b65..a652717c 100644 --- a/src/main/java/net/id/paradiselost/recipe/TreeTapRecipeSerializer.java +++ b/src/main/java/net/id/paradiselost/recipe/TreeTapRecipeSerializer.java @@ -14,25 +14,27 @@ public record TreeTapRecipeSerializer(TreeTapRecipeSerializer.RecipeFactory recipeFactory) implements RecipeSerializer { public interface RecipeFactory { - TreeTapRecipe create(Identifier id, String group, Ingredient ingredient, ItemStack output, Block tappedBlock, int chance); + TreeTapRecipe create(Identifier id, String group, Ingredient ingredient, ItemStack output, Block tappedBlock, Block resultBlock, int chance); } @Override public TreeTapRecipe read(Identifier identifier, JsonObject jsonObject) { String group = JsonHelper.getString(jsonObject, "group", ""); Ingredient ingredient = Ingredient.fromJson(JsonHelper.getObject(jsonObject, "ingredient")); - Block tappedBlock = Registry.BLOCK.get(Identifier.tryParse(JsonHelper.getString(jsonObject, "tapped_block"))); + Block tappedBlock = Registry.BLOCK.get(Identifier.tryParse(JsonHelper.getString(jsonObject, "tapped_block"))); + Block resultBlock = Registry.BLOCK.get(Identifier.tryParse(JsonHelper.getString(jsonObject, "result_block"))); ItemStack output = RecipeParser.getItemStackWithNbtFromJson(JsonHelper.getObject(jsonObject, "result")); int chance = JsonHelper.getInt(jsonObject, "chance"); - return this.recipeFactory.create(identifier, group, ingredient, output, tappedBlock, chance); + return this.recipeFactory.create(identifier, group, ingredient, output, tappedBlock, resultBlock, chance); } @Override public void write(PacketByteBuf packetByteBuf, TreeTapRecipe recipe) { packetByteBuf.writeString(recipe.group); recipe.ingredient.write(packetByteBuf); - packetByteBuf.writeIdentifier(Registry.BLOCK.getId(recipe.tappedBlock)); + packetByteBuf.writeIdentifier(Registry.BLOCK.getId(recipe.tappedBlock)); + packetByteBuf.writeIdentifier(Registry.BLOCK.getId(recipe.resultBlock)); packetByteBuf.writeItemStack(recipe.output); packetByteBuf.writeInt(recipe.chance); } @@ -41,11 +43,12 @@ public void write(PacketByteBuf packetByteBuf, TreeTapRecipe recipe) { public TreeTapRecipe read(Identifier identifier, PacketByteBuf packetByteBuf) { String group = packetByteBuf.readString(); Ingredient ingredient = Ingredient.fromPacket(packetByteBuf); - Block tappedBlock = Registry.BLOCK.get(packetByteBuf.readIdentifier()); + Block tappedBlock = Registry.BLOCK.get(packetByteBuf.readIdentifier()); + Block resultBlock = Registry.BLOCK.get(packetByteBuf.readIdentifier()); ItemStack output = packetByteBuf.readItemStack(); int chance = packetByteBuf.readInt(); - return this.recipeFactory.create(identifier, group, ingredient, output, tappedBlock, chance); + return this.recipeFactory.create(identifier, group, ingredient, output, tappedBlock, resultBlock, chance); } } diff --git a/src/main/resources/data/paradise_lost/recipes/tree_tap/honey.json b/src/main/resources/data/paradise_lost/recipes/tree_tap/honey.json index ea7e0140..ade86c6c 100644 --- a/src/main/resources/data/paradise_lost/recipes/tree_tap/honey.json +++ b/src/main/resources/data/paradise_lost/recipes/tree_tap/honey.json @@ -4,6 +4,7 @@ "item": "minecraft:glass_bottle" }, "tapped_block": "minecraft:bee_nest", + "result_block": "minecraft:bee_nest", "result": { "item": "minecraft:honey_bottle" }, diff --git a/src/main/resources/data/paradise_lost/recipes/tree_tap/stew.json b/src/main/resources/data/paradise_lost/recipes/tree_tap/stew.json index 0b346c81..1f971c78 100644 --- a/src/main/resources/data/paradise_lost/recipes/tree_tap/stew.json +++ b/src/main/resources/data/paradise_lost/recipes/tree_tap/stew.json @@ -4,6 +4,7 @@ "item": "minecraft:bowl" }, "tapped_block": "minecraft:mushroom_stem", + "result_block": "minecraft:mushroom_stem", "result": { "item": "minecraft:mushroom_stew" }, diff --git a/src/main/resources/data/paradise_lost/recipes/tree_tap/water.json b/src/main/resources/data/paradise_lost/recipes/tree_tap/water.json index d845b093..07be2420 100644 --- a/src/main/resources/data/paradise_lost/recipes/tree_tap/water.json +++ b/src/main/resources/data/paradise_lost/recipes/tree_tap/water.json @@ -4,6 +4,7 @@ "item": "minecraft:glass_bottle" }, "tapped_block": "paradise_lost:wisteria_log", + "result_block": "paradise_lost:wisteria_log", "result": { "item": "minecraft:potion", "nbt": "{Potion: \"minecraft:water\"}" diff --git a/src/main/resources/data/paradise_lost/recipes/tree_tap/water_aurel_bucket.json b/src/main/resources/data/paradise_lost/recipes/tree_tap/water_aurel_bucket.json new file mode 100644 index 00000000..8e49825c --- /dev/null +++ b/src/main/resources/data/paradise_lost/recipes/tree_tap/water_aurel_bucket.json @@ -0,0 +1,12 @@ +{ + "type": "paradise_lost:tree_tap", + "ingredient": { + "item": "paradise_lost:aurel_bucket" + }, + "tapped_block": "paradise_lost:wisteria_log", + "result_block": "paradise_lost:wisteria_log", + "result": { + "item": "paradise_lost:aurel_water_bucket" + }, + "chance": 2 +} diff --git a/src/main/resources/data/paradise_lost/recipes/tree_tap/water_bucket.json b/src/main/resources/data/paradise_lost/recipes/tree_tap/water_bucket.json new file mode 100644 index 00000000..dcbb1ab8 --- /dev/null +++ b/src/main/resources/data/paradise_lost/recipes/tree_tap/water_bucket.json @@ -0,0 +1,12 @@ +{ + "type": "paradise_lost:tree_tap", + "ingredient": { + "item": "minecraft:bucket" + }, + "tapped_block": "paradise_lost:wisteria_log", + "result_block": "paradise_lost:wisteria_log", + "result": { + "item": "minecraft:water_bucket" + }, + "chance": 2 +} From 04342d87f65afca3930b8168ed9e588d88d95c35 Mon Sep 17 00:00:00 2001 From: Maxx <53229958+MBatt1@users.noreply.github.com> Date: Mon, 6 May 2024 21:27:51 -0500 Subject: [PATCH 9/9] when the nitra is throwable #800 --- .../entity/ParadiseLostEntityRenderers.java | 4 + .../entities/ParadiseLostEntityTypes.java | 4 + .../projectile/ThrownNitraEntity.java | 77 +++++++++++++++++++ .../paradiselost/items/ParadiseLostItems.java | 2 +- .../id/paradiselost/items/misc/NitraItem.java | 39 ++++++++++ .../util/ParadiseLostSoundEvents.java | 2 + .../assets/paradise_lost/lang/en_us.json | 4 +- 7 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 src/main/java/net/id/paradiselost/entities/projectile/ThrownNitraEntity.java create mode 100644 src/main/java/net/id/paradiselost/items/misc/NitraItem.java diff --git a/src/main/java/net/id/paradiselost/client/rendering/entity/ParadiseLostEntityRenderers.java b/src/main/java/net/id/paradiselost/client/rendering/entity/ParadiseLostEntityRenderers.java index e9b127e8..4a27a29c 100644 --- a/src/main/java/net/id/paradiselost/client/rendering/entity/ParadiseLostEntityRenderers.java +++ b/src/main/java/net/id/paradiselost/client/rendering/entity/ParadiseLostEntityRenderers.java @@ -8,6 +8,8 @@ import net.id.paradiselost.client.rendering.entity.passive.MoaEntityRenderer; import net.id.paradiselost.entities.ParadiseLostEntityTypes; import net.minecraft.client.render.entity.EntityRendererFactory; +import net.minecraft.client.render.entity.EntityRenderers; +import net.minecraft.client.render.entity.FlyingItemEntityRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -25,6 +27,8 @@ public static void initClient() { register(ParadiseLostEntityTypes.MOA, MoaEntityRenderer::new); // register(ParadiseLostEntityTypes.AMBYST, AmbystRenderer::new); + // projectile + register(ParadiseLostEntityTypes.THROWN_NITRA, FlyingItemEntityRenderer::new); } @SafeVarargs diff --git a/src/main/java/net/id/paradiselost/entities/ParadiseLostEntityTypes.java b/src/main/java/net/id/paradiselost/entities/ParadiseLostEntityTypes.java index 3fc31497..5af8684e 100644 --- a/src/main/java/net/id/paradiselost/entities/ParadiseLostEntityTypes.java +++ b/src/main/java/net/id/paradiselost/entities/ParadiseLostEntityTypes.java @@ -11,6 +11,7 @@ import net.id.paradiselost.entities.passive.ParadiseLostAnimalEntity; import net.id.paradiselost.entities.passive.ambyst.FindLogSensor; import net.id.paradiselost.entities.passive.moa.MoaEntity; +import net.id.paradiselost.entities.projectile.ThrownNitraEntity; import net.id.paradiselost.mixin.brain.ActivityInvoker; import net.id.paradiselost.mixin.brain.MemoryModuleTypeInvoker; import net.id.paradiselost.mixin.brain.SensorTypeInvoker; @@ -56,6 +57,9 @@ public class ParadiseLostEntityTypes { // public static final EntityType AMBYST = add("ambyst", of(AmbystEntity::new, CREATURE, changing(0.6F, 0.42F), 5), // attributes(AmbystEntity::createAmbystAttributes), spawnRestrictions(ParadiseLostAnimalEntity::isValidNaturalParadiseLostSpawn)); + // projectile + public static final EntityType THROWN_NITRA = add("thrown_nitra", of(ThrownNitraEntity::new, MISC, changing(0.5F, 0.5F), 5)); + //Brain public static final Activity HIDEINLOG = ActivityInvoker.invokeRegister(ParadiseLost.locate("hideinlog").toString()); diff --git a/src/main/java/net/id/paradiselost/entities/projectile/ThrownNitraEntity.java b/src/main/java/net/id/paradiselost/entities/projectile/ThrownNitraEntity.java new file mode 100644 index 00000000..c2ec3efa --- /dev/null +++ b/src/main/java/net/id/paradiselost/entities/projectile/ThrownNitraEntity.java @@ -0,0 +1,77 @@ +package net.id.paradiselost.entities.projectile; + +import net.id.paradiselost.ParadiseLost; +import net.id.paradiselost.entities.ParadiseLostEntityTypes; +import net.id.paradiselost.items.ParadiseLostItems; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.mob.BlazeEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.projectile.thrown.SnowballEntity; +import net.minecraft.entity.projectile.thrown.ThrownEntity; +import net.minecraft.entity.projectile.thrown.ThrownItemEntity; +import net.minecraft.item.Item; +import net.minecraft.particle.ParticleEffect; +import net.minecraft.particle.ParticleTypes; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvents; +import net.minecraft.util.hit.EntityHitResult; +import net.minecraft.util.hit.HitResult; +import net.minecraft.util.math.Box; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.minecraft.world.explosion.Explosion; + +public class ThrownNitraEntity extends ThrownItemEntity { + + public ThrownNitraEntity(EntityType entityType, World world) { + super(entityType, world); + } + + public ThrownNitraEntity(World world, LivingEntity owner) { + super(ParadiseLostEntityTypes.THROWN_NITRA, owner, world); + } + + protected void onEntityHit(EntityHitResult entityHitResult) { + super.onEntityHit(entityHitResult); + doDamage(); + } + + protected void onCollision(HitResult hitResult) { + super.onCollision(hitResult); + doDamage(); + if (!this.world.isClient) { + this.world.sendEntityStatus(this, (byte)3); + this.discard(); + } + } + + public void handleStatus(byte status) { + if (status == 3) { + for (int i = 0; i < 4; i++) { + this.world.addParticle(ParticleTypes.EXPLOSION, + this.getX() + this.random.nextDouble() - 0.5, this.getY() + this.random.nextDouble() - 0.5, this.getZ() + this.random.nextDouble() - 0.5, + 0.0, 0.0, 0.0 + ); + } + this.world.playSound(this.getX(), this.getY(), this.getZ(), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.NEUTRAL, 1.0F, 1.1F + this.random.nextFloat() * 0.4F, false); + } + + } + + private void doDamage() { + var hit = this.world.getOtherEntities(this, new Box(this.getX()-1.5, this.getY()-1.5, this.getZ()-1.5, this.getX()+1.5, this.getY()+1.5, this.getZ()+1.5)); + for (Entity e : hit) { + Vec3d diff = this.getPos().subtract(e.getPos()).negate().normalize(); + e.addVelocity(diff.x, diff.y, diff.z); + e.damage(DamageSource.explosion((LivingEntity) null), 2); + } + } + + @Override + protected Item getDefaultItem() { + return ParadiseLostItems.NITRA_BULB; + } +} diff --git a/src/main/java/net/id/paradiselost/items/ParadiseLostItems.java b/src/main/java/net/id/paradiselost/items/ParadiseLostItems.java index a7fc85f6..e27b49f5 100644 --- a/src/main/java/net/id/paradiselost/items/ParadiseLostItems.java +++ b/src/main/java/net/id/paradiselost/items/ParadiseLostItems.java @@ -158,7 +158,7 @@ private static Settings food(FoodComponent foodComponent, Rarity rarity) { public static final Item ORANGE = add("orange", new Item(food(ParadiseLostFoodComponent.ORANGE)), compostable65); public static final AliasedBlockItem AMADRYS_BUSHEL = add("amadrys_bushel", new AliasedBlockItem(ParadiseLostBlocks.AMADRYS, food(ParadiseLostFoodComponent.GENERIC_WORSE)), compostable30); public static final AliasedBlockItem NITRA_SEED = add("nitra", new AliasedBlockItem(ParadiseLostBlocks.NITRA, food()), compostable15); - public static final Item NITRA_BULB = add("nitra_bulb", new Item(food()), compostable50); + public static final Item NITRA_BULB = add("nitra_bulb", new NitraItem(food()), compostable50); public static final Item AMADRYS_NOODLES = add("amadrys_noodles", new StewItem(food(ParadiseLostFoodComponent.AMADRYS_NOODLES))); public static final Item AMADRYS_BREAD = add("amadrys_bread", new Item(food(ParadiseLostFoodComponent.AMADRYS_BREAD))); public static final Item AMADRYS_BREAD_GLAZED = add("amadrys_bread_glazed", new Item(food(ParadiseLostFoodComponent.AMADRYS_BREAD_GLAZED))); diff --git a/src/main/java/net/id/paradiselost/items/misc/NitraItem.java b/src/main/java/net/id/paradiselost/items/misc/NitraItem.java new file mode 100644 index 00000000..34de32bf --- /dev/null +++ b/src/main/java/net/id/paradiselost/items/misc/NitraItem.java @@ -0,0 +1,39 @@ +package net.id.paradiselost.items.misc; + +import net.id.paradiselost.entities.projectile.ThrownNitraEntity; +import net.id.paradiselost.util.ParadiseLostSoundEvents; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.projectile.thrown.SnowballEntity; +import net.minecraft.item.EnderPearlItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.sound.SoundCategory; +import net.minecraft.stat.Stats; +import net.minecraft.util.Hand; +import net.minecraft.util.TypedActionResult; +import net.minecraft.world.World; + +public class NitraItem extends Item { + public NitraItem(Settings settings) { + super(settings); + } + + public TypedActionResult use(World world, PlayerEntity user, Hand hand) { + ItemStack itemStack = user.getStackInHand(hand); + world.playSound(null, user.getX(), user.getY(), user.getZ(), ParadiseLostSoundEvents.ENTITY_NITRA_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); + user.getItemCooldownManager().set(this, 10); + if (!world.isClient) { + ThrownNitraEntity nitraEntity = new ThrownNitraEntity(world, user); + nitraEntity.setItem(itemStack); + nitraEntity.setVelocity(user, user.getPitch(), user.getYaw(), 0.0F, 1.5F, 1.0F); + world.spawnEntity(nitraEntity); + } + + user.incrementStat(Stats.USED.getOrCreateStat(this)); + if (!user.getAbilities().creativeMode) { + itemStack.decrement(1); + } + + return TypedActionResult.success(itemStack, world.isClient()); + } +} diff --git a/src/main/java/net/id/paradiselost/util/ParadiseLostSoundEvents.java b/src/main/java/net/id/paradiselost/util/ParadiseLostSoundEvents.java index 8a3cd737..31a2bbd4 100644 --- a/src/main/java/net/id/paradiselost/util/ParadiseLostSoundEvents.java +++ b/src/main/java/net/id/paradiselost/util/ParadiseLostSoundEvents.java @@ -66,6 +66,8 @@ private ParadiseLostSoundEvents() { public static final SoundEvent ENTITY_MOA_EGG_HATCH = childEvent("entity.moa.egg_hatch", SoundEvents.ENTITY_TURTLE_EGG_HATCH); public static final SoundEvent ENTITY_MOA_STEP = childEvent("entity.moa.step", SoundEvents.ENTITY_PIG_STEP); + public static final SoundEvent ENTITY_NITRA_THROW = childEvent("entity.nitra.throw", SoundEvents.ENTITY_SNOWBALL_THROW); + public static final SoundEvent ENTITY_NIGHTMARE_HURT = event("entity.nightmare.hurt"); public static final SoundEvent ENTITY_NIGHTMARE_DEATH = event("entity.nightmare.death"); public static final SoundEvent ENTITY_NIGHTMARE_AMBIENT = event("entity.nightmare.ambient"); diff --git a/src/main/resources/assets/paradise_lost/lang/en_us.json b/src/main/resources/assets/paradise_lost/lang/en_us.json index d53fc00a..a3a8e7cd 100644 --- a/src/main/resources/assets/paradise_lost/lang/en_us.json +++ b/src/main/resources/assets/paradise_lost/lang/en_us.json @@ -434,7 +434,9 @@ "subtitles.paradise_lost.entity.moa.egg_hatch": "Moa egg hatches", "subtitles.paradise_lost.entity.moa.step": "Moa walks", - "subtitles.paradise_lost.entity.envoy.damage": "Envoy Chimes", + "subtitles.paradise_lost.entity.nitra.throw": "Nitra Flies", + + "subtitles.paradise_lost.entity.moa.step": "Moa walks", "subtitles.paradise_lost.item.armor.equip.olvite": "Olvite armor clanks", "subtitles.paradise_lost.item.armor.equip.glazed_gold": "Glazed Gold armor clinks",