mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 03:56:59 -05:00
Forge 1.18 Support
This commit is contained in:
@@ -7,7 +7,7 @@ buildscript {
|
||||
plugins {
|
||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||
id "dev.architectury.loom" version "0.10.0-SNAPSHOT" apply false
|
||||
id "org.cadixdev.licenser" version "0.5.0"
|
||||
id "org.cadixdev.licenser" version "0.6.1"
|
||||
id "com.matthewprenger.cursegradle" version "1.4.0" apply false
|
||||
id "maven-publish"
|
||||
}
|
||||
|
||||
@@ -25,9 +25,8 @@ import dev.architectury.event.EventFactory;
|
||||
import dev.architectury.event.EventResult;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.FormattedText;
|
||||
import net.minecraft.util.FormattedCharSequence;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.TooltipFlag;
|
||||
|
||||
@@ -40,13 +39,9 @@ public interface ClientTooltipEvent {
|
||||
*/
|
||||
Event<Item> ITEM = EventFactory.createLoop();
|
||||
/**
|
||||
* @see RenderVanilla#renderTooltip(PoseStack, List, int, int)
|
||||
* @see Render#renderTooltip(PoseStack, List, int, int)
|
||||
*/
|
||||
Event<RenderVanilla> RENDER_VANILLA_PRE = EventFactory.createEventResult();
|
||||
/**
|
||||
* @see RenderForge#renderTooltip(PoseStack, List, int, int)
|
||||
*/
|
||||
Event<RenderForge> RENDER_FORGE_PRE = EventFactory.createEventResult();
|
||||
Event<Render> RENDER_PRE = EventFactory.createEventResult();
|
||||
/**
|
||||
* @see RenderModifyPosition#renderTooltip(PoseStack, PositionContext)
|
||||
*/
|
||||
@@ -71,14 +66,10 @@ public interface ClientTooltipEvent {
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
interface RenderVanilla {
|
||||
interface Render {
|
||||
/**
|
||||
* Invoked before the tooltip for a tooltip is rendered.
|
||||
*
|
||||
* <p> This is <b>not</b> invoked on Forge due to
|
||||
* {@link RenderForge#renderTooltip(PoseStack, List, int, int) fundamental differences}
|
||||
* in Forge and vanilla tooltip logic.
|
||||
*
|
||||
* @param matrices The pose stack.
|
||||
* @param texts The mutable list of components that are rendered.
|
||||
* @param x The x-coordinate of the tooltip.
|
||||
@@ -86,26 +77,7 @@ public interface ClientTooltipEvent {
|
||||
* @return A {@link EventResult} determining the outcome of the event,
|
||||
* the execution of the vanilla tooltip rendering may be cancelled by the result.
|
||||
*/
|
||||
EventResult renderTooltip(PoseStack matrices, List<? extends FormattedCharSequence> texts, int x, int y);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
interface RenderForge {
|
||||
/**
|
||||
* Invoked before the tooltip for a tooltip is rendered.
|
||||
*
|
||||
* <p> This is <b>only</b> invoked on Forge due to
|
||||
* {@link RenderVanilla#renderTooltip(PoseStack, List, int, int) fundamental differences}
|
||||
* in Forge and vanilla tooltip logic.
|
||||
*
|
||||
* @param matrices The pose stack.
|
||||
* @param texts The mutable list of components that are rendered.
|
||||
* @param x The x-coordinate of the tooltip.
|
||||
* @param y The y-coordinate of the tooltip.
|
||||
* @return A {@link EventResult} determining the outcome of the event,
|
||||
* the execution of the forge tooltip rendering may be cancelled by the result.
|
||||
*/
|
||||
EventResult renderTooltip(PoseStack matrices, List<? extends FormattedText> texts, int x, int y);
|
||||
EventResult renderTooltip(PoseStack matrices, List<? extends ClientTooltipComponent> texts, int x, int y);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
||||
@@ -21,9 +21,8 @@ package dev.architectury.hooks.level.biome;
|
||||
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
@@ -34,16 +33,14 @@ public interface GenerationProperties {
|
||||
List<List<Supplier<PlacedFeature>>> getFeatures();
|
||||
|
||||
interface Mutable extends GenerationProperties {
|
||||
Mutable addFeature(GenerationStep.Decoration decoration, ConfiguredFeature<?, ?> feature);
|
||||
@ApiStatus.Experimental
|
||||
Mutable addFeature(GenerationStep.Decoration decoration, PlacedFeature feature);
|
||||
|
||||
Mutable addCarver(GenerationStep.Carving carving, ConfiguredWorldCarver<?> feature);
|
||||
|
||||
Mutable addStructure(ConfiguredStructureFeature<?, ?> feature);
|
||||
|
||||
Mutable removeFeature(GenerationStep.Decoration decoration, ConfiguredFeature<?, ?> feature);
|
||||
@ApiStatus.Experimental
|
||||
Mutable removeFeature(GenerationStep.Decoration decoration, PlacedFeature feature);
|
||||
|
||||
Mutable removeCarver(GenerationStep.Carving carving, ConfiguredWorldCarver<?> feature);
|
||||
|
||||
Mutable removeStructure(ConfiguredStructureFeature<?, ?> feature);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ package dev.architectury.hooks.level.entity;
|
||||
import dev.architectury.injectables.annotations.ExpectPlatform;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.EntityCollisionContext;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class EntityHooks {
|
||||
@@ -34,8 +35,7 @@ public final class EntityHooks {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ExpectPlatform
|
||||
public static Entity fromCollision(CollisionContext ctx) {
|
||||
throw new AssertionError();
|
||||
return ctx instanceof EntityCollisionContext ? ((EntityCollisionContext) ctx).getEntity() : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.github.johnrengelman.shadow" version "7.0.0"
|
||||
id "com.github.johnrengelman.shadow" version "7.1.0"
|
||||
id "com.matthewprenger.cursegradle"
|
||||
}
|
||||
|
||||
@@ -107,8 +107,9 @@ curseforge {
|
||||
releaseType = "$rootProject.cf_type"
|
||||
changelogType = "html"
|
||||
changelog = releaseChangelog()
|
||||
addGameVersion "1.18"
|
||||
addGameVersion "1.18-Snapshot"
|
||||
addGameVersion "Java 16"
|
||||
addGameVersion "Java 17"
|
||||
addGameVersion "Fabric"
|
||||
relations {
|
||||
requiredDependency "fabric-api"
|
||||
|
||||
@@ -23,20 +23,12 @@ import dev.architectury.event.events.common.EntityEvent;
|
||||
import net.minecraft.core.SectionPos;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.entity.EntityInLevelCallback;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.EntityCollisionContext;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class EntityHooksImpl {
|
||||
public static String getEncodeId(Entity entity) {
|
||||
return entity.getEncodeId();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Entity fromCollision(CollisionContext ctx) {
|
||||
return ctx instanceof EntityCollisionContext ? ((EntityCollisionContext) ctx).getEntity() : null;
|
||||
}
|
||||
|
||||
public static EntityInLevelCallback wrapEntityInLevelCallback(Entity entity, EntityInLevelCallback callback) {
|
||||
if (callback == EntityInLevelCallback.NULL) return callback;
|
||||
if (callback == null) return callback;
|
||||
|
||||
@@ -31,7 +31,7 @@ import dev.architectury.impl.fabric.ScreenInputDelegate;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.util.FormattedCharSequence;
|
||||
import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
@@ -99,13 +99,13 @@ public abstract class MixinScreen implements ScreenInputDelegate {
|
||||
}
|
||||
|
||||
@Inject(method = "renderTooltipInternal", at = @At("HEAD"), cancellable = true)
|
||||
private void renderTooltip(PoseStack poseStack, List<? extends FormattedCharSequence> list, int x, int y, CallbackInfo ci) {
|
||||
private void renderTooltip(PoseStack poseStack, List<? extends ClientTooltipComponent> list, int x, int y, CallbackInfo ci) {
|
||||
if (!list.isEmpty()) {
|
||||
var colorContext = tooltipColorContext.get();
|
||||
colorContext.reset();
|
||||
var positionContext = tooltipPositionContext.get();
|
||||
positionContext.reset(x, y);
|
||||
if (ClientTooltipEvent.RENDER_VANILLA_PRE.invoker().renderTooltip(poseStack, list, x, y).isFalse()) {
|
||||
if (ClientTooltipEvent.RENDER_PRE.invoker().renderTooltip(poseStack, list, x, y).isFalse()) {
|
||||
ci.cancel();
|
||||
} else {
|
||||
ClientTooltipEvent.RENDER_MODIFY_COLOR.invoker().renderTooltip(poseStack, x, y, colorContext);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
plugins {
|
||||
id "com.github.johnrengelman.shadow" version "7.0.0"
|
||||
id "com.github.johnrengelman.shadow" version "7.1.0"
|
||||
id "com.matthewprenger.cursegradle"
|
||||
}
|
||||
|
||||
loom {
|
||||
forge {
|
||||
mixinConfig "architectury.mixins.json"
|
||||
mixinConfig "architectury-common.mixins.json"
|
||||
// mixinConfig "architectury.mixins.json"
|
||||
// mixinConfig "architectury-common.mixins.json"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ dependencies {
|
||||
|
||||
common(project(path: ":common", configuration: "dev")) { transitive false }
|
||||
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive false }
|
||||
// compile with mixins for now
|
||||
compileClasspath("dev.architectury:mixin-patched:0.8.4.+")
|
||||
}
|
||||
|
||||
processResources {
|
||||
@@ -107,9 +109,8 @@ curseforge {
|
||||
releaseType = "$rootProject.cf_type"
|
||||
changelogType = "html"
|
||||
changelog = releaseChangelog()
|
||||
addGameVersion "1.17"
|
||||
addGameVersion "1.17.1"
|
||||
addGameVersion "Java 16"
|
||||
addGameVersion "1.18"
|
||||
addGameVersion "Java 17"
|
||||
addGameVersion "Forge"
|
||||
mainArtifact(remapJar.archivePath) {
|
||||
displayName = "[Forge $rootProject.supported_version] v$project.version"
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package dev.architectury.event.forge;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import dev.architectury.event.CompoundEventResult;
|
||||
import dev.architectury.event.events.client.ClientChatEvent;
|
||||
import dev.architectury.event.events.client.*;
|
||||
@@ -77,15 +78,15 @@ public class EventHandlerImplClient {
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.InitGuiEvent.Pre event) {
|
||||
if (ClientGuiEvent.INIT_PRE.invoker().init(event.getGui(), new ScreenAccessImpl(event.getGui())).isFalse()) {
|
||||
public static void event(ScreenEvent.InitScreenEvent.Pre event) {
|
||||
if (ClientGuiEvent.INIT_PRE.invoker().init(event.getScreen(), new ScreenAccessImpl(event.getScreen())).isFalse()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
ClientGuiEvent.INIT_POST.invoker().init(event.getGui(), new ScreenAccessImpl(event.getGui()));
|
||||
public static void event(ScreenEvent.InitScreenEvent.Post event) {
|
||||
ClientGuiEvent.INIT_POST.invoker().init(event.getScreen(), new ScreenAccessImpl(event.getScreen()));
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
@@ -127,26 +128,26 @@ public class EventHandlerImplClient {
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiOpenEvent event) {
|
||||
CompoundEventResult<Screen> result = ClientGuiEvent.SET_SCREEN.invoker().modifyScreen(event.getGui());
|
||||
public static void event(ScreenOpenEvent event) {
|
||||
CompoundEventResult<Screen> result = ClientGuiEvent.SET_SCREEN.invoker().modifyScreen(event.getScreen());
|
||||
if (result.isPresent()) {
|
||||
if (result.isFalse())
|
||||
event.setCanceled(true);
|
||||
else if (result.object() != null)
|
||||
event.setGui(result.object());
|
||||
event.setScreen(result.object());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.DrawScreenEvent.Pre event) {
|
||||
if (ClientGuiEvent.RENDER_PRE.invoker().render(event.getGui(), event.getMatrixStack(), event.getMouseX(), event.getMouseY(), event.getRenderPartialTicks()).isFalse()) {
|
||||
public static void event(ScreenEvent.DrawScreenEvent.Pre event) {
|
||||
if (ClientGuiEvent.RENDER_PRE.invoker().render(event.getScreen(), event.getPoseStack(), event.getMouseX(), event.getMouseY(), event.getPartialTicks()).isFalse()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.DrawScreenEvent.Post event) {
|
||||
ClientGuiEvent.RENDER_POST.invoker().render(event.getGui(), event.getMatrixStack(), event.getMouseX(), event.getMouseY(), event.getRenderPartialTicks());
|
||||
public static void event(ScreenEvent.DrawScreenEvent.Post event) {
|
||||
ClientGuiEvent.RENDER_POST.invoker().render(event.getScreen(), event.getPoseStack(), event.getMouseX(), event.getMouseY(), event.getPartialTicks());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
@@ -169,113 +170,119 @@ public class EventHandlerImplClient {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(RenderTooltipEvent.Pre event) {
|
||||
if (ClientTooltipEvent.RENDER_FORGE_PRE.invoker().renderTooltip(event.getMatrixStack(), event.getLines(), event.getX(), event.getY()).isFalse()) {
|
||||
// TODO: https://discord.com/channels/313125603924639766/852298000042164244/915646384437350472
|
||||
PoseStack stack = new PoseStack();
|
||||
|
||||
if (ClientTooltipEvent.RENDER_PRE.invoker().renderTooltip(stack, event.getComponents(), event.getX(), event.getY()).isFalse()) {
|
||||
event.setCanceled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
TooltipEventPositionContextImpl positionContext = tooltipPositionContext.get();
|
||||
positionContext.reset(event.getX(), event.getY());
|
||||
ClientTooltipEvent.RENDER_MODIFY_POSITION.invoker().renderTooltip(event.getMatrixStack(), positionContext);
|
||||
ClientTooltipEvent.RENDER_MODIFY_POSITION.invoker().renderTooltip(stack, positionContext);
|
||||
event.setX(positionContext.getTooltipX());
|
||||
event.setY(positionContext.getTooltipY());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(RenderTooltipEvent.Color event) {
|
||||
// TODO: https://discord.com/channels/313125603924639766/852298000042164244/915646384437350472
|
||||
PoseStack stack = new PoseStack();
|
||||
|
||||
TooltipEventColorContextImpl colorContext = tooltipColorContext.get();
|
||||
colorContext.reset();
|
||||
colorContext.setBackgroundColor(event.getBackground());
|
||||
colorContext.setBackgroundColor(event.getBackgroundStart());
|
||||
colorContext.setOutlineGradientTopColor(event.getBorderStart());
|
||||
colorContext.setOutlineGradientBottomColor(event.getBorderEnd());
|
||||
ClientTooltipEvent.RENDER_MODIFY_COLOR.invoker().renderTooltip(event.getMatrixStack(), event.getX(), event.getY(), colorContext);
|
||||
ClientTooltipEvent.RENDER_MODIFY_COLOR.invoker().renderTooltip(stack, event.getX(), event.getY(), colorContext);
|
||||
event.setBackground(colorContext.getBackgroundColor());
|
||||
event.setBorderEnd(colorContext.getOutlineGradientBottomColor());
|
||||
event.setBorderStart(colorContext.getOutlineGradientTopColor());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.MouseScrollEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.MOUSE_SCROLLED_PRE.invoker().mouseScrolled(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getScrollDelta()).isFalse()) {
|
||||
public static void event(ScreenEvent.MouseScrollEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.MOUSE_SCROLLED_PRE.invoker().mouseScrolled(Minecraft.getInstance(), event.getScreen(), event.getMouseX(), event.getMouseY(), event.getScrollDelta()).isFalse()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.MouseScrollEvent.Post event) {
|
||||
ClientScreenInputEvent.MOUSE_SCROLLED_POST.invoker().mouseScrolled(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getScrollDelta());
|
||||
public static void event(ScreenEvent.MouseScrollEvent.Post event) {
|
||||
ClientScreenInputEvent.MOUSE_SCROLLED_POST.invoker().mouseScrolled(Minecraft.getInstance(), event.getScreen(), event.getMouseX(), event.getMouseY(), event.getScrollDelta());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.MouseClickedEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getButton()).isFalse()) {
|
||||
public static void event(ScreenEvent.MouseClickedEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(Minecraft.getInstance(), event.getScreen(), event.getMouseX(), event.getMouseY(), event.getButton()).isFalse()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.MouseClickedEvent.Post event) {
|
||||
ClientScreenInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getButton());
|
||||
public static void event(ScreenEvent.MouseClickedEvent.Post event) {
|
||||
ClientScreenInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(Minecraft.getInstance(), event.getScreen(), event.getMouseX(), event.getMouseY(), event.getButton());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.MouseDragEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.MOUSE_DRAGGED_PRE.invoker().mouseDragged(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getMouseButton(), event.getDragX(), event.getDragY()).isFalse()) {
|
||||
public static void event(ScreenEvent.MouseDragEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.MOUSE_DRAGGED_PRE.invoker().mouseDragged(Minecraft.getInstance(), event.getScreen(), event.getMouseX(), event.getMouseY(), event.getMouseButton(), event.getDragX(), event.getDragY()).isFalse()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.MouseDragEvent.Post event) {
|
||||
ClientScreenInputEvent.MOUSE_DRAGGED_POST.invoker().mouseDragged(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getMouseButton(), event.getDragX(), event.getDragY());
|
||||
public static void event(ScreenEvent.MouseDragEvent.Post event) {
|
||||
ClientScreenInputEvent.MOUSE_DRAGGED_POST.invoker().mouseDragged(Minecraft.getInstance(), event.getScreen(), event.getMouseX(), event.getMouseY(), event.getMouseButton(), event.getDragX(), event.getDragY());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.MouseReleasedEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getButton()).isFalse()) {
|
||||
public static void event(ScreenEvent.MouseReleasedEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(Minecraft.getInstance(), event.getScreen(), event.getMouseX(), event.getMouseY(), event.getButton()).isFalse()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.MouseReleasedEvent.Post event) {
|
||||
ClientScreenInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(Minecraft.getInstance(), event.getGui(), event.getMouseX(), event.getMouseY(), event.getButton());
|
||||
public static void event(ScreenEvent.MouseReleasedEvent.Post event) {
|
||||
ClientScreenInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(Minecraft.getInstance(), event.getScreen(), event.getMouseX(), event.getMouseY(), event.getButton());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.KeyboardCharTypedEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.CHAR_TYPED_PRE.invoker().charTyped(Minecraft.getInstance(), event.getGui(), event.getCodePoint(), event.getModifiers()).isFalse()) {
|
||||
public static void event(ScreenEvent.KeyboardCharTypedEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.CHAR_TYPED_PRE.invoker().charTyped(Minecraft.getInstance(), event.getScreen(), event.getCodePoint(), event.getModifiers()).isFalse()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.KeyboardCharTypedEvent.Post event) {
|
||||
ClientScreenInputEvent.CHAR_TYPED_POST.invoker().charTyped(Minecraft.getInstance(), event.getGui(), event.getCodePoint(), event.getModifiers());
|
||||
public static void event(ScreenEvent.KeyboardCharTypedEvent.Post event) {
|
||||
ClientScreenInputEvent.CHAR_TYPED_POST.invoker().charTyped(Minecraft.getInstance(), event.getScreen(), event.getCodePoint(), event.getModifiers());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.KeyboardKeyPressedEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.KEY_PRESSED_PRE.invoker().keyPressed(Minecraft.getInstance(), event.getGui(), event.getKeyCode(), event.getScanCode(), event.getModifiers()).isFalse()) {
|
||||
public static void event(ScreenEvent.KeyboardKeyPressedEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.KEY_PRESSED_PRE.invoker().keyPressed(Minecraft.getInstance(), event.getScreen(), event.getKeyCode(), event.getScanCode(), event.getModifiers()).isFalse()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.KeyboardKeyPressedEvent.Post event) {
|
||||
ClientScreenInputEvent.KEY_PRESSED_POST.invoker().keyPressed(Minecraft.getInstance(), event.getGui(), event.getKeyCode(), event.getScanCode(), event.getModifiers());
|
||||
public static void event(ScreenEvent.KeyboardKeyPressedEvent.Post event) {
|
||||
ClientScreenInputEvent.KEY_PRESSED_POST.invoker().keyPressed(Minecraft.getInstance(), event.getScreen(), event.getKeyCode(), event.getScanCode(), event.getModifiers());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.KeyboardKeyReleasedEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.KEY_RELEASED_PRE.invoker().keyReleased(Minecraft.getInstance(), event.getGui(), event.getKeyCode(), event.getScanCode(), event.getModifiers()).isFalse()) {
|
||||
public static void event(ScreenEvent.KeyboardKeyReleasedEvent.Pre event) {
|
||||
if (ClientScreenInputEvent.KEY_RELEASED_PRE.invoker().keyReleased(Minecraft.getInstance(), event.getScreen(), event.getKeyCode(), event.getScanCode(), event.getModifiers()).isFalse()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(GuiScreenEvent.KeyboardKeyReleasedEvent.Post event) {
|
||||
ClientScreenInputEvent.KEY_RELEASED_POST.invoker().keyReleased(Minecraft.getInstance(), event.getGui(), event.getKeyCode(), event.getScanCode(), event.getModifiers());
|
||||
public static void event(ScreenEvent.KeyboardKeyReleasedEvent.Post event) {
|
||||
ClientScreenInputEvent.KEY_RELEASED_POST.invoker().keyReleased(Minecraft.getInstance(), event.getScreen(), event.getKeyCode(), event.getScanCode(), event.getModifiers());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
@@ -287,14 +294,14 @@ public class EventHandlerImplClient {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(InputEvent.RawMouseEvent event) {
|
||||
if (ClientRawInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(Minecraft.getInstance(), event.getButton(), event.getAction(), event.getMods()).isFalse()) {
|
||||
if (ClientRawInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(Minecraft.getInstance(), event.getButton(), event.getAction(), event.getModifiers()).isFalse()) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(InputEvent.MouseInputEvent event) {
|
||||
ClientRawInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(Minecraft.getInstance(), event.getButton(), event.getAction(), event.getMods());
|
||||
ClientRawInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(Minecraft.getInstance(), event.getButton(), event.getAction(), event.getModifiers());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
@@ -306,12 +313,12 @@ public class EventHandlerImplClient {
|
||||
public static class ModBasedEventHandler {
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(TextureStitchEvent.Pre event) {
|
||||
ClientTextureStitchEvent.PRE.invoker().stitch(event.getMap(), event::addSprite);
|
||||
ClientTextureStitchEvent.PRE.invoker().stitch(event.getAtlas(), event::addSprite);
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(TextureStitchEvent.Post event) {
|
||||
ClientTextureStitchEvent.POST.invoker().stitch(event.getMap());
|
||||
ClientTextureStitchEvent.POST.invoker().stitch(event.getAtlas());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
|
||||
@@ -47,6 +47,7 @@ import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import net.minecraftforge.event.entity.player.*;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent.*;
|
||||
import net.minecraftforge.event.server.*;
|
||||
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.EntityPlaceEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.FarmlandTrampleEvent;
|
||||
@@ -58,8 +59,7 @@ import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fmllegacy.server.ServerLifecycleHooks;
|
||||
import net.minecraftforge.fmlserverevents.*;
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
|
||||
public class EventHandlerImplCommon {
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
@@ -81,22 +81,22 @@ public class EventHandlerImplCommon {
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(FMLServerStartingEvent event) {
|
||||
public static void event(ServerStartingEvent event) {
|
||||
LifecycleEvent.SERVER_STARTING.invoker().stateChanged(event.getServer());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(FMLServerStartedEvent event) {
|
||||
public static void event(ServerStartedEvent event) {
|
||||
LifecycleEvent.SERVER_STARTED.invoker().stateChanged(event.getServer());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(FMLServerStoppingEvent event) {
|
||||
public static void event(ServerStoppingEvent event) {
|
||||
LifecycleEvent.SERVER_STOPPING.invoker().stateChanged(event.getServer());
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(FMLServerStoppedEvent event) {
|
||||
public static void event(ServerStoppedEvent event) {
|
||||
LifecycleEvent.SERVER_STOPPED.invoker().stateChanged(event.getServer());
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ public class EventHandlerImplCommon {
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(FMLServerAboutToStartEvent event) {
|
||||
public static void event(ServerAboutToStartEvent event) {
|
||||
LifecycleEvent.SERVER_BEFORE_START.invoker().stateChanged(event.getServer());
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ public class EventHandlerImplCommon {
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void event(ChunkDataEvent.Load event) {
|
||||
LevelAccessor level = event.getChunk().getWorldForge();
|
||||
if (!(level instanceof ServerLevel)) {
|
||||
if (!(level instanceof ServerLevel) && event instanceof WorldEventAttachment) {
|
||||
level = ((WorldEventAttachment) event).architectury$getAttachedLevel();
|
||||
}
|
||||
ChunkEvent.LOAD_DATA.invoker().load(event.getChunk(), level instanceof ServerLevel ? (ServerLevel) level : null, event.getData());
|
||||
|
||||
@@ -20,17 +20,9 @@
|
||||
package dev.architectury.hooks.level.entity.forge;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.EntityCollisionContext;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class EntityHooksImpl {
|
||||
public static String getEncodeId(Entity entity) {
|
||||
return entity.getEncodeId();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Entity fromCollision(CollisionContext ctx) {
|
||||
return ctx instanceof EntityCollisionContext ? ((EntityCollisionContext) ctx).getEntity().orElse(null) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* This file is part of architectury.
|
||||
* Copyright (C) 2020, 2021 architectury
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package dev.architectury.mixin.forge;
|
||||
|
||||
import dev.architectury.extensions.BlockEntityExtension;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(BlockEntity.class)
|
||||
public abstract class MixinBlockEntity {
|
||||
@Inject(method = "getUpdatePacket", at = @At("HEAD"), cancellable = true)
|
||||
public void getUpdatePacket(CallbackInfoReturnable<ClientboundBlockEntityDataPacket> cir) {
|
||||
if (this instanceof BlockEntityExtension) {
|
||||
BlockEntityExtension entity = (BlockEntityExtension) this;
|
||||
BlockEntity be = (BlockEntity) entity;
|
||||
cir.setReturnValue(new ClientboundBlockEntityDataPacket(be.getBlockPos(), 10, be.getUpdateTag()));
|
||||
cir.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getUpdateTag", at = @At("HEAD"), cancellable = true)
|
||||
public void getUpdateTag(CallbackInfoReturnable<CompoundTag> cir) {
|
||||
if (this instanceof BlockEntityExtension) {
|
||||
BlockEntityExtension entity = (BlockEntityExtension) this;
|
||||
BlockEntity be = (BlockEntity) entity;
|
||||
cir.setReturnValue(entity.saveClientData(new CompoundTag()));
|
||||
cir.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* This file is part of architectury.
|
||||
* Copyright (C) 2020, 2021 architectury
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package dev.architectury.mixin.forge;
|
||||
|
||||
import dev.architectury.extensions.BlockEntityExtension;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.common.extensions.IForgeBlockEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(BlockEntityExtension.class)
|
||||
public interface MixinBlockEntityExtension extends IForgeBlockEntity {
|
||||
@Override
|
||||
default void handleUpdateTag(CompoundTag tag) {
|
||||
var entity = (BlockEntity) this;
|
||||
if (entity.hasLevel()) {
|
||||
((BlockEntityExtension) this).loadClientData(entity.getBlockState(), tag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
default void onDataPacket(Connection connection, ClientboundBlockEntityDataPacket packet) {
|
||||
handleUpdateTag(packet.getTag());
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.ClientPlayerNetworkEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fmllegacy.network.NetworkEvent;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -41,11 +41,11 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fmllegacy.network.NetworkDirection;
|
||||
import net.minecraftforge.fmllegacy.network.NetworkEvent;
|
||||
import net.minecraftforge.fmllegacy.network.NetworkHooks;
|
||||
import net.minecraftforge.fmllegacy.network.NetworkRegistry;
|
||||
import net.minecraftforge.fmllegacy.network.event.EventNetworkChannel;
|
||||
import net.minecraftforge.network.NetworkDirection;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
import net.minecraftforge.network.NetworkRegistry;
|
||||
import net.minecraftforge.network.event.EventNetworkChannel;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -22,13 +22,13 @@ package dev.architectury.platform.forge;
|
||||
import dev.architectury.platform.Mod;
|
||||
import dev.architectury.utils.Env;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.ConfigGuiHandler;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModFileInfo;
|
||||
import net.minecraftforge.fmlclient.ConfigGuiHandler;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package dev.architectury.registry.client.keymappings.forge;
|
||||
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraftforge.fmlclient.registry.ClientRegistry;
|
||||
import net.minecraftforge.client.ClientRegistry;
|
||||
|
||||
public class KeyMappingRegistryImpl {
|
||||
public static void register(KeyMapping keyBinding) {
|
||||
|
||||
@@ -30,11 +30,9 @@ import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
import net.minecraft.world.level.levelgen.surfacebuilders.ConfiguredSurfaceBuilder;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
import net.minecraftforge.common.world.BiomeGenerationSettingsBuilder;
|
||||
import net.minecraftforge.common.world.MobSpawnInfoBuilder;
|
||||
import net.minecraftforge.common.world.MobSpawnSettingsBuilder;
|
||||
import net.minecraftforge.event.world.BiomeLoadingEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -43,7 +41,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.function.Predicate;
|
||||
@@ -139,17 +136,6 @@ public class BiomeModificationsImpl {
|
||||
public Biome.@NotNull BiomeCategory getCategory() {
|
||||
return event.getCategory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDepth() {
|
||||
return event.getDepth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getScale() {
|
||||
return event.getScale();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class GenerationSettingsBuilderWrapped implements GenerationProperties {
|
||||
@@ -159,32 +145,21 @@ public class BiomeModificationsImpl {
|
||||
this.generation = generation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Optional<Supplier<ConfiguredSurfaceBuilder<?>>> getSurfaceBuilder() {
|
||||
return generation.getSurfaceBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<Supplier<ConfiguredWorldCarver<?>>> getCarvers(GenerationStep.Carving carving) {
|
||||
return generation.getCarvers(carving);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<List<Supplier<ConfiguredFeature<?, ?>>>> getFeatures() {
|
||||
public @NotNull List<List<Supplier<PlacedFeature>>> getFeatures() {
|
||||
return generation.features;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<Supplier<ConfiguredStructureFeature<?, ?>>> getStructureStarts() {
|
||||
return generation.getStructures();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class SpawnSettingsBuilderWrapped implements SpawnProperties {
|
||||
protected final MobSpawnInfoBuilder builder;
|
||||
protected final MobSpawnSettingsBuilder builder;
|
||||
|
||||
public SpawnSettingsBuilderWrapped(MobSpawnInfoBuilder builder) {
|
||||
public SpawnSettingsBuilderWrapped(MobSpawnSettingsBuilder builder) {
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
@@ -202,11 +177,6 @@ public class BiomeModificationsImpl {
|
||||
public @NotNull Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> getMobSpawnCosts() {
|
||||
return builder.mobSpawnCosts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayerSpawnFriendly() {
|
||||
return builder.playerCanSpawn;
|
||||
}
|
||||
}
|
||||
|
||||
public static class MutableBiomeWrapped extends BiomeWrapped implements BiomeProperties.Mutable {
|
||||
@@ -244,18 +214,6 @@ public class BiomeModificationsImpl {
|
||||
event.setCategory(category);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Mutable setDepth(float depth) {
|
||||
event.setDepth(depth);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Mutable setScale(float scale) {
|
||||
event.setScale(scale);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class MutableClimatePropertiesWrapped implements ClimateProperties.Mutable {
|
||||
@@ -338,13 +296,7 @@ public class BiomeModificationsImpl {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mutable setSurfaceBuilder(ConfiguredSurfaceBuilder<?> builder) {
|
||||
generation.surfaceBuilder(builder);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mutable addFeature(GenerationStep.Decoration decoration, ConfiguredFeature<?, ?> feature) {
|
||||
public Mutable addFeature(GenerationStep.Decoration decoration, PlacedFeature feature) {
|
||||
generation.addFeature(decoration, feature);
|
||||
return this;
|
||||
}
|
||||
@@ -356,13 +308,7 @@ public class BiomeModificationsImpl {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mutable addStructure(ConfiguredStructureFeature<?, ?> feature) {
|
||||
generation.addStructureStart(feature);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mutable removeFeature(GenerationStep.Decoration decoration, ConfiguredFeature<?, ?> feature) {
|
||||
public Mutable removeFeature(GenerationStep.Decoration decoration, PlacedFeature feature) {
|
||||
generation.getFeatures(decoration).removeIf(supplier -> supplier.get() == feature);
|
||||
return this;
|
||||
}
|
||||
@@ -372,16 +318,10 @@ public class BiomeModificationsImpl {
|
||||
generation.getCarvers(carving).removeIf(supplier -> supplier.get() == feature);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mutable removeStructure(ConfiguredStructureFeature<?, ?> feature) {
|
||||
generation.getStructures().removeIf(supplier -> supplier.get() == feature);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private static class MutableSpawnSettingsBuilderWrapped extends SpawnSettingsBuilderWrapped implements SpawnProperties.Mutable {
|
||||
public MutableSpawnSettingsBuilderWrapped(MobSpawnInfoBuilder builder) {
|
||||
public MutableSpawnSettingsBuilderWrapped(MobSpawnSettingsBuilder builder) {
|
||||
super(builder);
|
||||
}
|
||||
|
||||
@@ -425,12 +365,6 @@ public class BiomeModificationsImpl {
|
||||
getMobSpawnCosts().remove(entityType);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Mutable setPlayerSpawnFriendly(boolean friendly) {
|
||||
builder.playerCanSpawn = friendly;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -31,8 +31,8 @@ import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.extensions.IForgeContainerType;
|
||||
import net.minecraftforge.fmllegacy.network.NetworkHooks;
|
||||
import net.minecraftforge.common.extensions.IForgeMenuType;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
|
||||
public class MenuRegistryImpl {
|
||||
public static void openExtendedMenu(ServerPlayer player, ExtendedMenuProvider provider) {
|
||||
@@ -44,7 +44,7 @@ public class MenuRegistryImpl {
|
||||
}
|
||||
|
||||
public static <T extends AbstractContainerMenu> MenuType<T> ofExtended(ExtendedMenuTypeFactory<T> factory) {
|
||||
return IForgeContainerType.create(factory::create);
|
||||
return IForgeMenuType.create(factory::create);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -38,11 +38,7 @@ import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fmllegacy.RegistryObject;
|
||||
import net.minecraftforge.registries.ForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
import net.minecraftforge.registries.RegistryManager;
|
||||
import net.minecraftforge.registries.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package dev.architectury.utils.forge;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.fmllegacy.server.ServerLifecycleHooks;
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
|
||||
public class GameInstanceImpl {
|
||||
public static MinecraftServer getServer() {
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
"MixinClientLevel"
|
||||
],
|
||||
"mixins": [
|
||||
"MixinBlockEntity",
|
||||
"MixinBlockEntityExtension",
|
||||
"MixinChunkSerializer",
|
||||
"MixinFallingBlockEntity",
|
||||
"MixinItemExtension",
|
||||
|
||||
@@ -3,7 +3,7 @@ org.gradle.daemon=false
|
||||
|
||||
forgeEnabled=false
|
||||
|
||||
minecraft_version=1.18-rc3
|
||||
minecraft_version=1.18
|
||||
supported_version=1.18
|
||||
crane_version=1.17.1+build.1
|
||||
|
||||
@@ -18,4 +18,4 @@ fabric_loader_version=0.12.5
|
||||
fabric_api_version=0.43.1+1.18
|
||||
mod_menu_version=3.0.0
|
||||
|
||||
forge_version=37.0.69
|
||||
forge_version=38.0.4
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -14,9 +14,9 @@ if (JavaVersion.current().ordinal() + 1 < 16) {
|
||||
|
||||
include("common")
|
||||
include("fabric")
|
||||
//include("forge")
|
||||
include("forge")
|
||||
include("testmod-common")
|
||||
include("testmod-fabric")
|
||||
//include("testmod-forge")
|
||||
include("testmod-forge")
|
||||
|
||||
rootProject.name = "architectury"
|
||||
|
||||
@@ -5,7 +5,7 @@ plugins {
|
||||
|
||||
loom {
|
||||
forge {
|
||||
mixinConfig "architectury.mixins.json"
|
||||
// mixinConfig "architectury.mixins.json"
|
||||
|
||||
localMods {
|
||||
forge {
|
||||
|
||||
Reference in New Issue
Block a user