Skip to content

Commit

Permalink
Some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Apr 11, 2024
1 parent d96db82 commit 6c72fa1
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fabric_version=0.91.1+1.20.4


# Mod Properties
mod_version = 3.2.1+1.20.3
mod_version = 3.2.2+1.20.4
maven_group = eu.pb4
archives_base_name = graves

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/eu/pb4/graves/config/BaseGson.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.particle.ParticleEffect;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.*;
import net.minecraft.sound.SoundEvent;
import net.minecraft.text.Style;
Expand Down Expand Up @@ -70,6 +72,7 @@ public class BaseGson {
.registerTypeHierarchyAdapter(BlockState.class, new CodecSerializer<>(BlockState.CODEC))
.registerTypeHierarchyAdapter(AffineTransformation.class, new CodecSerializer<>(AffineTransformation.CODEC))
.registerTypeHierarchyAdapter(DisplayEntity.BillboardMode.class, new CodecSerializer<>(DisplayEntity.BillboardMode.CODEC))
.registerTypeHierarchyAdapter(ParticleEffect.class, new CodecSerializer<>(ParticleTypes.TYPE_CODEC))
.registerTypeHierarchyAdapter(DisplayEntity.TextDisplayEntity.TextAlignment.class, new CodecSerializer<>(DisplayEntity.TextDisplayEntity.TextAlignment.CODEC))
.registerTypeHierarchyAdapter(Brightness.class, new CodecSerializer<>(Brightness.CODEC))
//.registerTypeHierarchyAdapter(Matrix4f.class, new CodecSerializer<>(AffineTransformation.ANY_CODEC.xmap(AffineTransformation::getMatrix, AffineTransformation::new)))
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/eu/pb4/graves/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ public static class Model {
public String defaultModelId = "default";
@SerializedName("alternative")
public List<CheckedModel> alternative = new ArrayList<>();
@SerializedName("enable_geyser_workaround")
public boolean geyserWorkaround = true;
@SerializedName("hide_f3_debug_lines")
public boolean hideF3DebugLines = !FabricLoader.getInstance().isModLoaded("geyser");
@SerializedName("gravestone_item_base")
public Item gravestoneItemBase = Items.SKELETON_SKULL;
@SerializedName("gravestone_item_nbt")
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/pb4/graves/model/DefaultGraveModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void forEach(BiConsumer<String, GraveModel> consumer) {
}

public static GraveModel debug() {
return corpsePlayer();
return playerHead();
}

public static GraveModel soul() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package eu.pb4.graves.model.parts;

import com.google.gson.annotations.SerializedName;
import eu.pb4.graves.config.ConfigManager;
import eu.pb4.polymer.virtualentity.api.elements.DisplayElement;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.decoration.Brightness;
Expand Down Expand Up @@ -44,7 +45,7 @@ public T construct(ServerWorld world) {
base.setDisplaySize(this.cullBox);
base.setShadowRadius(this.shadowRadius);
base.setShadowStrength(this.shadowStrength);
base.setInvisible(true);
base.setInvisible(ConfigManager.getConfig().model.hideF3DebugLines);
return base;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/eu/pb4/graves/other/GraveUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public static void createGrave(ServerPlayerEntity player, DamageSource source) {
var fluidState = world.getFluidState(gravePos);
world.setBlockState(gravePos, TempBlock.INSTANCE.getDefaultState());

world.getChunkManager().addTicket(GRAVE_TICKED, new ChunkPos(gravePos), 1, grave);
world.getChunkManager().addTicket(GRAVE_TICKED, new ChunkPos(gravePos), 2, grave);

GravesMod.DO_ON_NEXT_TICK.add(() -> {
WrappedText text2;
Expand Down
14 changes: 1 addition & 13 deletions src/main/java/eu/pb4/graves/registry/AbstractGraveBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,7 @@ public Block getPolymerBlock(BlockState state) {

@Override
public BlockState getPolymerBlockState(BlockState state, ServerPlayerEntity player) {
return useFallback(player)
? Blocks.SKELETON_SKULL.getDefaultState().with(ROTATION, state.get(ROTATION)) : Blocks.BARRIER.getDefaultState().with(WATERLOGGED, state.get(WATERLOGGED));
}

@Override
public void onPolymerBlockSend(BlockState blockState, BlockPos.Mutable pos, ServerPlayerEntity player) {
if (useFallback(player)) {
player.networkHandler.sendPacket(PolymerBlockUtils.createBlockEntityPacket(pos, BlockEntityType.SKULL, new NbtCompound()));
}
}

private static boolean useFallback(ServerPlayerEntity player) {
return ConfigManager.getConfig().model.geyserWorkaround && PolymerCommonUtils.isBedrockPlayer(player);
return Blocks.BARRIER.getDefaultState().with(WATERLOGGED, state.get(WATERLOGGED));
}

public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/eu/pb4/graves/registry/GraveBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ private GraveBlock() {

@Override
public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, BlockView world, BlockPos pos) {
if (world.getBlockEntity(pos) instanceof GraveBlockEntity be && be.getGrave().canTakeFrom(player)) {
if (world.getBlockEntity(pos) instanceof GraveBlockEntity be
&& (be.getGrave() == null || be.getGrave().canTakeFrom(player))) {
return super.calcBlockBreakingDelta(state, player, world, pos);
}

Expand Down

0 comments on commit 6c72fa1

Please # to comment.