From 874713aaab885c2af68d1a403f37c32d5f9455d4 Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Mon, 14 Dec 2020 22:22:05 +0300 Subject: [PATCH] Fixes, particles, new amber texture --- .../betterend/blocks/BlockRespawnObelisk.java | 29 ++++++++++++++++-- .../betterend/textures/block/amber_block.png | Bin 1789 -> 1885 bytes 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/main/java/ru/betterend/blocks/BlockRespawnObelisk.java b/src/main/java/ru/betterend/blocks/BlockRespawnObelisk.java index 54152b45..77e9192f 100644 --- a/src/main/java/ru/betterend/blocks/BlockRespawnObelisk.java +++ b/src/main/java/ru/betterend/blocks/BlockRespawnObelisk.java @@ -19,6 +19,7 @@ import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.loot.context.LootContext; import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvents; import net.minecraft.state.StateManager; @@ -39,6 +40,7 @@ import ru.betterend.blocks.basis.BlockBase; import ru.betterend.client.render.ERenderLayer; import ru.betterend.interfaces.IColorProvider; import ru.betterend.interfaces.IRenderTypeable; +import ru.betterend.particle.InfusionParticleType; import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndItems; import ru.betterend.util.BlocksHelper; @@ -159,17 +161,38 @@ public class BlockRespawnObelisk extends BlockBase implements IColorProvider, IR ItemStack itemStack = player.getStackInHand(hand); boolean canActivate = itemStack.getItem() == EndItems.AMBER_GEM && itemStack.getCount() > 5; if (hand != Hand.MAIN_HAND || !canActivate) { - if (!world.isClient && !(itemStack.getItem() instanceof BlockItem)) { + if (!world.isClient && !(itemStack.getItem() instanceof BlockItem) && !player.isCreative()) { ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity) player; serverPlayerEntity.sendMessage(new TranslatableText("message.betterend.fail_spawn"), true); } return ActionResult.FAIL; } - if (!world.isClient) { + else if (!world.isClient) { ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity) player; serverPlayerEntity.setSpawnPoint(world.getRegistryKey(), pos, 0.0F, false, false); serverPlayerEntity.sendMessage(new TranslatableText("message.betterend.set_spawn"), true); - world.playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.BLOCK_RESPAWN_ANCHOR_SET_SPAWN, SoundCategory.BLOCKS, 1.0F, 1.0F); + double px = pos.getX() + 0.5; + double py = pos.getY() + 0.5; + double pz = pos.getZ() + 0.5; + InfusionParticleType particle = new InfusionParticleType(new ItemStack(EndItems.AMBER_GEM)); + if (world instanceof ServerWorld) { + double py1 = py; + double py2 = py - 0.2; + if (state.get(SHAPE) == TripleShape.BOTTOM) { + py1 += 1; + py2 += 2; + } + else if (state.get(SHAPE) == TripleShape.MIDDLE) { + py1 += 0; + py2 += 1; + } + else { + py1 -= 2; + } + ((ServerWorld) world).spawnParticles(particle, px, py1, pz, 20, 0.14, 0.5, 0.14, 0.1); + ((ServerWorld) world).spawnParticles(particle, px, py2, pz, 20, 0.14, 0.3, 0.14, 0.1); + } + world.playSound(null, px, py, py, SoundEvents.BLOCK_RESPAWN_ANCHOR_SET_SPAWN, SoundCategory.BLOCKS, 1F, 1F); if (!player.isCreative()) { itemStack.decrement(6); } diff --git a/src/main/resources/assets/betterend/textures/block/amber_block.png b/src/main/resources/assets/betterend/textures/block/amber_block.png index 59866bd77124d40d73d193c0537d03899a9e1366..8cd623db598a0c2c887ffc1b406daf646bb52c4e 100644 GIT binary patch delta 586 zcmey%dzWv51rzJxjaCzxIE)OfOwFxKjVE7bQbut8F&DdwA_nClqpi&E08axxW)OI*uJtP+z;GV}9nm5LL~Qd5+m zf|+^6C5d^-sh%#jN)@>UdYPFiR>YVO(_fyE3N+Hlz{o(?&`8(NBn0McZ3APg$un83 z1)&xtXC&sOr>58{=}*4Q5?7!3EhL+PfziR!#W6(V{M5jWUPl}Re9c~qIo@DaEeP*a z&=70C@q;n^w`yHu@BM;As>-ud8R-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