Skip to content

Commit 423cc13

Browse files
committed
tweaks to scribe glass cycle, gargoyle particles
1 parent 66fc331 commit 423cc13

File tree

7 files changed

+40
-10
lines changed

7 files changed

+40
-10
lines changed

src/main/java/galena/oreganized/Oreganized.java

-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ private void setup(FMLCommonSetupEvent event) {
197197

198198
PotionBrewing.addMix(Potions.WATER, OItems.LEAD_INGOT.get(), OPotions.STUNNING.get());
199199
PotionBrewing.addMix(OPotions.STUNNING.get(), Items.REDSTONE, OPotions.LONG_STUNNING.get());
200-
PotionBrewing.addMix(OPotions.STUNNING.get(), Items.GLOWSTONE_DUST, OPotions.STRONG_STUNNING.get());
201200

202201
FireBlock fire = (FireBlock) Blocks.FIRE;
203202
fire.setFlammable(OBlocks.SHRAPNEL_BOMB.get(), 15, 100);

src/main/java/galena/oreganized/content/block/GargoyleBlock.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public static Vec3 offset(BlockState state, BlockPos pos, double spread) {
146146
double offsetZ = facing.getAxis() == Direction.Axis.Z ? facing.getStepZ() * attachment.horizontalOffset : spread;
147147

148148
double x = pos.getX() + 0.5 + offsetX;
149-
double y = pos.getY() + attachment.verticalOffset;
149+
double y = pos.getY() + attachment.verticalOffset + 0.05;
150150
double z = pos.getZ() + 0.5 + offsetZ;
151151

152152
return new Vec3(x, y, z);

src/main/java/galena/oreganized/content/block/ICrystalGlass.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ default int getType(BlockPlaceContext context) {
1818
if (above.getValue(TYPE) == NORMAL && below.getValue(TYPE) == ROTATED) return INNER;
1919
}
2020

21-
return context.getPlayer() != null && context.getPlayer().isCrouching() ? ROTATED : NORMAL;
21+
return context.getPlayer() != null && context.getPlayer().isShiftKeyDown() ? ROTATED : NORMAL;
2222
}
2323

2424
}

src/main/java/galena/oreganized/content/entity/GargoyleBlockEntity.java

+19-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import galena.oreganized.network.packet.GargoyleParticlePacket;
1111
import galena.oreganized.world.ScaredOfGargoyleGoal;
1212
import net.minecraft.core.BlockPos;
13+
import net.minecraft.core.Direction;
1314
import net.minecraft.core.particles.ParticleOptions;
1415
import net.minecraft.core.particles.ParticleTypes;
1516
import net.minecraft.nbt.CompoundTag;
@@ -19,19 +20,16 @@
1920
import net.minecraft.util.valueproviders.UniformInt;
2021
import net.minecraft.world.InteractionResult;
2122
import net.minecraft.world.entity.Entity;
22-
import net.minecraft.world.entity.LivingEntity;
2323
import net.minecraft.world.entity.Mob;
2424
import net.minecraft.world.entity.MobType;
2525
import net.minecraft.world.entity.player.Player;
2626
import net.minecraft.world.item.ItemStack;
2727
import net.minecraft.world.level.Level;
28-
import net.minecraft.world.level.block.Block;
2928
import net.minecraft.world.level.block.entity.BlockEntity;
3029
import net.minecraft.world.level.block.state.BlockState;
3130
import net.minecraft.world.phys.AABB;
3231
import net.minecraft.world.phys.Vec3;
3332
import net.minecraftforge.network.PacketDistributor;
34-
import org.checkerframework.checker.units.qual.C;
3533
import org.jetbrains.annotations.Nullable;
3634

3735
import java.util.Collection;
@@ -47,8 +45,17 @@ public class GargoyleBlockEntity extends BlockEntity {
4745

4846
private ParticleOptions drippingFluid;
4947

48+
private final Direction fluidOffset;
49+
5050
public GargoyleBlockEntity(BlockPos pos, BlockState state) {
5151
super(OBlockEntities.GARGOYLE.get(), pos, state);
52+
var attachment = state.getValue(GargoyleBlock.ATTACHMENT);
53+
var facing = state.getValue(GargoyleBlock.FACING);
54+
if (attachment == GargoyleBlock.AttachmentType.FLOOR) {
55+
fluidOffset = Direction.DOWN;
56+
} else {
57+
fluidOffset = facing;
58+
}
5259
}
5360

5461
private static Collection<Mob> getTargets(Level level, BlockPos pos) {
@@ -89,13 +96,21 @@ public static void tick(Level level, BlockPos pos, BlockState state, GargoyleBlo
8996

9097
private void updateDripParticles(Level level, BlockPos pos, BlockState state) {
9198
for (int i = 1; i <= 2; i++) {
92-
var targetPos = pos.below(i);
99+
var targetPos = pos.relative(fluidOffset, i);
93100
var targetState = level.getBlockState(targetPos);
94101
var fluid = targetState.getFluidState();
95102
if (!fluid.isEmpty()) {
96103
drippingFluid = fluid.getDripParticle();
97104
return;
98105
}
106+
107+
if(!targetState.isRedstoneConductor(level, pos)) {
108+
break;
109+
}
110+
111+
if (!targetState.isFaceSturdy(level, pos, Direction.UP) || !targetState.isFaceSturdy(level, pos, Direction.DOWN)) {
112+
break;
113+
}
99114
}
100115

101116
if (level.isRainingAt(pos.above())) {

src/main/java/galena/oreganized/content/item/ScribeItem.java

+14
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import galena.oreganized.content.block.ICrystalGlass;
44
import net.minecraft.core.BlockPos;
5+
import net.minecraft.core.particles.BlockParticleOption;
6+
import net.minecraft.core.particles.ParticleTypes;
7+
import net.minecraft.sounds.SoundEvents;
58
import net.minecraft.world.InteractionResult;
69
import net.minecraft.world.entity.EquipmentSlot;
710
import net.minecraft.world.entity.LivingEntity;
@@ -14,6 +17,7 @@
1417
import net.minecraft.world.level.Level;
1518
import net.minecraft.world.level.block.state.BlockState;
1619
import net.minecraft.world.level.gameevent.GameEvent;
20+
import net.minecraft.world.phys.Vec3;
1721

1822
import static galena.oreganized.index.OTags.Blocks.MINEABLE_WITH_SCRIBE;
1923
import static galena.oreganized.index.OTags.Blocks.SILKTOUCH_WITH_SCRIBE;
@@ -69,13 +73,23 @@ public InteractionResult useOn(UseOnContext context) {
6973

7074
if (state.hasProperty(ICrystalGlass.TYPE)) {
7175
var type = state.getValue(ICrystalGlass.TYPE);
76+
7277
level.setBlockAndUpdate(pos, state.setValue(ICrystalGlass.TYPE, (type + 1) % (ICrystalGlass.MAX_TYPE + 1)));
7378
level.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(context.getPlayer(), state));
79+
level.addDestroyBlockEffect(pos, state);
80+
81+
var vec = Vec3.atCenterOf(pos);
82+
level.addParticle(new BlockParticleOption(ParticleTypes.BLOCK, state), vec.x, vec.y + 1, vec.z, 0.0, 0.0, 0.0);
83+
7484
if (context.getPlayer() != null) {
85+
context.getPlayer().playSound(SoundEvents.GRINDSTONE_USE, 1F, 1.5F);
86+
7587
context.getItemInHand().hurtAndBreak(1, context.getPlayer(), player -> {
7688
player.broadcastBreakEvent(context.getHand());
7789
});
7890
}
91+
92+
return InteractionResult.sidedSuccess(level.isClientSide);
7993
}
8094

8195
return super.useOn(context);

src/main/java/galena/oreganized/index/OPotions.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ public class OPotions {
1111

1212
public static final DeferredRegister<Potion> POTIONS = DeferredRegister.create(ForgeRegistries.POTIONS, Oreganized.MOD_ID);
1313

14-
public static final RegistryObject<Potion> STUNNING = POTIONS.register("stunning", () -> new Potion("stunning", new MobEffectInstance(OEffects.STUNNING.get(), 900)));
15-
public static final RegistryObject<Potion> LONG_STUNNING = POTIONS.register("long_stunning", () -> new Potion("stunning", new MobEffectInstance(OEffects.STUNNING.get(), 1800)));
16-
public static final RegistryObject<Potion> STRONG_STUNNING = POTIONS.register("strong_stunning", () -> new Potion("stunning", new MobEffectInstance(OEffects.STUNNING.get(), 900, 1)));
14+
public static final RegistryObject<Potion> STUNNING = POTIONS.register("stunning", () -> new Potion("stunning", new MobEffectInstance(OEffects.STUNNING.get(), 1800)));
15+
public static final RegistryObject<Potion> LONG_STUNNING = POTIONS.register("long_stunning", () -> new Potion("stunning", new MobEffectInstance(OEffects.STUNNING.get(), 3600)));
1716
}

src/main/java/galena/oreganized/world/event/PlayerEvents.java

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import net.minecraft.world.item.Items;
2626
import net.minecraft.world.level.Level;
2727
import net.minecraft.world.level.block.Block;
28+
import net.minecraft.world.level.block.Blocks;
2829
import net.minecraft.world.level.block.state.BlockState;
2930
import net.minecraftforge.common.ToolAction;
3031
import net.minecraftforge.common.ToolActions;
@@ -94,6 +95,8 @@ public static void blockItemInteractions(final PlayerInteractEvent.RightClickBlo
9495
player.drop(newDisc, false);
9596
//return;
9697
}
98+
99+
world.setBlockAndUpdate(pos, Blocks.CAULDRON.defaultBlockState());
97100
}
98101
}
99102

0 commit comments

Comments
 (0)