diff --git a/gradle.properties b/gradle.properties index 5f4a2c36d..d1c985395 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ mod_version=1.2.14 # Forge game_version=1.21 -neo_version=21.0.76-beta +neo_version=21.0.79-beta # mods.toml loader=4 diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java index 4c39b0965..b7e4679ac 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java @@ -28,7 +28,6 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.material.PushReaction; import net.minecraft.world.phys.BlockHitResult; -import net.neoforged.neoforge.common.PlantType; import net.neoforged.neoforge.items.ItemHandlerHelper; import java.util.List; @@ -52,10 +51,10 @@ public class BlockPlant extends CropBlock { // this.returnMeta = returnMeta; } - @Override +/* @Override public PlantType getPlantType(BlockGetter world, BlockPos pos) { return PlantType.CROP; - } + }*/ // // @Override // public int damageDropped(BlockState state) { diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/AllInOneTool.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/AllInOneTool.java index b155f08e8..054c99f64 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/AllInOneTool.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/AllInOneTool.java @@ -9,14 +9,15 @@ import net.minecraft.world.item.Tier; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.enchantment.Enchantment; import net.neoforged.neoforge.common.ItemAbilities; -import net.neoforged.neoforge.common.ToolAction; +import net.neoforged.neoforge.common.ItemAbility; +import javax.annotation.Nonnull; import java.util.List; public class AllInOneTool extends DiggerItem { private final Tier tier; - private static List ACTIONS = List.of( + private static List ACTIONS = List.of( ItemAbilities.AXE_DIG, ItemAbilities.HOE_DIG, ItemAbilities.PICKAXE_DIG, @@ -28,8 +29,8 @@ public class AllInOneTool extends DiggerItem { public AllInOneTool(Tier tier) { super( - 4.0f, - -2f, +/* 4.0f, + -2f,*/ tier, ActuallyTags.Blocks.MINEABLE_WITH_AIO, new Properties() @@ -41,12 +42,13 @@ public class AllInOneTool extends DiggerItem { } @Override - public boolean canPerformAction(ItemStack stack, ToolAction toolAction) { + public boolean canPerformAction(@Nonnull ItemStack stack, @Nonnull ItemAbility toolAction) { if (ACTIONS.contains(toolAction)) return true; return super.canPerformAction(stack, toolAction); } + @Nonnull @Override public InteractionResult useOn(UseOnContext context) { // How, no idea, possible, most likely :cry: @@ -64,8 +66,8 @@ public class AllInOneTool extends DiggerItem { return Items.IRON_HOE.useOn(context); } - @Override +/* @Override //TODO help, enchantments are weird now. public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantment) { return super.canApplyAtEnchantingTable(stack, enchantment) || enchantment.category.canEnchant(Items.DIAMOND_SWORD); - } + }*/ } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java index 6d2df8f59..f19350538 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/DefaultFarmerBehavior.java @@ -37,7 +37,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; -import net.neoforged.neoforge.common.IPlantable; +import net.neoforged.neoforge.common.SpecialPlantable; import net.neoforged.neoforge.common.util.FakePlayerFactory; import java.util.ArrayList; @@ -148,10 +148,10 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { } private BlockState getPlantablePlantFromStack(ItemStack stack, Level world, BlockPos pos) { - if (StackUtil.isValid(stack)) { - IPlantable plantable = this.getPlantableFromStack(stack); + if (!stack.isEmpty()) { + SpecialPlantable plantable = this.getPlantableFromStack(stack); if (plantable != null) { - BlockState state = plantable.g(world, pos); + BlockState state = plantable.getPlantType(world, pos); if (state != null && state.getBlock() instanceof BonemealableBlock) { return state; } @@ -160,14 +160,14 @@ public class DefaultFarmerBehavior implements IFarmerBehavior { return null; } - private IPlantable getPlantableFromStack(ItemStack stack) { + private SpecialPlantable getPlantableFromStack(ItemStack stack) { Item item = stack.getItem(); - if (item instanceof IPlantable) { - return (IPlantable) item; + if (item instanceof SpecialPlantable plantable) { + return plantable; } else if (item instanceof BlockItem) { Block block = Block.byItem(item); - if (block instanceof IPlantable) { - return (IPlantable) block; + if (block instanceof SpecialPlantable plantable) { + return plantable; } } return null; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java index 195e14b35..de40393ce 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/apiimpl/farmer/NetherWartFarmerBehavior.java @@ -27,7 +27,6 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; -import net.neoforged.neoforge.common.IPlantable; import java.util.List; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java index 4a0327e34..af96638de 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -40,6 +40,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.ItemDisplayContext; @@ -59,7 +60,7 @@ public final class AssetUtil { public static final int MAX_LIGHT_Y = 0xF000F0; public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("gui_inventory"); - private static final ResourceLocation FORGE_WHITE = ResourceLocation.tryParse("forge", "white"); + private static final ResourceLocation FORGE_WHITE = ResourceLocation.tryBuild("forge", "white"); public static ResourceLocation getGuiLocation(String file) { return ActuallyAdditions.modLoc("textures/gui/" + file + ".png"); @@ -224,7 +225,7 @@ public final class AssetUtil { // GlStateManager._popMatrix(); // } - public static void spawnLaserWithTimeServer(Level world, double startX, double startY, double startZ, double endX, double endY, double endZ, int color, int maxAge, double rotationTime, float size, float alpha) { + public static void spawnLaserWithTimeServer(ServerLevel world, double startX, double startY, double startZ, double endX, double endY, double endZ, int color, int maxAge, double rotationTime, float size, float alpha) { if (!world.isClientSide) { CompoundTag data = new CompoundTag(); data.putDouble("StartX", startX); @@ -238,7 +239,7 @@ public final class AssetUtil { data.putFloat("Size", size); data.putInt("MaxAge", maxAge); data.putFloat("Alpha", alpha); - PacketDistributor.NEAR.with(new PacketDistributor.TargetPoint(startX, startY, startZ, 96, world.dimension())).send(new PacketServerToClient(data, PacketHandler.LASER_HANDLER)); + PacketDistributor.sendToPlayersNear(world, null, startX, startY, startZ, 96, new PacketServerToClient(data, PacketHandler.LASER_HANDLER)); } } @@ -292,25 +293,25 @@ public final class AssetUtil { for (int i = 1; i < 4; i++) { float width = beamWidth * (i / 4.0f); //top - builder.vertex(matrix, -width, width, 0.0f).color(r, g, b, a).uv(minU, maxV).uv2(lightmap).endVertex(); - builder.vertex(matrix, width, width, 0.0f).color(r, g, b, a).uv(maxU, maxV).uv2(lightmap).endVertex(); - builder.vertex(matrix, width, width, -length).color(r, g, b, a).uv(maxU, minV).uv2(lightmap).endVertex(); - builder.vertex(matrix, -width, width, -length).color(r, g, b, a).uv(minU, minV).uv2(lightmap).endVertex(); + builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap);//.endVertex(); //TODO ?! + builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap);//.endVertex(); + builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap); + builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); //bottom - builder.vertex(matrix, -width, -width, 0.0f).color(r, g, b, a).uv(minU, maxV).uv2(lightmap).endVertex(); - builder.vertex(matrix, -width, -width, -length).color(r, g, b, a).uv(minU, minV).uv2(lightmap).endVertex(); - builder.vertex(matrix, width, -width, -length).color(r, g, b, a).uv(maxU, minV).uv2(lightmap).endVertex(); - builder.vertex(matrix, width, -width, 0.0f).color(r, g, b, a).uv(maxU, maxV).uv2(lightmap).endVertex(); + builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(minU, maxV).setLight(lightmap); + builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); + builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(maxU, minV).setLight(lightmap); + builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); //left - builder.vertex(matrix, -width, width, 0.0f).color(r, g, b, a).uv(maxU, maxV).uv2(lightmap).endVertex(); - builder.vertex(matrix, -width, -width, 0.0f).color(r, g, b, a).uv(maxU, maxV).uv2(lightmap).endVertex(); - builder.vertex(matrix, -width, -width, -length).color(r, g, b, a).uv(minU, minV).uv2(lightmap).endVertex(); - builder.vertex(matrix, -width, width, -length).color(r, g, b, a).uv(minU, minV).uv2(lightmap).endVertex(); + builder.addVertex(matrix, -width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); + builder.addVertex(matrix, -width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); + builder.addVertex(matrix, -width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); + builder.addVertex(matrix, -width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); //right - builder.vertex(matrix, width, width, 0.0f).color(r, g, b, a).uv(maxU, maxV).uv2(lightmap).endVertex(); - builder.vertex(matrix, width, -width, 0.0f).color(r, g, b, a).uv(maxU, maxV).uv2(lightmap).endVertex(); - builder.vertex(matrix, width, -width, -length).color(r, g, b, a).uv(minU, minV).uv2(lightmap).endVertex(); - builder.vertex(matrix, width, width, -length).color(r, g, b, a).uv(minU, minV).uv2(lightmap).endVertex(); + builder.addVertex(matrix, width, width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); + builder.addVertex(matrix, width, -width, 0.0f).setColor(r, g, b, a).setUv(maxU, maxV).setLight(lightmap); + builder.addVertex(matrix, width, -width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); + builder.addVertex(matrix, width, width, -length).setColor(r, g, b, a).setUv(minU, minV).setLight(lightmap); } @@ -362,7 +363,7 @@ public final class AssetUtil { Matrix4f matrix = matrixStack.last().pose(); RenderSystem.setShader(GameRenderer::getPositionColorLightmapShader); - Tesselator.getInstance().getBuilder().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_LIGHTMAP); + Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_LIGHTMAP); TextureAtlasSprite sprite = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(FORGE_WHITE); float minU = sprite.getU0();