diff --git a/src/main/java/galena/oreganized/Oreganized.java b/src/main/java/galena/oreganized/Oreganized.java index b8faed72..6e5539dd 100644 --- a/src/main/java/galena/oreganized/Oreganized.java +++ b/src/main/java/galena/oreganized/Oreganized.java @@ -197,7 +197,6 @@ private void setup(FMLCommonSetupEvent event) { PotionBrewing.addMix(Potions.WATER, OItems.LEAD_INGOT.get(), OPotions.STUNNING.get()); PotionBrewing.addMix(OPotions.STUNNING.get(), Items.REDSTONE, OPotions.LONG_STUNNING.get()); - PotionBrewing.addMix(OPotions.STUNNING.get(), Items.GLOWSTONE_DUST, OPotions.STRONG_STUNNING.get()); FireBlock fire = (FireBlock) Blocks.FIRE; fire.setFlammable(OBlocks.SHRAPNEL_BOMB.get(), 15, 100); diff --git a/src/main/java/galena/oreganized/content/block/GargoyleBlock.java b/src/main/java/galena/oreganized/content/block/GargoyleBlock.java index 50b661fc..e27a2af3 100644 --- a/src/main/java/galena/oreganized/content/block/GargoyleBlock.java +++ b/src/main/java/galena/oreganized/content/block/GargoyleBlock.java @@ -146,7 +146,7 @@ public static Vec3 offset(BlockState state, BlockPos pos, double spread) { double offsetZ = facing.getAxis() == Direction.Axis.Z ? facing.getStepZ() * attachment.horizontalOffset : spread; double x = pos.getX() + 0.5 + offsetX; - double y = pos.getY() + attachment.verticalOffset; + double y = pos.getY() + attachment.verticalOffset + 0.05; double z = pos.getZ() + 0.5 + offsetZ; return new Vec3(x, y, z); diff --git a/src/main/java/galena/oreganized/content/block/ICrystalGlass.java b/src/main/java/galena/oreganized/content/block/ICrystalGlass.java index 4739dbcb..83dacc13 100644 --- a/src/main/java/galena/oreganized/content/block/ICrystalGlass.java +++ b/src/main/java/galena/oreganized/content/block/ICrystalGlass.java @@ -18,7 +18,7 @@ default int getType(BlockPlaceContext context) { if (above.getValue(TYPE) == NORMAL && below.getValue(TYPE) == ROTATED) return INNER; } - return context.getPlayer() != null && context.getPlayer().isCrouching() ? ROTATED : NORMAL; + return context.getPlayer() != null && context.getPlayer().isShiftKeyDown() ? ROTATED : NORMAL; } } diff --git a/src/main/java/galena/oreganized/content/entity/GargoyleBlockEntity.java b/src/main/java/galena/oreganized/content/entity/GargoyleBlockEntity.java index e83f0dcf..250a8782 100644 --- a/src/main/java/galena/oreganized/content/entity/GargoyleBlockEntity.java +++ b/src/main/java/galena/oreganized/content/entity/GargoyleBlockEntity.java @@ -10,6 +10,7 @@ import galena.oreganized.network.packet.GargoyleParticlePacket; import galena.oreganized.world.ScaredOfGargoyleGoal; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; @@ -19,19 +20,16 @@ import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.MobType; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import net.minecraftforge.network.PacketDistributor; -import org.checkerframework.checker.units.qual.C; import org.jetbrains.annotations.Nullable; import java.util.Collection; @@ -47,8 +45,17 @@ public class GargoyleBlockEntity extends BlockEntity { private ParticleOptions drippingFluid; + private final Direction fluidOffset; + public GargoyleBlockEntity(BlockPos pos, BlockState state) { super(OBlockEntities.GARGOYLE.get(), pos, state); + var attachment = state.getValue(GargoyleBlock.ATTACHMENT); + var facing = state.getValue(GargoyleBlock.FACING); + if (attachment == GargoyleBlock.AttachmentType.FLOOR) { + fluidOffset = Direction.DOWN; + } else { + fluidOffset = facing; + } } private static Collection getTargets(Level level, BlockPos pos) { @@ -89,13 +96,21 @@ public static void tick(Level level, BlockPos pos, BlockState state, GargoyleBlo private void updateDripParticles(Level level, BlockPos pos, BlockState state) { for (int i = 1; i <= 2; i++) { - var targetPos = pos.below(i); + var targetPos = pos.relative(fluidOffset, i); var targetState = level.getBlockState(targetPos); var fluid = targetState.getFluidState(); if (!fluid.isEmpty()) { drippingFluid = fluid.getDripParticle(); return; } + + if(!targetState.isRedstoneConductor(level, pos)) { + break; + } + + if (!targetState.isFaceSturdy(level, pos, Direction.UP) || !targetState.isFaceSturdy(level, pos, Direction.DOWN)) { + break; + } } if (level.isRainingAt(pos.above())) { diff --git a/src/main/java/galena/oreganized/content/item/ScribeItem.java b/src/main/java/galena/oreganized/content/item/ScribeItem.java index d628583d..7737507a 100644 --- a/src/main/java/galena/oreganized/content/item/ScribeItem.java +++ b/src/main/java/galena/oreganized/content/item/ScribeItem.java @@ -2,6 +2,9 @@ import galena.oreganized.content.block.ICrystalGlass; import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.BlockParticleOption; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.sounds.SoundEvents; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; @@ -14,6 +17,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.Vec3; import static galena.oreganized.index.OTags.Blocks.MINEABLE_WITH_SCRIBE; import static galena.oreganized.index.OTags.Blocks.SILKTOUCH_WITH_SCRIBE; @@ -69,13 +73,23 @@ public InteractionResult useOn(UseOnContext context) { if (state.hasProperty(ICrystalGlass.TYPE)) { var type = state.getValue(ICrystalGlass.TYPE); + level.setBlockAndUpdate(pos, state.setValue(ICrystalGlass.TYPE, (type + 1) % (ICrystalGlass.MAX_TYPE + 1))); level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(context.getPlayer(), state)); + level.addDestroyBlockEffect(pos, state); + + var vec = Vec3.atCenterOf(pos); + level.addParticle(new BlockParticleOption(ParticleTypes.BLOCK, state), vec.x, vec.y + 1, vec.z, 0.0, 0.0, 0.0); + if (context.getPlayer() != null) { + context.getPlayer().playSound(SoundEvents.GRINDSTONE_USE, 1F, 1.5F); + context.getItemInHand().hurtAndBreak(1, context.getPlayer(), player -> { player.broadcastBreakEvent(context.getHand()); }); } + + return InteractionResult.sidedSuccess(level.isClientSide); } return super.useOn(context); diff --git a/src/main/java/galena/oreganized/index/OPotions.java b/src/main/java/galena/oreganized/index/OPotions.java index 433d3f72..478df850 100644 --- a/src/main/java/galena/oreganized/index/OPotions.java +++ b/src/main/java/galena/oreganized/index/OPotions.java @@ -11,7 +11,6 @@ public class OPotions { public static final DeferredRegister POTIONS = DeferredRegister.create(ForgeRegistries.POTIONS, Oreganized.MOD_ID); - public static final RegistryObject STUNNING = POTIONS.register("stunning", () -> new Potion("stunning", new MobEffectInstance(OEffects.STUNNING.get(), 900))); - public static final RegistryObject LONG_STUNNING = POTIONS.register("long_stunning", () -> new Potion("stunning", new MobEffectInstance(OEffects.STUNNING.get(), 1800))); - public static final RegistryObject STRONG_STUNNING = POTIONS.register("strong_stunning", () -> new Potion("stunning", new MobEffectInstance(OEffects.STUNNING.get(), 900, 1))); + public static final RegistryObject STUNNING = POTIONS.register("stunning", () -> new Potion("stunning", new MobEffectInstance(OEffects.STUNNING.get(), 1800))); + public static final RegistryObject LONG_STUNNING = POTIONS.register("long_stunning", () -> new Potion("stunning", new MobEffectInstance(OEffects.STUNNING.get(), 3600))); } diff --git a/src/main/java/galena/oreganized/world/event/PlayerEvents.java b/src/main/java/galena/oreganized/world/event/PlayerEvents.java index 8b56654e..36c354cd 100644 --- a/src/main/java/galena/oreganized/world/event/PlayerEvents.java +++ b/src/main/java/galena/oreganized/world/event/PlayerEvents.java @@ -25,6 +25,7 @@ import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.ToolAction; import net.minecraftforge.common.ToolActions; @@ -94,6 +95,8 @@ public static void blockItemInteractions(final PlayerInteractEvent.RightClickBlo player.drop(newDisc, false); //return; } + + world.setBlockAndUpdate(pos, Blocks.CAULDRON.defaultBlockState()); } }