Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix conflict] Port to 1.19 & Fix #37

Merged
merged 10 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ org.gradle.jvmargs=-Xmx3G
# Fabric Properties
# check these on https://fabricmc.net/use

minecraft_version=1.18.2
yarn_mappings=1.18.2+build.2
loader_version=0.13.3
minecraft_version=1.19
yarn_mappings=1.19+build.4
loader_version=0.14.8

# Mod Properties
mod_version = v1.11.1
mod_version = v1.13
maven_group = net.guavy
archives_base_name = gravestones

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.48.0+1.18.2
cloth_config_version=6.2.57
fabric_version=0.57.0+1.19
cloth_config_version=7.0.72
auto_config_version=3.4.0
mod_menu_version=3.1.0
trinkets_version=3.3.0
mod_menu_version=4.0.0
trinkets_version=3.4.0
10 changes: 5 additions & 5 deletions src/main/java/net/guavy/gravestones/Gravestones.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.state.property.Properties;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -79,8 +79,8 @@ public static void placeGrave(World world, Vec3d pos, PlayerEntity player) {

BlockPos blockPos = new BlockPos(pos.x, pos.y - 1, pos.z);

if(blockPos.getY() <= world.getDimension().getMinimumY()) {
blockPos = new BlockPos(blockPos.getX(), world.getDimension().getMinimumY(), blockPos.getZ());
if(blockPos.getY() <= world.getDimension().minY()) {
blockPos = new BlockPos(blockPos.getX(), world.getDimension().minY(), blockPos.getZ());
}

BlockState blockState = world.getBlockState(blockPos);
Expand Down Expand Up @@ -118,7 +118,7 @@ public static void placeGrave(World world, Vec3d pos, PlayerEntity player) {
block.onBreak(world, blockPos, blockState, player);

if (GravestonesConfig.getConfig().mainSettings.sendGraveCoordinates) {
player.sendMessage(new TranslatableText("text.gravestones.grave_coordinates", gravePos.getX(), gravePos.getY(), gravePos.getZ()), false);
player.sendMessage(Text.translatable("text.gravestones.grave_coordinates", gravePos.getX(), gravePos.getY(), gravePos.getZ()), false);
}
System.out.println("[Gravestones] Gravestone spawned at: " + gravePos.getX() + ", " + gravePos.getY() + ", " + gravePos.getZ());

Expand All @@ -144,7 +144,7 @@ private static boolean canPlaceGravestone(World world, Block block, BlockPos blo
if(blackListedBlocks.contains(block)) return false;
*/

return !(blockPos.getY() < world.getDimension().getMinimumY() || blockPos.getY() > world.getDimension().getHeight() - world.getDimension().getMinimumY());
return !(blockPos.getY() < world.getDimension().minY() || blockPos.getY() > world.getDimension().height() - world.getDimension().minY());
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl
}

@Override
@SuppressWarnings("deprecation")
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ct) {
return VoxelShapes.cuboid(0.1f, 0f, 0.1f, 0.9f, 0.3f, 0.9f);
}
Expand Down Expand Up @@ -99,7 +100,7 @@ public void dropAllGrave(World world, BlockPos pos) {
blockEntity.setItems(DefaultedList.copyOf(ItemStack.EMPTY));
}

private boolean RetrieveGrave(PlayerEntity playerEntity, World world, BlockPos pos) {
public boolean RetrieveGrave(PlayerEntity playerEntity, World world, BlockPos pos) {
if(world.isClient) return false;

BlockEntity be = world.getBlockEntity(pos);
Expand Down Expand Up @@ -135,10 +136,10 @@ private boolean RetrieveGrave(PlayerEntity playerEntity, World world, BlockPos p
if(GravestonesConfig.getConfig().mainSettings.dropType == GravestoneDropType.PUT_IN_INVENTORY) {
List<ItemStack> armor = items.subList(36, 40);

for (int i = 0; i < armor.size(); i++) {
EquipmentSlot equipmentSlot = MobEntity.getPreferredEquipmentSlot(armor.get(i));
for (ItemStack itemStack : armor) {
EquipmentSlot equipmentSlot = MobEntity.getPreferredEquipmentSlot(itemStack);

playerEntity.equipStack(equipmentSlot, armor.get(i));
playerEntity.equipStack(equipmentSlot, itemStack);
}

playerEntity.equipStack(EquipmentSlot.OFFHAND, items.get(40));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,25 @@
import me.shedaniel.autoconfig.util.Utils;
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
import net.guavy.gravestones.Gravestones;
import net.guavy.gravestones.client.render.GravestoneBlockEntityRenderer;
import net.guavy.gravestones.config.GravestonesConfig;
import net.minecraft.text.LiteralText;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.math.MathHelper;

import java.util.Collections;

public class GravestonesClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
BlockEntityRendererRegistry.INSTANCE.register(Gravestones.GRAVESTONE_BLOCK_ENTITY, GravestoneBlockEntityRenderer::new);
BlockEntityRendererRegistry.register(Gravestones.GRAVESTONE_BLOCK_ENTITY, GravestoneBlockEntityRenderer::new);

GuiRegistry guiRegistry = AutoConfig.getGuiRegistry(GravestonesConfig.class);

guiRegistry.registerAnnotationProvider((s, field, config, defaults, guiRegistryAccess) -> {
GravestonesConfig.UsePercentage bounds = field.getAnnotation(GravestonesConfig.UsePercentage.class);
return Collections.singletonList(ConfigEntryBuilder.create().startIntSlider(new TranslatableText(s), MathHelper.ceil(Utils.getUnsafely(field, config, 0.0) * 100), MathHelper.ceil(bounds.min() * 100), MathHelper.ceil(bounds.max() * 100)).setDefaultValue(() -> MathHelper.ceil((double) Utils.getUnsafely(field, defaults) * 100)).setSaveConsumer((newValue) -> Utils.setUnsafely(field, config, newValue / 100d)).setTextGetter(integer -> new LiteralText(String.format("%d%%", integer))).build());
return Collections.singletonList(ConfigEntryBuilder.create().startIntSlider(Text.translatable(s), MathHelper.ceil(Utils.getUnsafely(field, config, 0.0) * 100), MathHelper.ceil(bounds.min() * 100), MathHelper.ceil(bounds.max() * 100)).setDefaultValue(() -> MathHelper.ceil((double) Utils.getUnsafely(field, defaults) * 100)).setSaveConsumer((newValue) -> Utils.setUnsafely(field, config, newValue / 100d)).setTextGetter(integer -> Text.literal(String.format("%d%%", integer))).build());
}, field -> field.getType() == Double.TYPE || field.getType() == Double.class, GravestonesConfig.UsePercentage.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@Mixin(PlayerEntity.class)
public abstract class PlayerEntityMixin extends LivingEntity{

@Shadow @Final public PlayerInventory inventory;
@Shadow @Final private PlayerInventory inventory;

protected PlayerEntityMixin(EntityType<? extends LivingEntity> type, World world) {
super(type, world);
Expand Down