From a8aa0beed9fa5c19368faf061060cd214439d063 Mon Sep 17 00:00:00 2001 From: reidbhuntley Date: Sun, 27 Jun 2021 11:46:56 -0400 Subject: [PATCH] Curses II - Added (temporary) rendering to the bells - Create soul pulse effects on players holding the Cursed Bell item --- src/generated/resources/.cache/cache | 2 + .../create/blockstates/cursed_bell.json | 124 +++++++++++++++ .../create/models/item/cursed_bell.json | 3 + .../com/simibubi/create/AllBlockPartials.java | 2 + .../java/com/simibubi/create/AllBlocks.java | 15 +- .../com/simibubi/create/AllTileEntities.java | 4 +- .../com/simibubi/create/CreateClient.java | 4 +- .../actors/BellMovementBehaviour.java | 24 ++- .../curiosities/bell/AbstractBellBlock.java | 4 +- .../bell/AbstractBellRenderer.java | 57 +++++++ .../bell/AbstractBellTileEntity.java | 27 +++- .../bell/CursedBellItemPulser.java | 42 +++++ .../bell/CursedBellMovementBehaviour.java | 44 ++++++ .../bell/CursedBellTileEntity.java | 149 ++---------------- .../bell/PeculiarBellTileEntity.java | 5 - .../curiosities/bell/SoulParticle.java | 8 +- .../curiosities/bell/SoulPulseEffect.java | 148 +++++++++++++++++ .../bell/SoulPulseEffectHandler.java | 110 +++++++++++++ .../simibubi/create/events/ClientEvents.java | 6 +- .../create/foundation/data/BlockStateGen.java | 14 +- .../foundation/networking/AllPackets.java | 2 + .../create/models/block/cursed_bell/bell.json | 92 +++++++++++ .../block/cursed_bell/block_ceiling.json | 36 +++++ .../block/cursed_bell/block_double_wall.json | 6 + .../models/block/cursed_bell/block_floor.json | 34 ++++ .../block/cursed_bell/block_single_wall.json | 6 + .../create/models/block/cursed_bell/item.json | 92 +++++++++++ .../assets/create/textures/block/bell.png | Bin 0 -> 836 bytes .../create/textures/block/bell_frame.png | Bin 0 -> 561 bytes .../create/textures/block/bell_frame_side.png | Bin 0 -> 586 bytes 30 files changed, 900 insertions(+), 160 deletions(-) create mode 100644 src/generated/resources/assets/create/blockstates/cursed_bell.json create mode 100644 src/generated/resources/assets/create/models/item/cursed_bell.json create mode 100644 src/main/java/com/simibubi/create/content/curiosities/bell/AbstractBellRenderer.java create mode 100644 src/main/java/com/simibubi/create/content/curiosities/bell/CursedBellItemPulser.java create mode 100644 src/main/java/com/simibubi/create/content/curiosities/bell/CursedBellMovementBehaviour.java create mode 100644 src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffect.java create mode 100644 src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffectHandler.java create mode 100644 src/main/resources/assets/create/models/block/cursed_bell/bell.json create mode 100644 src/main/resources/assets/create/models/block/cursed_bell/block_ceiling.json create mode 100644 src/main/resources/assets/create/models/block/cursed_bell/block_double_wall.json create mode 100644 src/main/resources/assets/create/models/block/cursed_bell/block_floor.json create mode 100644 src/main/resources/assets/create/models/block/cursed_bell/block_single_wall.json create mode 100644 src/main/resources/assets/create/models/block/cursed_bell/item.json create mode 100644 src/main/resources/assets/create/textures/block/bell.png create mode 100644 src/main/resources/assets/create/textures/block/bell_frame.png create mode 100644 src/main/resources/assets/create/textures/block/bell_frame_side.png diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 8db101d0a..a712665a2 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -68,6 +68,7 @@ f0031f5e970b3d5695472ed384950b8631b015ed assets/create/blockstates/creative_moto fe2f78b94c20944399101e7369e2d43324297fb6 assets/create/blockstates/crushing_wheel.json a1dd6cb3daa97ea871290ef7b178d28b564ee2a2 assets/create/blockstates/crushing_wheel_controller.json b1126c191877cff86b4e2de83e1fcbd151451cb7 assets/create/blockstates/cuckoo_clock.json +e8f1222b21e8e2e67d18252f7d3c9eefa650d3b9 assets/create/blockstates/cursed_bell.json b496452f2f7dbbba385e1fc10b560ec266e4b5e7 assets/create/blockstates/cyan_sail.json 4de72f65bff4e5d9c8153fa3adeee6b61d6f912b assets/create/blockstates/cyan_seat.json 2c04d57e56849f243aec8a1e769574d24daac1e9 assets/create/blockstates/cyan_valve_handle.json @@ -1295,6 +1296,7 @@ b359064405d189e2802969715cd5f682ddbf0bb1 assets/create/models/item/crushed_urani 2bb791db62dce6bf2e2227f9b607c131828471fd assets/create/models/item/crushed_zinc_ore.json 823c91f63565db54ec3944a1e90e7aee18e41062 assets/create/models/item/crushing_wheel.json dae5cffa4e1263d6a113469f79fba8695fa8232a assets/create/models/item/cuckoo_clock.json +9826c00050ba493f844e8812cc45153a156c5317 assets/create/models/item/cursed_bell.json 3e3edc9ccded444496d3336926b93bbf1234cd84 assets/create/models/item/cyan_seat.json 523cd531eadaadc45fb356ca58b99a8fe206c3a7 assets/create/models/item/cyan_valve_handle.json f786a43e296d9f10d7c302fe3ae9cddf4ba9984e assets/create/models/item/dark_oak_window.json diff --git a/src/generated/resources/assets/create/blockstates/cursed_bell.json b/src/generated/resources/assets/create/blockstates/cursed_bell.json new file mode 100644 index 000000000..707d3c41f --- /dev/null +++ b/src/generated/resources/assets/create/blockstates/cursed_bell.json @@ -0,0 +1,124 @@ +{ + "variants": { + "attachment=floor,facing=north,powered=false": { + "model": "create:block/cursed_bell/block_floor" + }, + "attachment=ceiling,facing=north,powered=false": { + "model": "create:block/cursed_bell/block_ceiling" + }, + "attachment=single_wall,facing=north,powered=false": { + "model": "create:block/cursed_bell/block_single_wall" + }, + "attachment=double_wall,facing=north,powered=false": { + "model": "create:block/cursed_bell/block_double_wall" + }, + "attachment=floor,facing=south,powered=false": { + "model": "create:block/cursed_bell/block_floor", + "y": 180 + }, + "attachment=ceiling,facing=south,powered=false": { + "model": "create:block/cursed_bell/block_ceiling", + "y": 180 + }, + "attachment=single_wall,facing=south,powered=false": { + "model": "create:block/cursed_bell/block_single_wall", + "y": 180 + }, + "attachment=double_wall,facing=south,powered=false": { + "model": "create:block/cursed_bell/block_double_wall", + "y": 180 + }, + "attachment=floor,facing=west,powered=false": { + "model": "create:block/cursed_bell/block_floor", + "y": 270 + }, + "attachment=ceiling,facing=west,powered=false": { + "model": "create:block/cursed_bell/block_ceiling", + "y": 270 + }, + "attachment=single_wall,facing=west,powered=false": { + "model": "create:block/cursed_bell/block_single_wall", + "y": 270 + }, + "attachment=double_wall,facing=west,powered=false": { + "model": "create:block/cursed_bell/block_double_wall", + "y": 270 + }, + "attachment=floor,facing=east,powered=false": { + "model": "create:block/cursed_bell/block_floor", + "y": 90 + }, + "attachment=ceiling,facing=east,powered=false": { + "model": "create:block/cursed_bell/block_ceiling", + "y": 90 + }, + "attachment=single_wall,facing=east,powered=false": { + "model": "create:block/cursed_bell/block_single_wall", + "y": 90 + }, + "attachment=double_wall,facing=east,powered=false": { + "model": "create:block/cursed_bell/block_double_wall", + "y": 90 + }, + "attachment=floor,facing=north,powered=true": { + "model": "create:block/cursed_bell/block_floor" + }, + "attachment=ceiling,facing=north,powered=true": { + "model": "create:block/cursed_bell/block_ceiling" + }, + "attachment=single_wall,facing=north,powered=true": { + "model": "create:block/cursed_bell/block_single_wall" + }, + "attachment=double_wall,facing=north,powered=true": { + "model": "create:block/cursed_bell/block_double_wall" + }, + "attachment=floor,facing=south,powered=true": { + "model": "create:block/cursed_bell/block_floor", + "y": 180 + }, + "attachment=ceiling,facing=south,powered=true": { + "model": "create:block/cursed_bell/block_ceiling", + "y": 180 + }, + "attachment=single_wall,facing=south,powered=true": { + "model": "create:block/cursed_bell/block_single_wall", + "y": 180 + }, + "attachment=double_wall,facing=south,powered=true": { + "model": "create:block/cursed_bell/block_double_wall", + "y": 180 + }, + "attachment=floor,facing=west,powered=true": { + "model": "create:block/cursed_bell/block_floor", + "y": 270 + }, + "attachment=ceiling,facing=west,powered=true": { + "model": "create:block/cursed_bell/block_ceiling", + "y": 270 + }, + "attachment=single_wall,facing=west,powered=true": { + "model": "create:block/cursed_bell/block_single_wall", + "y": 270 + }, + "attachment=double_wall,facing=west,powered=true": { + "model": "create:block/cursed_bell/block_double_wall", + "y": 270 + }, + "attachment=floor,facing=east,powered=true": { + "model": "create:block/cursed_bell/block_floor", + "y": 90 + }, + "attachment=ceiling,facing=east,powered=true": { + "model": "create:block/cursed_bell/block_ceiling", + "y": 90 + }, + "attachment=single_wall,facing=east,powered=true": { + "model": "create:block/cursed_bell/block_single_wall", + "y": 90 + }, + "attachment=double_wall,facing=east,powered=true": { + "model": "create:block/cursed_bell/block_double_wall", + "y": 90 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/create/models/item/cursed_bell.json b/src/generated/resources/assets/create/models/item/cursed_bell.json new file mode 100644 index 000000000..91c68bdc6 --- /dev/null +++ b/src/generated/resources/assets/create/models/item/cursed_bell.json @@ -0,0 +1,3 @@ +{ + "parent": "create:block/cursed_bell/item" +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllBlockPartials.java b/src/main/java/com/simibubi/create/AllBlockPartials.java index 25d9e0ddb..5c2dcb29b 100644 --- a/src/main/java/com/simibubi/create/AllBlockPartials.java +++ b/src/main/java/com/simibubi/create/AllBlockPartials.java @@ -93,6 +93,8 @@ public class AllBlockPartials { SPOUT_TOP = get("spout/top"), SPOUT_MIDDLE = get("spout/middle"), SPOUT_BOTTOM = get("spout/bottom"), + BELL = get("cursed_bell/bell"), + SPEED_CONTROLLER_BRACKET = get("rotation_speed_controller/bracket"), GOGGLES = get("goggles"), diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index ede9c80ac..6b17ca7ff 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -13,6 +13,7 @@ import com.simibubi.create.AllTags.AllBlockTags; import com.simibubi.create.AllTags.AllItemTags; import com.simibubi.create.content.AllSections; import com.simibubi.create.content.contraptions.base.CasingBlock; +import com.simibubi.create.content.contraptions.components.actors.BellMovementBehaviour; import com.simibubi.create.content.contraptions.components.actors.DrillBlock; import com.simibubi.create.content.contraptions.components.actors.DrillMovementBehaviour; import com.simibubi.create.content.contraptions.components.actors.HarvesterBlock; @@ -115,6 +116,7 @@ import com.simibubi.create.content.contraptions.relays.gauge.GaugeGenerator; import com.simibubi.create.content.contraptions.relays.gearbox.GearboxBlock; import com.simibubi.create.content.curiosities.armor.CopperBacktankBlock; import com.simibubi.create.content.curiosities.bell.CursedBellBlock; +import com.simibubi.create.content.curiosities.bell.CursedBellMovementBehaviour; import com.simibubi.create.content.curiosities.bell.PeculiarBellBlock; import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock; import com.simibubi.create.content.logistics.block.belts.tunnel.BrassTunnelBlock; @@ -192,6 +194,7 @@ import net.minecraft.loot.conditions.ILootCondition.IBuilder; import net.minecraft.loot.conditions.SurvivesExplosion; import net.minecraft.loot.functions.CopyName; import net.minecraft.loot.functions.CopyNbt; +import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.PistonType; import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; @@ -1305,8 +1308,11 @@ public class AllBlocks { public static final BlockEntry PECULIAR_BELL = REGISTRATE.block("peculiar_bell", PeculiarBellBlock::new) .initialProperties(SharedProperties::softMetal) - .blockstate((c, p) -> {}) + .properties(Block.Properties::nonOpaque) + .addLayer(() -> RenderType::getCutoutMipped) .tag(AllBlockTags.BRITTLE.tag) + .onRegister(addMovementBehaviour(new BellMovementBehaviour(PeculiarBellBlock::playSound))) + .blockstate((c, p) -> {}) .item() .model((c, p) -> {}) .build() @@ -1315,11 +1321,12 @@ public class AllBlocks { public static final BlockEntry CURSED_BELL = REGISTRATE.block("cursed_bell", CursedBellBlock::new) .initialProperties(() -> PECULIAR_BELL.get()) + .addLayer(() -> RenderType::getCutoutMipped) .tag(AllBlockTags.BRITTLE.tag) - .blockstate((c, p) -> {}) + .onRegister(addMovementBehaviour(new CursedBellMovementBehaviour())) + .blockstate(BlockStateGen.bell()) .item() - .model((c, p) -> {}) - .build() + .transform(customItemModel()) .register(); // Materials diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index 6037cb86c..2fd983e15 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -119,10 +119,9 @@ import com.simibubi.create.content.contraptions.relays.gearbox.GearshiftTileEnti import com.simibubi.create.content.curiosities.armor.CopperBacktankInstance; import com.simibubi.create.content.curiosities.armor.CopperBacktankRenderer; import com.simibubi.create.content.curiosities.armor.CopperBacktankTileEntity; +import com.simibubi.create.content.curiosities.bell.AbstractBellRenderer; import com.simibubi.create.content.curiosities.bell.CursedBellTileEntity; import com.simibubi.create.content.curiosities.bell.PeculiarBellTileEntity; -import com.simibubi.create.content.curiosities.projector.ChromaticProjectorInstance; -import com.simibubi.create.content.curiosities.projector.ChromaticProjectorTileEntity; import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelInstance; import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelRenderer; import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelTileEntity; @@ -676,6 +675,7 @@ public class AllTileEntities { public static final TileEntityEntry CURSED_BELL = Create.registrate() .tileEntity("cursed_bell", CursedBellTileEntity::new) .validBlocks(AllBlocks.CURSED_BELL) + .renderer(() -> AbstractBellRenderer::new) .register(); public static void register() {} diff --git a/src/main/java/com/simibubi/create/CreateClient.java b/src/main/java/com/simibubi/create/CreateClient.java index 27ed9e633..399d503ef 100644 --- a/src/main/java/com/simibubi/create/CreateClient.java +++ b/src/main/java/com/simibubi/create/CreateClient.java @@ -10,6 +10,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher; import com.simibubi.create.content.contraptions.relays.encased.CasingConnectivity; import com.simibubi.create.content.curiosities.armor.CopperBacktankArmorLayer; +import com.simibubi.create.content.curiosities.bell.SoulPulseEffectHandler; import com.simibubi.create.content.curiosities.weapons.PotatoCannonRenderHandler; import com.simibubi.create.content.curiosities.zapper.ZapperRenderHandler; import com.simibubi.create.content.schematics.ClientSchematicLoader; @@ -67,6 +68,7 @@ public class CreateClient { public static final ZapperRenderHandler ZAPPER_RENDER_HANDLER = new ZapperRenderHandler(); public static final PotatoCannonRenderHandler POTATO_CANNON_RENDER_HANDLER = new PotatoCannonRenderHandler(); + public static final SoulPulseEffectHandler SOUL_PULSE_EFFECT_HANDLER = new SoulPulseEffectHandler(); private static CustomBlockModels customBlockModels; private static CustomItemModels customItemModels; @@ -83,7 +85,7 @@ public class CreateClient { modEventBus.addListener(CreateContexts::flwInit); modEventBus.addListener(AllMaterialSpecs::flwInit); modEventBus.addListener(ContraptionRenderDispatcher::invalidateOnGatherContext); - + ZAPPER_RENDER_HANDLER.register(forgeEventBus); POTATO_CANNON_RENDER_HANDLER.register(forgeEventBus); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/BellMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/BellMovementBehaviour.java index 58417de15..9b5044689 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/BellMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/BellMovementBehaviour.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.contraptions.components.actors; +import java.util.function.BiConsumer; + import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; @@ -7,8 +9,24 @@ import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.world.World; public class BellMovementBehaviour extends MovementBehaviour { + + private BiConsumer soundPlayer; + public static final BiConsumer VANILLA_SOUND = (world, pos) -> { + world.playSound(null, pos, SoundEvents.BLOCK_BELL_USE, SoundCategory.BLOCKS, + 2.0F, 1.0F); + }; + + public BellMovementBehaviour(BiConsumer soundPlayer) { + this.soundPlayer = soundPlayer; + } + + public BellMovementBehaviour() { + this(VANILLA_SOUND); + } + @Override public boolean renderAsNormalTileEntity() { return true; @@ -19,14 +37,12 @@ public class BellMovementBehaviour extends MovementBehaviour { double dotProduct = oldMotion.dotProduct(motion); if (dotProduct <= 0 && (context.relativeMotion.length() != 0) || context.firstMovement) - context.world.playSound(null, new BlockPos(context.position), SoundEvents.BLOCK_BELL_USE, - SoundCategory.BLOCKS, 2.0F, 1.0F); + soundPlayer.accept(context.world, new BlockPos(context.position)); } @Override public void stopMoving(MovementContext context) { if (context.position != null) - context.world.playSound(null, new BlockPos(context.position), SoundEvents.BLOCK_BELL_USE, SoundCategory.BLOCKS, - 2.0F, 1.0F); + soundPlayer.accept(context.world, new BlockPos(context.position)); } } diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/AbstractBellBlock.java b/src/main/java/com/simibubi/create/content/curiosities/bell/AbstractBellBlock.java index f9ff5c0c3..518a374ee 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/bell/AbstractBellBlock.java +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/AbstractBellBlock.java @@ -55,11 +55,11 @@ public abstract class AbstractBellBlock exten if (world.isRemote) return false; - playSound(world, pos, direction); + playSound(world, pos); return true; } - public static void playSound(World world, BlockPos pos, Direction direction) { + public static void playSound(World world, BlockPos pos) { world.playSound(null, pos, SoundEvents.BLOCK_BELL_USE, SoundCategory.BLOCKS, 2.0F, 1.0F); } diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/AbstractBellRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/bell/AbstractBellRenderer.java new file mode 100644 index 000000000..48fe66ed2 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/AbstractBellRenderer.java @@ -0,0 +1,57 @@ +package com.simibubi.create.content.curiosities.bell; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.vertex.IVertexBuilder; +import com.simibubi.create.AllBlockPartials; +import com.simibubi.create.content.logistics.block.redstone.AnalogLeverBlock; +import com.simibubi.create.foundation.render.PartialBufferer; +import com.simibubi.create.foundation.render.SuperByteBuffer; +import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; + +import com.simibubi.create.foundation.utility.AngleHelper; + +import net.minecraft.block.BellBlock; +import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.IRenderTypeBuffer; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.util.Direction; +import net.minecraft.util.math.MathHelper; + +public class AbstractBellRenderer extends SafeTileEntityRenderer { + + public AbstractBellRenderer(TileEntityRendererDispatcher dispatcher) { + super(dispatcher); + } + + @Override + protected void renderSafe(TE te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay) { + BlockState state = te.getBlockState(); + int lightCoords = WorldRenderer.getLightmapCoordinates(te.getWorld(), state, te.getPos()); + IVertexBuilder vb = buffer.getBuffer(RenderType.getCutout()); + + SuperByteBuffer bell = PartialBufferer.get(AllBlockPartials.BELL, state); + + float rY = AngleHelper.horizontalAngle(state.get(BellBlock.field_220133_a)); + bell.rotateCentered(Direction.UP, (float) (rY / 180 * Math.PI)); + + float ringingTicks = (float)te.ringingTicks + partialTicks; + if (te.isRinging) { + float swing = MathHelper.sin(ringingTicks / (float)Math.PI) / (4.0F + ringingTicks / 3.0F); +// if (te.ringDirection == Direction.NORTH) { +// rX = -swing; +// } else if (te.ringDirection == Direction.SOUTH) { +// rX = swing; +// } else if (te.ringDirection == Direction.EAST) { +// rZ = -swing; +// } else if (te.ringDirection == Direction.WEST) { +// rZ = swing; +// } + bell.rotateCentered(te.ringDirection, swing); + } + + bell.light(lightCoords).renderInto(ms, vb); + } + +} diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/AbstractBellTileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/bell/AbstractBellTileEntity.java index d024d395f..3da76a6e0 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/bell/AbstractBellTileEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/AbstractBellTileEntity.java @@ -13,6 +13,12 @@ import java.util.List; public abstract class AbstractBellTileEntity extends SmartTileEntity { + public static final int RING_DURATION = 50; + + public boolean isRinging; + public int ringingTicks; + public Direction ringDirection; + public AbstractBellTileEntity(TileEntityType type) { super(type); } @@ -20,6 +26,25 @@ public abstract class AbstractBellTileEntity extends SmartTileEntity { @Override public void addBehaviours(List behaviours) { } - public abstract boolean ring(World world, BlockPos pos, Direction direction); + public boolean ring(World world, BlockPos pos, Direction direction) { + isRinging = true; + ringingTicks = 0; + ringDirection = direction; + return true; + }; + + @Override + public void tick() { + super.tick(); + + if (isRinging) { + ++ringingTicks; + } + + if (ringingTicks >= RING_DURATION) { + isRinging = false; + ringingTicks = 0; + } + } } diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/CursedBellItemPulser.java b/src/main/java/com/simibubi/create/content/curiosities/bell/CursedBellItemPulser.java new file mode 100644 index 000000000..88e5d743f --- /dev/null +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/CursedBellItemPulser.java @@ -0,0 +1,42 @@ +package com.simibubi.create.content.curiosities.bell; + +import com.simibubi.create.AllBlocks; + +import net.minecraft.block.Block; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.util.Hand; +import net.minecraftforge.event.TickEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.LogicalSide; +import net.minecraftforge.fml.common.Mod.EventBusSubscriber; + +@EventBusSubscriber +public class CursedBellItemPulser { + + public static final int DISTANCE = 2; + public static final int RECHARGE_TICKS = 8; + + @SubscribeEvent + public static void bellItemCreatesPulses(TickEvent.PlayerTickEvent event) { + if (event.phase != TickEvent.Phase.END) + return; + if (event.side != LogicalSide.SERVER) + return; + + if (event.player.world.getGameTime() % RECHARGE_TICKS != 0) + return; + + for (Hand hand : Hand.values()) { + Item held = event.player.getHeldItem(hand).getItem(); + if (!(held instanceof BlockItem)) + continue; + Block block = ((BlockItem) held).getBlock(); + if (!block.is(AllBlocks.CURSED_BELL.get())) + continue; + + SoulPulseEffectHandler.sendPulsePacket(event.player.world, event.player.getBlockPos(), DISTANCE, false); + } + } + +} diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/CursedBellMovementBehaviour.java b/src/main/java/com/simibubi/create/content/curiosities/bell/CursedBellMovementBehaviour.java new file mode 100644 index 000000000..d93662846 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/CursedBellMovementBehaviour.java @@ -0,0 +1,44 @@ +package com.simibubi.create.content.curiosities.bell; + +import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; +import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; + +import net.minecraft.util.math.BlockPos; + +public class CursedBellMovementBehaviour extends MovementBehaviour { + + public static final int DISTANCE = 3; + + @Override + public void tick(MovementContext context) { + int recharge = getRecharge(context); + if (recharge > 0) + setRecharge(context, recharge - 1); + } + + @Override + public void visitNewPosition(MovementContext context, BlockPos pos) { + if (!context.world.isRemote && getRecharge(context) == 0) { + SoulPulseEffectHandler.sendPulsePacket(context.world, pos, DISTANCE, true); + setRecharge(context, CursedBellTileEntity.RECHARGE_TICKS); + CursedBellBlock.playSound(context.world, pos); + } + } + + @Override + public void writeExtraData(MovementContext context) { + context.tileData.putInt("Recharge", getRecharge(context)); + } + + private int getRecharge(MovementContext context) { + if (!(context.temporaryData instanceof Integer) && context.world != null) { + context.temporaryData = context.tileData.getInt("Recharge"); + } + return (Integer) context.temporaryData; + } + + private void setRecharge(MovementContext context, int value) { + context.temporaryData = value; + } + +} diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/CursedBellTileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/bell/CursedBellTileEntity.java index e9523da48..cb1993634 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/bell/CursedBellTileEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/CursedBellTileEntity.java @@ -1,36 +1,24 @@ package com.simibubi.create.content.curiosities.bell; -import java.util.ArrayList; import java.util.List; +import com.simibubi.create.CreateClient; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; -import com.simibubi.create.foundation.utility.NBTHelper; + +import com.sun.org.apache.regexp.internal.RE; import net.minecraft.block.BlockState; -import net.minecraft.entity.EntitySpawnPlacementRegistry; -import net.minecraft.entity.EntityType; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.world.LightType; import net.minecraft.world.World; -import net.minecraft.world.spawner.WorldEntitySpawner; public class CursedBellTileEntity extends AbstractBellTileEntity { - public static final int MAX_DISTANCE = 6; - private static final List> LAYERS = genLayers(); - - public enum Mode { - RUNNING, RECHARGING - } - - public static final int RECHARGE_TICKS = 16; - public static final int TICKS_PER_LAYER = 3; - public int ticks; - public Mode mode = Mode.RECHARGING; + public static final int DISTANCE = 5; + public static final int RECHARGE_TICKS = 60; + public int rechargeTicks = 0; public CursedBellTileEntity(TileEntityType type) { super(type); @@ -41,137 +29,32 @@ public class CursedBellTileEntity extends AbstractBellTileEntity { @Override protected void fromTag(BlockState state, CompoundNBT compound, boolean clientPacket) { - ticks = compound.getInt("Ticks"); - mode = NBTHelper.readEnum(compound, "Mode", Mode.class); + rechargeTicks = compound.getInt("Recharge"); } @Override public void write(CompoundNBT compound, boolean clientPacket) { - compound.putInt("Ticks", ticks); - NBTHelper.writeEnum(compound, "Mode", mode); + compound.putInt("Recharge", rechargeTicks); } @Override public void tick() { super.tick(); - - switch (mode) { - case RECHARGING: - if (ticks > 0) - ticks--; - break; - - case RUNNING: - if (ticks <= 0) - break; - - ticks--; - if (ticks % TICKS_PER_LAYER == 0) { - while (!trySpawnSouls(world, pos, MAX_DISTANCE - ticks / TICKS_PER_LAYER - 1) - && ticks > 0) { - ticks -= TICKS_PER_LAYER; - } - - if (ticks == 0) { - ticks = RECHARGE_TICKS; - mode = Mode.RECHARGING; - } - } - - break; - } - } - - public boolean tryStart() { - if (mode != Mode.RECHARGING || ticks > 0) - return false; - - ticks = TICKS_PER_LAYER*MAX_DISTANCE; - mode = Mode.RUNNING; - if (!world.isRemote) - sendData(); - - return true; + if (rechargeTicks > 0) + rechargeTicks--; } @Override public boolean ring(World world, BlockPos pos, Direction direction) { - return tryStart(); - } - - public static boolean trySpawnSouls(World world, BlockPos at, int layerIdx) { - if (world == null) + if (rechargeTicks > 0) return false; - boolean spawnedAny = false; - List layer = LAYERS.get(layerIdx); - for (BlockPos candidate : layer) { - candidate = candidate.add(at); - - if (!WorldEntitySpawner.canCreatureTypeSpawnAtLocation( - EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, - world, candidate, EntityType.ZOMBIE)) - continue; - - if (world.getLightLevel(LightType.BLOCK, candidate) >= 8) - continue; - - if (!world.isRemote) - return true; - spawnedAny = true; - spawnParticles(world, candidate); + if (!world.isRemote) { + SoulPulseEffectHandler.sendPulsePacket(world, pos, DISTANCE, true); + rechargeTicks = RECHARGE_TICKS; + sendData(); } - return spawnedAny; - } - - public static void spawnParticles(World world, BlockPos at) { - if (world == null || !world.isRemote) - return; - - Vector3d p = Vector3d.of(at); - world.addParticle(new SoulParticle.Data(), p.x + 0.5, p.y + 0.5, p.z + 0.5, 0, 0, 0); - world.addParticle(new SoulBaseParticle.Data(), p.x + 0.5, p.y + 0.01, p.z + 0.5, 0, 0, 0); - } - - private static List> genLayers() { - List> layers = new ArrayList<>(); - for (int i = 0; i < MAX_DISTANCE; i++) - layers.add(new ArrayList<>()); - - for (int x = 0; x < MAX_DISTANCE; x++) { - for (int y = 0; y < MAX_DISTANCE; y++) { - for (int z = 0; z < MAX_DISTANCE; z++) { - BlockPos candidate = new BlockPos(x,y,z); - int dist = 1 + (int)Math.sqrt(candidate.distanceSq(0,0,0,false)); - if (dist == 0 || dist > MAX_DISTANCE) - continue; - - List layer = layers.get(dist - 1); - int start = layer.size(), end = start + 1; - layer.add(candidate); - - if (candidate.getX() != 0) { - layer.add(new BlockPos(-candidate.getX(), candidate.getY(), candidate.getZ())); - end += 1; - } - if (candidate.getY() != 0) { - for (int i = start; i < end; i++) { - BlockPos prev = layer.get(i); - layer.add(new BlockPos(prev.getX(), -prev.getY(), prev.getZ())); - } - end += end - start; - } - if (candidate.getZ() != 0) { - for (int i = start; i < end; i++) { - BlockPos prev = layer.get(i); - layer.add(new BlockPos(prev.getX(), prev.getY(), -prev.getZ())); - } - } - } - } - } - - return layers; + return super.ring(world, pos, direction); } } diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/PeculiarBellTileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/bell/PeculiarBellTileEntity.java index fa0a16e3e..8522bbb73 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/bell/PeculiarBellTileEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/PeculiarBellTileEntity.java @@ -11,9 +11,4 @@ public class PeculiarBellTileEntity extends AbstractBellTileEntity { super(type); } - @Override - public boolean ring(World world, BlockPos pos, Direction direction) { - return true; - } - } diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/SoulParticle.java b/src/main/java/com/simibubi/create/content/curiosities/bell/SoulParticle.java index f2182fcb2..25212b2d1 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/bell/SoulParticle.java +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/SoulParticle.java @@ -39,10 +39,10 @@ public class SoulParticle extends CustomRotationParticle { this.particleScale = 0.5f; this.setSize(this.particleScale, this.particleScale); - this.loopLength = loopFrames + (int) (this.rand.nextFloat() * 4f - 2f); - this.startTicks = startFrames + (int) (this.rand.nextFloat() * 4f - 2f); - this.endTicks = endFrames + (int) (this.rand.nextFloat() * 4f - 2f); - this.numLoops = (int)(3.0F / (this.rand.nextFloat() * 0.36F + 0.64F)); + this.loopLength = loopFrames + (int) (this.rand.nextFloat() * 5f - 4f); + this.startTicks = startFrames + (int) (this.rand.nextFloat() * 5f - 4f); + this.endTicks = endFrames + (int) (this.rand.nextFloat() * 5f - 4f); + this.numLoops = (int)(1f + this.rand.nextFloat() * 2f); this.setFrame(0); this.field_21507 = true; // disable movement diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffect.java b/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffect.java new file mode 100644 index 000000000..59f779041 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffect.java @@ -0,0 +1,148 @@ +package com.simibubi.create.content.curiosities.bell; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import net.minecraft.entity.EntitySpawnPlacementRegistry; +import net.minecraft.entity.EntityType; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.world.LightType; +import net.minecraft.world.World; +import net.minecraft.world.spawner.WorldEntitySpawner; + +public class SoulPulseEffect { + + public static final int MAX_DISTANCE = 5; + private static final List> LAYERS = genLayers(); + + private static final int WAITING_TICKS = 120; + public static final int TICKS_PER_LAYER = 4; + private int ticks; + public final BlockPos pos; + public final int distance; + private List added; + + public SoulPulseEffect(BlockPos pos, int distance, boolean overlaps) { + this.ticks = TICKS_PER_LAYER * distance; + this.pos = pos; + this.distance = distance; + this.added = overlaps ? null : new ArrayList<>(); + } + + public boolean finished() { + return ticks <= -WAITING_TICKS; + } + + public boolean overlaps() { return added == null; } + + public void removeAdded(Collection positions) { + if (!overlaps()) + positions.removeAll(added); + } + + public List tick(World world) { + if (finished()) + return null; + + ticks--; + if (ticks < 0 || ticks % TICKS_PER_LAYER != 0) + return null; + + List spawns = getSoulSpawns(world); + while (spawns.isEmpty() && ticks > 0) { + ticks -= TICKS_PER_LAYER; + spawns.addAll(getSoulSpawns(world)); + } + + if (!overlaps()) + added.addAll(spawns); + + return spawns; + } + + public int currentLayerIdx() { + return distance - ticks / TICKS_PER_LAYER - 1; + } + + public List getSoulSpawns(World world) { + if (world == null) + return new ArrayList<>(); + + return getLayer(currentLayerIdx()).map(p -> p.add(pos)) + .filter(p -> canSpawnSoulAt(world, p)) + .collect(Collectors.toList()); + } + + public static boolean canSpawnSoulAt(World world, BlockPos at) { + return world != null + && WorldEntitySpawner.canCreatureTypeSpawnAtLocation( + EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, + world, at, EntityType.ZOMBIE) + && world.getLightLevel(LightType.BLOCK, at) < 8; + } + + public static void spawnParticles(World world, BlockPos at) { + if (world == null || !world.isRemote) + return; + + Vector3d p = Vector3d.of(at); + world.addParticle(new SoulParticle.Data(), p.x + 0.5, p.y + 0.5, p.z + 0.5, 0, 0, 0); + world.addParticle(new SoulBaseParticle.Data(), p.x + 0.5, p.y + 0.01, p.z + 0.5, 0, 0, 0); + } + + private static List> genLayers() { + List> layers = new ArrayList<>(); + for (int i = 0; i < MAX_DISTANCE; i++) + layers.add(new ArrayList<>()); + + for (int x = 0; x < MAX_DISTANCE; x++) { + for (int y = 0; y < MAX_DISTANCE; y++) { + for (int z = 0; z < MAX_DISTANCE; z++) { + BlockPos candidate = new BlockPos(x,y,z); + + int dist = (int) Math.round(Math.sqrt( + candidate.distanceSq(0,0,0,false))); + if (dist > MAX_DISTANCE) + continue; + if (dist <= 0) + dist = 1; + + List layer = layers.get(dist - 1); + int start = layer.size(), end = start + 1; + layer.add(candidate); + + if (candidate.getX() != 0) { + layer.add(new BlockPos(-candidate.getX(), candidate.getY(), candidate.getZ())); + end += 1; + } + if (candidate.getY() != 0) { + for (int i = start; i < end; i++) { + BlockPos prev = layer.get(i); + layer.add(new BlockPos(prev.getX(), -prev.getY(), prev.getZ())); + } + end += end - start; + } + if (candidate.getZ() != 0) { + for (int i = start; i < end; i++) { + BlockPos prev = layer.get(i); + layer.add(new BlockPos(prev.getX(), prev.getY(), -prev.getZ())); + } + } + } + } + } + + return layers; + } + + public static Stream getLayer(int idx) { + if (idx < 0 || idx >= MAX_DISTANCE) + return Stream.empty(); + return LAYERS.get(idx).stream(); + } + +} diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffectHandler.java b/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffectHandler.java new file mode 100644 index 000000000..95f74d2cd --- /dev/null +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/SoulPulseEffectHandler.java @@ -0,0 +1,110 @@ +package com.simibubi.create.content.curiosities.bell; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +import com.simibubi.create.CreateClient; +import com.simibubi.create.foundation.networking.AllPackets; +import com.simibubi.create.foundation.networking.SimplePacketBase; + +import com.sun.org.apache.xpath.internal.operations.Bool; + +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.fml.network.NetworkEvent; +import net.minecraftforge.fml.network.PacketDistributor; + +public class SoulPulseEffectHandler { + + private List pulses; + private Set occupied; + + public SoulPulseEffectHandler() { + pulses = new ArrayList<>(); + occupied = new HashSet<>(); + } + + public void tick(World world) { + for (SoulPulseEffect pulse : pulses) { + List added = pulse.tick(world); + if (added == null) + continue; + + if (pulse.overlaps()) { + for (BlockPos pos : added) { + SoulPulseEffect.spawnParticles(world, pos); + } + } else { + for (BlockPos pos : added) { + if (occupied.contains(pos)) + continue; + SoulPulseEffect.spawnParticles(world, pos); + occupied.add(pos); + } + } + } + + Map> split = pulses.stream() + .collect(Collectors.partitioningBy(SoulPulseEffect::finished)); + for (SoulPulseEffect finished : split.get(true)) + finished.removeAdded(occupied); + pulses = split.get(false); + } + + public void refresh() { + pulses.clear(); + occupied.clear(); + } + + public static void sendPulsePacket(World world, BlockPos at, int distance, boolean overlaps) { + Chunk chunk = world.getChunkAt(at); + AllPackets.channel.send(PacketDistributor.TRACKING_CHUNK.with(() -> chunk), new Packet(at, distance, overlaps)); + } + + private void handlePulse(BlockPos pos, int distance, boolean overlaps) { + pulses.add(new SoulPulseEffect(pos, distance, overlaps)); + } + + + public static class Packet extends SimplePacketBase { + public BlockPos pos; + public int distance; + public boolean overlaps; + + public Packet(BlockPos pos, int distance, boolean overlaps) { + this.pos = pos; + this.distance = distance; + this.overlaps = overlaps; + } + + public Packet(PacketBuffer buffer) { + pos = new BlockPos(buffer.readInt(), buffer.readInt(), buffer.readInt()); + distance = buffer.readInt(); + overlaps = buffer.readBoolean(); + } + + @Override + public void write(PacketBuffer buffer) { + buffer.writeInt(pos.getX()); + buffer.writeInt(pos.getY()); + buffer.writeInt(pos.getZ()); + buffer.writeInt(distance); + buffer.writeBoolean(overlaps); + } + + @Override + public void handle(Supplier context) { + context.get().enqueueWork(() -> CreateClient.SOUL_PULSE_EFFECT_HANDLER.handlePulse(pos, distance, overlaps)); + context.get().setPacketHandled(true); + } + } + +} diff --git a/src/main/java/com/simibubi/create/events/ClientEvents.java b/src/main/java/com/simibubi/create/events/ClientEvents.java index d6104ba7d..ef8681f3b 100644 --- a/src/main/java/com/simibubi/create/events/ClientEvents.java +++ b/src/main/java/com/simibubi/create/events/ClientEvents.java @@ -25,6 +25,7 @@ import com.simibubi.create.content.contraptions.goggles.GoggleOverlayRenderer; import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorHandler; import com.simibubi.create.content.curiosities.armor.CopperBacktankArmorLayer; +import com.simibubi.create.content.curiosities.bell.SoulPulseEffectHandler; import com.simibubi.create.content.curiosities.tools.BlueprintOverlayRenderer; import com.simibubi.create.content.curiosities.tools.ExtendoGripRenderHandler; import com.simibubi.create.content.curiosities.zapper.ZapperItem; @@ -114,6 +115,7 @@ public class ClientEvents { CreateClient.SCHEMATIC_HANDLER.tick(); CreateClient.ZAPPER_RENDER_HANDLER.tick(); CreateClient.POTATO_CANNON_RENDER_HANDLER.tick(); + CreateClient.SOUL_PULSE_EFFECT_HANDLER.tick(world); ContraptionHandler.tick(world); CapabilityMinecartController.tick(world); @@ -166,9 +168,9 @@ public class ClientEvents { @SubscribeEvent public static void onUnloadWorld(WorldEvent.Unload event) { - if (event.getWorld() - .isRemote()) { + if (event.getWorld().isRemote()) { CreateClient.invalidateRenderers(); + CreateClient.SOUL_PULSE_EFFECT_HANDLER.refresh(); AnimationTickHolder.reset(); } } diff --git a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java index 28cda3be1..12fa64c92 100644 --- a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java @@ -9,6 +9,10 @@ import java.util.Vector; import java.util.function.BiFunction; import java.util.function.Function; +import com.simibubi.create.content.curiosities.bell.CursedBellBlock; + +import net.minecraft.block.BellBlock; + import org.apache.commons.lang3.tuple.Pair; import com.google.common.collect.ImmutableList; @@ -220,9 +224,9 @@ public class BlockStateGen { Boolean powered = state.get(CartAssemblerBlock.POWERED); Boolean backwards = state.get(CartAssemblerBlock.BACKWARDS); RailShape shape = state.get(CartAssemblerBlock.RAIL_SHAPE); - + int yRotation = shape == RailShape.EAST_WEST ? 270 : 0; - if (backwards) + if (backwards) yRotation += 180; return ConfiguredModel.builder() @@ -462,6 +466,12 @@ public class BlockStateGen { }; } + public static NonNullBiConsumer, RegistrateBlockstateProvider> bell() { + return (c, p) -> p.horizontalBlock(c.getEntry(), state -> + AssetLookup.partialBaseModel(c, p, state.get(BlockStateProperties.BELL_ATTACHMENT).getString()) + ); + } + private static void putPart(Map, ModelFile> coreModels, MultiPartBlockStateBuilder builder, Axis axis, String s, boolean up, boolean down, boolean left, boolean right) { Direction positiveAxis = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis); diff --git a/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java b/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java index 4391fbc83..43f96b197 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java +++ b/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java @@ -21,6 +21,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.tra import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.MinecartControllerUpdatePacket; import com.simibubi.create.content.contraptions.fluids.actors.FluidSplashPacket; import com.simibubi.create.content.contraptions.relays.advanced.sequencer.ConfigureSequencedGearshiftPacket; +import com.simibubi.create.content.curiosities.bell.SoulPulseEffectHandler; import com.simibubi.create.content.curiosities.projector.ConfigureProjectorPacket; import com.simibubi.create.content.curiosities.symmetry.SymmetryEffectPacket; import com.simibubi.create.content.curiosities.tools.BlueprintAssignCompleteRecipePacket; @@ -114,6 +115,7 @@ public enum AllPackets { TUNNEL_FLAP(TunnelFlapPacket.class, TunnelFlapPacket::new, PLAY_TO_CLIENT), FUNNEL_FLAP(FunnelFlapPacket.class, FunnelFlapPacket::new, PLAY_TO_CLIENT), POTATO_CANNON(PotatoCannonPacket.class, PotatoCannonPacket::new, PLAY_TO_CLIENT), + SOUL_PULSE(SoulPulseEffectHandler.Packet.class, SoulPulseEffectHandler.Packet::new, PLAY_TO_CLIENT), PERSISTENT_DATA(ISyncPersistentData.Packet.class, ISyncPersistentData.Packet::new, PLAY_TO_CLIENT), ; diff --git a/src/main/resources/assets/create/models/block/cursed_bell/bell.json b/src/main/resources/assets/create/models/block/cursed_bell/bell.json new file mode 100644 index 000000000..dd1b4168c --- /dev/null +++ b/src/main/resources/assets/create/models/block/cursed_bell/bell.json @@ -0,0 +1,92 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "0": "create:block/bell", + "particle": "create:block/bell" + }, + "elements": [ + { + "from": [14, 7, 7], + "to": [16, 9, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "faces": { + "north": {"uv": [10.5, 6, 9.5, 7], "texture": "#0"}, + "east": {"uv": [9.5, 7, 10.5, 8], "rotation": 90, "texture": "#0"}, + "south": {"uv": [9.5, 6, 10.5, 7], "texture": "#0"}, + "west": {"uv": [10, 7, 10.5, 7.5], "texture": "#0"}, + "up": {"uv": [9.5, 5, 10.5, 6], "texture": "#0"}, + "down": {"uv": [9.5, 7, 10.5, 8], "texture": "#0"} + } + }, + { + "from": [0, 7, 7], + "to": [2, 9, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "faces": { + "north": {"uv": [9.5, 6, 10.5, 7], "texture": "#0"}, + "east": {"uv": [10, 7, 10.5, 7.5], "texture": "#0"}, + "south": {"uv": [10.5, 6, 9.5, 7], "texture": "#0"}, + "west": {"uv": [9.5, 7, 10.5, 8], "rotation": 90, "texture": "#0"}, + "up": {"uv": [9.5, 5, 10.5, 6], "rotation": 180, "texture": "#0"}, + "down": {"uv": [9.5, 7, 10.5, 8], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [3, 0, 3], + "to": [13, 2, 13], + "faces": { + "north": {"uv": [0, 15, 5, 16], "texture": "#0"}, + "east": {"uv": [0, 15, 5, 16], "texture": "#0"}, + "south": {"uv": [0, 15, 5, 16], "texture": "#0"}, + "west": {"uv": [0, 15, 5, 16], "texture": "#0"}, + "up": {"uv": [0, 10, 5, 15], "texture": "#0"}, + "down": {"uv": [5, 10, 10, 15], "texture": "#0"} + } + }, + { + "from": [4, 2, 4], + "to": [12, 11, 12], + "faces": { + "north": {"uv": [8, 0, 12, 4.5], "texture": "#0"}, + "east": {"uv": [8, 0, 12, 4.5], "texture": "#0"}, + "south": {"uv": [8, 0, 12, 4.5], "texture": "#0"}, + "west": {"uv": [8, 0, 12, 4.5], "texture": "#0"}, + "up": {"uv": [12, 0, 16, 4], "texture": "#0"} + } + }, + { + "from": [7, 11, 7], + "to": [9, 15, 9], + "faces": { + "north": {"uv": [8, 6, 9, 8], "texture": "#0"}, + "east": {"uv": [8, 6, 9, 8], "texture": "#0"}, + "south": {"uv": [8, 6, 9, 8], "texture": "#0"}, + "west": {"uv": [8, 6, 9, 8], "texture": "#0"}, + "up": {"uv": [8, 5, 9, 6], "texture": "#0"} + } + }, + { + "from": [0, 0, 8], + "to": [16, 16, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8.5]}, + "faces": { + "north": {"uv": [0, 0, 8, 8], "texture": "#0"} + } + }, + { + "from": [0, 0, 7], + "to": [16, 16, 8], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8.5]}, + "faces": { + "south": {"uv": [0, 0, 8, 8], "texture": "#0"} + } + } + ], + "groups": [ + { + "name": "Bell", + "origin": [8, 8, 8], + "children": [0, 1, 2, 3, 4, 5, 6] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/cursed_bell/block_ceiling.json b/src/main/resources/assets/create/models/block/cursed_bell/block_ceiling.json new file mode 100644 index 000000000..c3879f2cc --- /dev/null +++ b/src/main/resources/assets/create/models/block/cursed_bell/block_ceiling.json @@ -0,0 +1,36 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "1": "create:block/bell_frame_side", + "2": "create:block/bell_frame" + }, + "elements": [ + { + "from": [0.1, 0, 0], + "to": [15.9, 16, 16], + "rotation": {"angle": 0, "axis": "x", "origin": [8, 8, 8]}, + "faces": { + "east": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"}, + "west": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"}, + "up": {"uv": [0, 0, 15.8, 16], "texture": "#2"} + } + }, + { + "from": [15.9, 0, 0], + "to": [0.1, 16, 16], + "rotation": {"angle": 0, "axis": "x", "origin": [8, 8, 8]}, + "faces": { + "east": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"}, + "west": {"uv": [0, 0, 16, 16], "rotation": 180, "texture": "#1"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#2"} + } + } + ], + "groups": [ + { + "name": "Frame", + "origin": [8, 8, 8], + "children": [0, 1] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/cursed_bell/block_double_wall.json b/src/main/resources/assets/create/models/block/cursed_bell/block_double_wall.json new file mode 100644 index 000000000..990f666e1 --- /dev/null +++ b/src/main/resources/assets/create/models/block/cursed_bell/block_double_wall.json @@ -0,0 +1,6 @@ +{ + "credit": "Made with Blockbench", + "textures": {}, + "elements": [], + "groups": [] +} diff --git a/src/main/resources/assets/create/models/block/cursed_bell/block_floor.json b/src/main/resources/assets/create/models/block/cursed_bell/block_floor.json new file mode 100644 index 000000000..f18e39060 --- /dev/null +++ b/src/main/resources/assets/create/models/block/cursed_bell/block_floor.json @@ -0,0 +1,34 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "1": "create:block/bell_frame_side", + "2": "create:block/bell_frame" + }, + "elements": [ + { + "from": [0.1, 0, 0], + "to": [15.9, 16, 16], + "faces": { + "east": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "down": {"uv": [0, 0, 15.8, 16], "texture": "#2"} + } + }, + { + "from": [15.9, 0, 0], + "to": [0.1, 16, 16], + "faces": { + "east": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#1"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#2"} + } + } + ], + "groups": [ + { + "name": "Frame", + "origin": [8, 8, 8], + "children": [0, 1] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/cursed_bell/block_single_wall.json b/src/main/resources/assets/create/models/block/cursed_bell/block_single_wall.json new file mode 100644 index 000000000..420017990 --- /dev/null +++ b/src/main/resources/assets/create/models/block/cursed_bell/block_single_wall.json @@ -0,0 +1,6 @@ +{ + "credit": "Made with Blockbench", + "textures": {}, + "elements": [], + "groups": [] +} diff --git a/src/main/resources/assets/create/models/block/cursed_bell/item.json b/src/main/resources/assets/create/models/block/cursed_bell/item.json new file mode 100644 index 000000000..dd1b4168c --- /dev/null +++ b/src/main/resources/assets/create/models/block/cursed_bell/item.json @@ -0,0 +1,92 @@ +{ + "credit": "Made with Blockbench", + "textures": { + "0": "create:block/bell", + "particle": "create:block/bell" + }, + "elements": [ + { + "from": [14, 7, 7], + "to": [16, 9, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "faces": { + "north": {"uv": [10.5, 6, 9.5, 7], "texture": "#0"}, + "east": {"uv": [9.5, 7, 10.5, 8], "rotation": 90, "texture": "#0"}, + "south": {"uv": [9.5, 6, 10.5, 7], "texture": "#0"}, + "west": {"uv": [10, 7, 10.5, 7.5], "texture": "#0"}, + "up": {"uv": [9.5, 5, 10.5, 6], "texture": "#0"}, + "down": {"uv": [9.5, 7, 10.5, 8], "texture": "#0"} + } + }, + { + "from": [0, 7, 7], + "to": [2, 9, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "faces": { + "north": {"uv": [9.5, 6, 10.5, 7], "texture": "#0"}, + "east": {"uv": [10, 7, 10.5, 7.5], "texture": "#0"}, + "south": {"uv": [10.5, 6, 9.5, 7], "texture": "#0"}, + "west": {"uv": [9.5, 7, 10.5, 8], "rotation": 90, "texture": "#0"}, + "up": {"uv": [9.5, 5, 10.5, 6], "rotation": 180, "texture": "#0"}, + "down": {"uv": [9.5, 7, 10.5, 8], "rotation": 180, "texture": "#0"} + } + }, + { + "from": [3, 0, 3], + "to": [13, 2, 13], + "faces": { + "north": {"uv": [0, 15, 5, 16], "texture": "#0"}, + "east": {"uv": [0, 15, 5, 16], "texture": "#0"}, + "south": {"uv": [0, 15, 5, 16], "texture": "#0"}, + "west": {"uv": [0, 15, 5, 16], "texture": "#0"}, + "up": {"uv": [0, 10, 5, 15], "texture": "#0"}, + "down": {"uv": [5, 10, 10, 15], "texture": "#0"} + } + }, + { + "from": [4, 2, 4], + "to": [12, 11, 12], + "faces": { + "north": {"uv": [8, 0, 12, 4.5], "texture": "#0"}, + "east": {"uv": [8, 0, 12, 4.5], "texture": "#0"}, + "south": {"uv": [8, 0, 12, 4.5], "texture": "#0"}, + "west": {"uv": [8, 0, 12, 4.5], "texture": "#0"}, + "up": {"uv": [12, 0, 16, 4], "texture": "#0"} + } + }, + { + "from": [7, 11, 7], + "to": [9, 15, 9], + "faces": { + "north": {"uv": [8, 6, 9, 8], "texture": "#0"}, + "east": {"uv": [8, 6, 9, 8], "texture": "#0"}, + "south": {"uv": [8, 6, 9, 8], "texture": "#0"}, + "west": {"uv": [8, 6, 9, 8], "texture": "#0"}, + "up": {"uv": [8, 5, 9, 6], "texture": "#0"} + } + }, + { + "from": [0, 0, 8], + "to": [16, 16, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8.5]}, + "faces": { + "north": {"uv": [0, 0, 8, 8], "texture": "#0"} + } + }, + { + "from": [0, 0, 7], + "to": [16, 16, 8], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8.5]}, + "faces": { + "south": {"uv": [0, 0, 8, 8], "texture": "#0"} + } + } + ], + "groups": [ + { + "name": "Bell", + "origin": [8, 8, 8], + "children": [0, 1, 2, 3, 4, 5, 6] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/create/textures/block/bell.png b/src/main/resources/assets/create/textures/block/bell.png new file mode 100644 index 0000000000000000000000000000000000000000..cd05091a99c2ccee7bb9cdfd7e98f2d81da5b7af GIT binary patch literal 836 zcmV-K1H1f*P)XgC3K`4osE=K8AC`k?7><~xcdB1btcYS$jlKb8RrygkUdH4K% z=iGCD5=ca0_$lmv`5={rs>rcLk>6X=|FNgibKuDrMokb-TgoMO?jnuQosA1p33o2#6JYrfJV^T*fxd@+20#L)mJB}_wVV+?Gsl(Zrsb@#2r%)KFZYyKvW&bY|x&Tdui3|FhdLuS@8AEWz$ra&fRQGY(VP8 zZ7|1m*6oXlXbS@rnv*+)Rl_`&s0b!r9@tN#xJ|2lAY~1L4*%#(xdbmZzfVsJTkCH9 zw5x>kGKPV!-Hu}v{^v9fv2gH2!DIZ{y5*e+aOyV91vqwOXYrF801qStXLqLoVvpi9 z775+=uR3mq-R&kknA`wX>c?%EHM{41PQN&=+yJm8kLaiZc`6XB-@h3Cd!dZF;?_cU zCodIh$8~%jHMGN6+uUT2zfq*)?A(lA#Q>O=3cMmG8A1mj z@DAwi{u)um9Ap;ghKPD}apA?c)eC=%l5Bj}gm_SMOmUxDB&hOzu%Su7eqz2hmF1{Kl(Y z7)ms*GbHf%80rD{D;S1}r&ih%&Lg&}6zu~7cRJV4{v?MqPiE@fEX>4Tx04R}tkv&MmKpe$iQ?()$K|4rs$WWau6curlDi*;)X)CnqU~=h)(4-+r zad8w}3l4rPRvlcNb#-tR1i=pwH#a9m7b)?7NufoI2gm(*ckglc4iFj@rkY(bK-DZG zorsIM{E8TOMGwLlgov2LOg))d$ij1c-NVP%yC~1{KKJM7R|+Nrd?N8I(+!Jwop^fF z(mC%Fhgexsh|h_~4Z0xlBiCh@-#C{X7IJYS=&p7NWFjq?kz4e%!+!cKj)F$>iDq zBgZ_dP$4;f@IUz7ty!F$aFc>@p!>zPKSqJTF3_yo_V=-EH%|cnGjOG~{nZ9A^GSNW ztwoN2fo~U-2exN zz*vd0*F4_c+u7T{XIlOJ0MUhV&C^>-^Z)<=24YJ`L;xxPDgY{+Q-(SK000SaNLh0L z01FcU01FcV0GgZ_00007bV*G`2jvDD5+n*VCLL@5001pXL_t(I%VRt_-RD081%Qcx zLcjuJm}hQbBt;|4EX>4Tx04R}tkv&MmKpe$iQ?()$K|4rs$WWau6curlDi*;)X)CnqU~=h)(4-+r zad8w}3l4rPRvlcNb#-tR1i=pwH#a9m7b)?7NufoI2gm(*ckglc4iFj@rkY(bK-DZG zorsIM{E8TOMGwLlgov2LOg))d$ij1c-NVP%yC~1{KKJM7R|+Nrd?N8I(+!Jwop^fF z(mC%Fhgexsh|h_~4Z0xlBiCh@-#C{X7IJYS=&p7NWFjq?kz4e%!+!cKj)F$>iDq zBgZ_dP$4;f@IUz7ty!F$aFc>@p!>zPKSqJTF3_yo_V=-EH%|cnGjOG~{nZ9A^GSNW ztwoN2fo~U-2exN zz*vd0*F4_c+u7T{XIlOJ0MUhV&C^>-^Z)<=24YJ`L;xxPDgY{+Q-(SK000SaNLh0L z01FcU01FcV0GgZ_00007bV*G`2jvDD5+f5I3?pj*002fwL_t(I%VS^|1%n)%obL1g zMw&z; Y0OG|uxz*;j-2eap07*qoM6N<$g4}`n%>V!Z literal 0 HcmV?d00001