Compare commits
3 Commits
1.19-hotfi
...
1.19.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
028976577c | ||
|
|
4114f89584 | ||
|
|
292f362092 |
@@ -4,7 +4,7 @@ plugins {
|
||||
id 'net.minecraftforge.gradle' version '5.1.+'
|
||||
}
|
||||
|
||||
version = '1.19-2.38'
|
||||
version = '1.19.3-2.40'
|
||||
group = 'nl.requios.effortlessbuilding'
|
||||
archivesBaseName = 'effortlessbuilding'
|
||||
|
||||
@@ -18,7 +18,7 @@ minecraft {
|
||||
// stable_# Stables are built at the discretion of the MCP team.
|
||||
// Use non-default mappings at your own risk. they may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: 'official', version: '1.19.2'
|
||||
mappings channel: 'official', version: '1.19.3'
|
||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
|
||||
@@ -115,7 +115,7 @@ dependencies {
|
||||
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
|
||||
// that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
|
||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||
minecraft 'net.minecraftforge:forge:1.19.2-43.1.47'
|
||||
minecraft 'net.minecraftforge:forge:1.19.3-44.1.0'
|
||||
|
||||
// Real mod deobf dependency examples - these get remapped to your current mappings
|
||||
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
|
||||
|
||||
@@ -4,8 +4,10 @@ import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraft.world.item.CreativeModeTabs;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
|
||||
import net.minecraftforge.event.CreativeModeTabEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
@@ -89,11 +91,25 @@ public class EffortlessBuilding {
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerCapabilities(RegisterCapabilitiesEvent event){
|
||||
public void registerCapabilities(RegisterCapabilitiesEvent event) {
|
||||
event.register(ModifierCapabilityManager.IModifierCapability.class);
|
||||
event.register(ModeCapabilityManager.IModeCapability.class);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerCreativeModeTabs(CreativeModeTabEvent.BuildContents event) {
|
||||
if (event.getTab() == CreativeModeTabs.TOOLS_AND_UTILITIES){
|
||||
event.accept(RANDOMIZER_BAG_ITEM);
|
||||
event.accept(GOLDEN_RANDOMIZER_BAG_ITEM);
|
||||
event.accept(DIAMOND_RANDOMIZER_BAG_ITEM);
|
||||
event.accept(REACH_UPGRADE_1_ITEM);
|
||||
event.accept(REACH_UPGRADE_2_ITEM);
|
||||
event.accept(REACH_UPGRADE_3_ITEM);
|
||||
}
|
||||
|
||||
//To create custom tab see https://gist.github.com/ChampionAsh5357/c21724bafbc630da2ed8899fe0c1d226
|
||||
}
|
||||
|
||||
public static void log(String msg) {
|
||||
logger.info(msg);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.level.BlockEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
@@ -30,7 +29,7 @@ import nl.requios.effortlessbuilding.network.PacketHandler;
|
||||
import nl.requios.effortlessbuilding.network.RequestLookAtMessage;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = EffortlessBuilding.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE)
|
||||
public class EventHandler {
|
||||
public class ForgeEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void attachCapabilities(AttachCapabilitiesEvent<Entity> event) {
|
||||
@@ -43,7 +43,7 @@ public class ModClientEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerShaders(RegisterShadersEvent event) throws IOException {
|
||||
event.registerShader(new ShaderInstance(event.getResourceManager(),
|
||||
event.registerShader(new ShaderInstance(event.getResourceProvider(),
|
||||
new ResourceLocation(EffortlessBuilding.MODID, "dissolve"),
|
||||
DefaultVertexFormat.BLOCK),
|
||||
shaderInstance -> BuildRenderTypes.dissolveShaderInstance = shaderInstance);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package nl.requios.effortlessbuilding.buildmode;
|
||||
|
||||
import com.mojang.math.Vector4f;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -15,6 +14,7 @@ import nl.requios.effortlessbuilding.helper.ReachHelper;
|
||||
import nl.requios.effortlessbuilding.helper.SurvivalHelper;
|
||||
import nl.requios.effortlessbuilding.network.BlockBrokenMessage;
|
||||
import nl.requios.effortlessbuilding.network.BlockPlacedMessage;
|
||||
import org.joml.Vector4f;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Dictionary;
|
||||
@@ -273,6 +273,10 @@ public class BuildModes {
|
||||
this.category = category;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getNameKey() {
|
||||
return "effortlessbuilding.mode." + name;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ModeSettingsManager {
|
||||
return capability.getModeData();
|
||||
}
|
||||
|
||||
EffortlessBuilding.logger.warn("Player does not have modeCapability: " + player);
|
||||
// EffortlessBuilding.logger.warn("Player does not have modeCapability: " + player);
|
||||
//Return dummy settings
|
||||
return new ModeSettings();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ModifierSettingsManager {
|
||||
return capability.getModifierData();
|
||||
}
|
||||
|
||||
EffortlessBuilding.logger.warn("Player does not have modifierCapability: " + player);
|
||||
// EffortlessBuilding.logger.warn("Player does not have modifierCapability: " + player);
|
||||
//Return dummy settings
|
||||
return new ModifierSettings();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package nl.requios.effortlessbuilding.gui.buildmode;
|
||||
|
||||
import com.mojang.blaze3d.vertex.*;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.math.Vector4f;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
@@ -26,6 +25,7 @@ import nl.requios.effortlessbuilding.network.ModeSettingsMessage;
|
||||
import nl.requios.effortlessbuilding.network.PacketHandler;
|
||||
import nl.requios.effortlessbuilding.proxy.ClientProxy;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
import org.joml.Vector4f;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
@@ -47,7 +47,7 @@ import nl.requios.effortlessbuilding.buildmode.ModeOptions.OptionEnum;
|
||||
public class RadialMenu extends Screen {
|
||||
|
||||
public static final RadialMenu instance = new RadialMenu();
|
||||
|
||||
|
||||
private final Vector4f radialButtonColor = new Vector4f(0f, 0f, 0f, .5f);
|
||||
private final Vector4f sideButtonColor = new Vector4f(.5f, .5f, .5f, .5f);
|
||||
private final Vector4f highlightColor = new Vector4f(.6f, .8f, 1f, .6f);
|
||||
@@ -291,7 +291,7 @@ public class RadialMenu extends Screen {
|
||||
final double x = (menuRegion.x1 + menuRegion.x2) * 0.5 * (ringOuterEdge * 0.55 + 0.45 * ringInnerEdge);
|
||||
final double y = (menuRegion.y1 + menuRegion.y2) * 0.5 * (ringOuterEdge * 0.55 + 0.45 * ringInnerEdge);
|
||||
|
||||
RenderSystem.setShaderTexture(0, new ResourceLocation(EffortlessBuilding.MODID, "textures/icons/" + menuRegion.mode.name().toLowerCase() + ".png"));
|
||||
RenderSystem.setShaderTexture(0, new ResourceLocation(EffortlessBuilding.MODID, "textures/icons/" + menuRegion.mode.getName() + ".png"));
|
||||
blit(ms, (int) (middleX + x - 8), (int) (middleY + y - 8), 16, 16, 0, 0, 18, 18, 18, 18);
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ public class RadialMenu extends Screen {
|
||||
public static void playRadialMenuSound() {
|
||||
final float volume = 0.1f;
|
||||
if (volume >= 0.0001f) {
|
||||
SimpleSoundInstance sound = new SimpleSoundInstance(SoundEvents.UI_BUTTON_CLICK, SoundSource.MASTER, volume,
|
||||
SimpleSoundInstance sound = new SimpleSoundInstance(SoundEvents.UI_BUTTON_CLICK.get(), SoundSource.MASTER, volume,
|
||||
1.0f, RandomSource.create(), Minecraft.getInstance().player.blockPosition());
|
||||
Minecraft.getInstance().getSoundManager().play(sound);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package nl.requios.effortlessbuilding.gui.buildmodifier;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -33,7 +33,7 @@ public class ArraySettingsGui extends GuiCollapsibleScrollEntry {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(List<Widget> renderables) {
|
||||
public void init(List<Renderable> renderables) {
|
||||
super.init(renderables);
|
||||
|
||||
int y = top;
|
||||
@@ -93,7 +93,7 @@ public class ArraySettingsGui extends GuiCollapsibleScrollEntry {
|
||||
|
||||
buttonArrayEnabled.render(ms, mouseX, mouseY, partialTicks);
|
||||
if (buttonArrayEnabled.isChecked()) {
|
||||
buttonArrayEnabled.y = yy;
|
||||
buttonArrayEnabled.setY(yy);
|
||||
font.draw(ms, "Array enabled", left + offset, yy + 2, 0xFFFFFF);
|
||||
|
||||
yy = y + 20;
|
||||
@@ -117,7 +117,7 @@ public class ArraySettingsGui extends GuiCollapsibleScrollEntry {
|
||||
|
||||
arrayNumberFieldList.forEach(numberField -> numberField.drawNumberField(ms, mouseX, mouseY, partialTicks));
|
||||
} else {
|
||||
buttonArrayEnabled.y = yy;
|
||||
buttonArrayEnabled.setY(yy);
|
||||
font.draw(ms, "Array disabled", left + offset, yy + 2, 0x999999);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package nl.requios.effortlessbuilding.gui.buildmodifier;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -40,7 +40,7 @@ public class MirrorSettingsGui extends GuiCollapsibleScrollEntry {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(List<Widget> renderables) {
|
||||
public void init(List<Renderable> renderables) {
|
||||
super.init(renderables);
|
||||
|
||||
int y = top - 2;
|
||||
@@ -181,7 +181,7 @@ public class MirrorSettingsGui extends GuiCollapsibleScrollEntry {
|
||||
|
||||
buttonMirrorEnabled.render(ms, mouseX, mouseY, partialTicks);
|
||||
if (buttonMirrorEnabled.isChecked()) {
|
||||
buttonMirrorEnabled.y = yy;
|
||||
buttonMirrorEnabled.setY(yy);
|
||||
font.draw(ms, "Mirror enabled", left + offset, yy + 2, 0xFFFFFF);
|
||||
|
||||
yy = y + 18;
|
||||
@@ -195,23 +195,23 @@ public class MirrorSettingsGui extends GuiCollapsibleScrollEntry {
|
||||
|
||||
yy = y + 50;
|
||||
font.draw(ms, "Direction", left + offset, yy + 2, 0xFFFFFF);
|
||||
buttonMirrorX.y = yy;
|
||||
buttonMirrorY.y = yy;
|
||||
buttonMirrorZ.y = yy;
|
||||
buttonMirrorX.setY(yy);
|
||||
buttonMirrorY.setY(yy);
|
||||
buttonMirrorZ.setY(yy);
|
||||
font.draw(ms, "Radius", left + 176 + offset, yy + 2, 0xFFFFFF);
|
||||
textMirrorRadius.y = yy - 3;
|
||||
|
||||
yy = y + 72;
|
||||
buttonCurrentPosition.y = yy;
|
||||
buttonToggleOdd.y = yy;
|
||||
buttonDrawLines.y = yy;
|
||||
buttonDrawPlanes.y = yy;
|
||||
buttonCurrentPosition.setY(yy);
|
||||
buttonToggleOdd.setY(yy);
|
||||
buttonDrawLines.setY(yy);
|
||||
buttonDrawPlanes.setY(yy);
|
||||
|
||||
mirrorButtonList.forEach(button -> button.render(ms, mouseX, mouseY, partialTicks));
|
||||
mirrorIconButtonList.forEach(button -> button.render(ms, mouseX, mouseY, partialTicks));
|
||||
mirrorNumberFieldList.forEach(numberField -> numberField.drawNumberField(ms, mouseX, mouseY, partialTicks));
|
||||
} else {
|
||||
buttonMirrorEnabled.y = yy;
|
||||
buttonMirrorEnabled.setY(yy);
|
||||
font.draw(ms, "Mirror disabled", left + offset, yy + 2, 0x999999);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.gui.widget.ExtendedButton;
|
||||
import nl.requios.effortlessbuilding.EffortlessBuilding;
|
||||
import nl.requios.effortlessbuilding.buildmodifier.Array;
|
||||
import nl.requios.effortlessbuilding.buildmodifier.Mirror;
|
||||
@@ -50,7 +51,7 @@ public class ModifierSettingsGui extends Screen {
|
||||
|
||||
//Close button
|
||||
int y = height - 26;
|
||||
buttonClose = new Button(width / 2 - 100, y, 200, 20, Component.literal("Close"), (button) -> {
|
||||
buttonClose = new ExtendedButton(width / 2 - 100, y, 200, 20, Component.literal("Close"), (button) -> {
|
||||
Minecraft.getInstance().player.closeContainer();
|
||||
});
|
||||
addRenderableOnly(buttonClose);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package nl.requios.effortlessbuilding.gui.buildmodifier;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -40,7 +40,7 @@ public class RadialMirrorSettingsGui extends GuiCollapsibleScrollEntry {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(List<Widget> renderables) {
|
||||
public void init(List<Renderable> renderables) {
|
||||
super.init(renderables);
|
||||
|
||||
int y = top - 2;
|
||||
@@ -178,7 +178,7 @@ public class RadialMirrorSettingsGui extends GuiCollapsibleScrollEntry {
|
||||
|
||||
buttonRadialMirrorEnabled.render(ms, mouseX, mouseY, partialTicks);
|
||||
if (buttonRadialMirrorEnabled.isChecked()) {
|
||||
buttonRadialMirrorEnabled.y = yy;
|
||||
buttonRadialMirrorEnabled.setY(yy);
|
||||
font.draw(ms, "Radial mirror enabled", left + offset, yy + 2, 0xFFFFFF);
|
||||
|
||||
yy = y + 18;
|
||||
@@ -197,20 +197,20 @@ public class RadialMirrorSettingsGui extends GuiCollapsibleScrollEntry {
|
||||
textRadialMirrorRadius.y = yy - 3;
|
||||
|
||||
yy = y + 72;
|
||||
buttonCurrentPosition.y = yy;
|
||||
buttonToggleOdd.y = yy;
|
||||
buttonDrawLines.y = yy;
|
||||
buttonDrawPlanes.y = yy;
|
||||
buttonCurrentPosition.setY(yy);
|
||||
buttonToggleOdd.setY(yy);
|
||||
buttonDrawLines.setY(yy);
|
||||
buttonDrawPlanes.setY(yy);
|
||||
|
||||
yy = y + 76;
|
||||
buttonRadialMirrorAlternate.y = yy;
|
||||
buttonRadialMirrorAlternate.setY(yy);
|
||||
|
||||
radialMirrorButtonList.forEach(button -> button.render(ms, mouseX, mouseY, partialTicks));
|
||||
radialMirrorIconButtonList.forEach(button -> button.render(ms, mouseX, mouseY, partialTicks));
|
||||
radialMirrorNumberFieldList
|
||||
.forEach(numberField -> numberField.drawNumberField(ms, mouseX, mouseY, partialTicks));
|
||||
} else {
|
||||
buttonRadialMirrorEnabled.y = yy;
|
||||
buttonRadialMirrorEnabled.setY(yy);
|
||||
font.draw(ms, "Radial mirror disabled", left + offset, yy + 2, 0x999999);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.client.gui.ScreenUtils;
|
||||
import net.minecraftforge.client.gui.widget.ExtendedButton;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
@@ -12,13 +13,13 @@ import javax.annotation.ParametersAreNonnullByDefault;
|
||||
* This class provides a checkbox style control.
|
||||
*/
|
||||
@ParametersAreNonnullByDefault
|
||||
public class GuiCheckBoxFixed extends Button {
|
||||
public class GuiCheckBoxFixed extends ExtendedButton {
|
||||
private final int boxWidth;
|
||||
private boolean isChecked;
|
||||
|
||||
public GuiCheckBoxFixed(int xPos, int yPos, String displayString, boolean isChecked) {
|
||||
super(xPos, yPos, Minecraft.getInstance().font.width(displayString) + 2 + 11, 11, Component.literal(displayString), b -> {
|
||||
});
|
||||
super(xPos, yPos, Minecraft.getInstance().font.width(displayString) + 2 + 11, 11,
|
||||
Component.literal(displayString), b -> {}, DEFAULT_NARRATION);
|
||||
this.isChecked = isChecked;
|
||||
this.boxWidth = 11;
|
||||
this.height = 11;
|
||||
@@ -29,8 +30,8 @@ public class GuiCheckBoxFixed extends Button {
|
||||
public void renderButton(PoseStack ms, int mouseX, int mouseY, float partial) {
|
||||
if (this.visible) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
this.isHovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.boxWidth && mouseY < this.y + this.height;
|
||||
ScreenUtils.blitWithBorder(ms, WIDGETS_LOCATION, this.x, this.y, 0, 46, this.boxWidth, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
|
||||
this.isHovered = mouseX >= this.getX() && mouseY >= this.getY() && mouseX < this.getX() + this.boxWidth && mouseY < this.getY() + this.height;
|
||||
ScreenUtils.blitWithBorder(ms, WIDGETS_LOCATION, this.getX(), this.getY(), 0, 46, this.boxWidth, this.height, 200, 20, 2, 3, 2, 2, this.getBlitOffset());
|
||||
this.renderBg(ms, mc, mouseX, mouseY);
|
||||
int color = 14737632;
|
||||
|
||||
@@ -41,9 +42,9 @@ public class GuiCheckBoxFixed extends Button {
|
||||
}
|
||||
|
||||
if (this.isChecked)
|
||||
drawCenteredString(ms, mc.font, "x", this.x + this.boxWidth / 2 + 1, this.y + 1, 14737632);
|
||||
drawCenteredString(ms, mc.font, "x", this.getX() + this.boxWidth / 2 + 1, this.getY() + 1, 14737632);
|
||||
|
||||
drawString(ms, mc.font, getMessage(), this.x + this.boxWidth + 2, this.y + 2, color);
|
||||
drawString(ms, mc.font, getMessage(), this.getX() + this.boxWidth + 2, this.getY() + 2, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package nl.requios.effortlessbuilding.gui.elements;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -28,7 +28,7 @@ public abstract class GuiCollapsibleScrollEntry implements GuiScrollPane.IScroll
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(List<Widget> renderables) {
|
||||
public void init(List<Renderable> renderables) {
|
||||
left = scrollPane.getWidth() / 2 - 140;
|
||||
right = scrollPane.getWidth() / 2 + 140;
|
||||
top = scrollPane.getHeight() / 2 - 100;
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.gui.widget.ExtendedButton;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.ArrayList;
|
||||
@@ -16,7 +17,7 @@ import java.util.List;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@ParametersAreNonnullByDefault
|
||||
public class GuiIconButton extends Button {
|
||||
public class GuiIconButton extends ExtendedButton {
|
||||
|
||||
private final ResourceLocation resourceLocation;
|
||||
private final int iconX, iconY, iconWidth, iconHeight, iconAltX, iconAltY;
|
||||
@@ -28,7 +29,7 @@ public class GuiIconButton extends Button {
|
||||
}
|
||||
|
||||
public GuiIconButton(int x, int y, int width, int height, int iconX, int iconY, int iconWidth, int iconHeight, int iconAltX, int iconAltY, ResourceLocation resourceLocation, Button.OnPress onPress) {
|
||||
super(x, y, width, height, Component.empty(), onPress);
|
||||
super(x, y, width, height, Component.empty(), onPress, DEFAULT_NARRATION);
|
||||
this.iconX = iconX;
|
||||
this.iconY = iconY;
|
||||
this.iconWidth = iconWidth;
|
||||
@@ -54,7 +55,7 @@ public class GuiIconButton extends Button {
|
||||
public void render(PoseStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
super.render(ms, mouseX, mouseY, partialTicks);
|
||||
if (this.visible) {
|
||||
this.isHovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
this.isHovered = mouseX >= this.getX() && mouseY >= this.getY() && mouseX < this.getX() + this.width && mouseY < this.getY() + this.height;
|
||||
RenderSystem.setShaderTexture(0, this.resourceLocation);
|
||||
int currentIconX = this.iconX;
|
||||
int currentIconY = this.iconY;
|
||||
@@ -65,12 +66,12 @@ public class GuiIconButton extends Button {
|
||||
}
|
||||
|
||||
//Draws a textured rectangle at the current z-value. Used to be drawTexturedModalRect in Gui.
|
||||
this.blit(ms, this.x, this.y, currentIconX, currentIconY, this.iconWidth, this.iconHeight);
|
||||
this.blit(ms, this.getX(), this.getY(), currentIconX, currentIconY, this.iconWidth, this.iconHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawTooltip(PoseStack ms, Screen screen, int mouseX, int mouseY) {
|
||||
boolean flag = mouseX >= x && mouseX < x + width && mouseY >= y && mouseY < y + height;
|
||||
boolean flag = mouseX >= this.getX() && mouseX < this.getX() + width && mouseY >= this.getY() && mouseY < this.getY() + height;
|
||||
|
||||
if (flag) {
|
||||
screen.renderComponentTooltip(ms, tooltip, mouseX - 10, mouseY + 25);
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.components.EditBox;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.gui.widget.ExtendedButton;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.awt.*;
|
||||
@@ -34,21 +35,21 @@ public class GuiNumberField extends GuiComponent {
|
||||
|
||||
List<Component> tooltip = new ArrayList<>();
|
||||
|
||||
public GuiNumberField(Font font, List<Widget> renderables, int x, int y, int width, int height) {
|
||||
public GuiNumberField(Font font, List<Renderable> renderables, int x, int y, int width, int height) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
||||
textField = new EditBox(font, x + buttonWidth + 1, y + 1, width - 2 * buttonWidth - 2, height - 2, Component.empty());
|
||||
minusButton = new Button(x, y - 1, buttonWidth, height + 2, Component.literal("-"), button -> {
|
||||
minusButton = new ExtendedButton(x, y - 1, buttonWidth, height + 2, Component.literal("-"), button -> {
|
||||
float valueChanged = 1f;
|
||||
if (Screen.hasControlDown()) valueChanged = 5f;
|
||||
if (Screen.hasShiftDown()) valueChanged = 10f;
|
||||
|
||||
setNumber(getNumber() - valueChanged);
|
||||
});
|
||||
plusButton = new Button(x + width - buttonWidth, y - 1, buttonWidth, height + 2, Component.literal("+"), button -> {
|
||||
plusButton = new ExtendedButton(x + width - buttonWidth, y - 1, buttonWidth, height + 2, Component.literal("+"), button -> {
|
||||
float valueChanged = 1f;
|
||||
if (Screen.hasControlDown()) valueChanged = 5f;
|
||||
if (Screen.hasShiftDown()) valueChanged = 10f;
|
||||
@@ -98,9 +99,9 @@ public class GuiNumberField extends GuiComponent {
|
||||
}
|
||||
|
||||
public void drawNumberField(PoseStack ms, int mouseX, int mouseY, float partialTicks) {
|
||||
textField.y = y + 1;
|
||||
minusButton.y = y - 1;
|
||||
plusButton.y = y - 1;
|
||||
textField.setY(y + 1);
|
||||
minusButton.setY(y - 1);
|
||||
plusButton.setY(y - 1);
|
||||
|
||||
textField.render(ms, mouseX, mouseY, partialTicks);
|
||||
minusButton.render(ms, mouseX, mouseY, partialTicks);
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
@@ -398,7 +398,7 @@ public class GuiScrollPane extends SlotGui {
|
||||
}
|
||||
|
||||
//PASSTHROUGHS
|
||||
public void init(List<Widget> renderables) {
|
||||
public void init(List<Renderable> renderables) {
|
||||
for (IScrollEntry entry : this.listEntries) {
|
||||
entry.init(renderables);
|
||||
}
|
||||
@@ -436,7 +436,7 @@ public class GuiScrollPane extends SlotGui {
|
||||
}
|
||||
|
||||
public interface IScrollEntry {
|
||||
void init(List<Widget> renderables);
|
||||
void init(List<Renderable> renderables);
|
||||
|
||||
void updateScreen();
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.events.AbstractContainerEventHandler;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@SuppressWarnings("deprecation")
|
||||
public abstract class SlotGui extends AbstractContainerEventHandler implements Widget {
|
||||
public abstract class SlotGui extends AbstractContainerEventHandler implements Renderable {
|
||||
protected final Minecraft minecraft;
|
||||
protected final int itemHeight;
|
||||
protected int width;
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
@@ -239,7 +240,8 @@ public class SurvivalHelper {
|
||||
} else {
|
||||
//Adventure mode
|
||||
BlockInWorld blockinworld = new BlockInWorld(world, pos, false);
|
||||
return stack.hasAdventureModePlaceTagForBlock(world.registryAccess().registryOrThrow(Registry.BLOCK_REGISTRY), blockinworld);
|
||||
Registry<Block> registry = world.registryAccess().registryOrThrow(Registries.BLOCK);
|
||||
return stack.hasAdventureModePlaceTagForBlock(registry, blockinworld);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class AbstractRandomizerBagItem extends Item {
|
||||
private static final Random rand = new Random(currentSeed);
|
||||
|
||||
public AbstractRandomizerBagItem() {
|
||||
super(new Item.Properties().tab(CreativeModeTab.TAB_TOOLS).stacksTo(1));
|
||||
super(new Item.Properties().stacksTo(1));
|
||||
}
|
||||
|
||||
public abstract int getInventorySize();
|
||||
|
||||
@@ -33,7 +33,7 @@ public class DiamondRandomizerBagItem extends AbstractRandomizerBagItem{
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return Component.translatable("effortlessbuilding:diamond_randomizer_bag");
|
||||
return Component.translatable("item.effortlessbuilding.diamond_randomizer_bag");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -33,7 +33,7 @@ public class GoldenRandomizerBagItem extends AbstractRandomizerBagItem{
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return Component.translatable("effortlessbuilding:golden_randomizer_bag");
|
||||
return Component.translatable("item.effortlessbuilding.golden_randomizer_bag");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -33,7 +33,7 @@ public class RandomizerBagItem extends AbstractRandomizerBagItem {
|
||||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return Component.translatable("effortlessbuilding:randomizer_bag");
|
||||
return Component.translatable("item.effortlessbuilding.randomizer_bag");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -29,7 +29,7 @@ import net.minecraft.world.InteractionResultHolder;
|
||||
public class ReachUpgrade1Item extends Item {
|
||||
|
||||
public ReachUpgrade1Item() {
|
||||
super(new Item.Properties().tab(CreativeModeTab.TAB_TOOLS).stacksTo(1));
|
||||
super(new Item.Properties().stacksTo(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,14 +48,14 @@ public class ReachUpgrade1Item extends Item {
|
||||
if (world.isClientSide) EffortlessBuilding.log(player, "Upgraded reach to " + ReachHelper.getMaxReach(player));
|
||||
player.setItemInHand(hand, ItemStack.EMPTY);
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("entity.player.levelup"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("entity.player.levelup"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
} else if (currentLevel > 0) {
|
||||
if (world.isClientSide)
|
||||
EffortlessBuilding.log(player, "Already used this upgrade! Current reach is " + ReachHelper
|
||||
.getMaxReach(player) + ".");
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
}
|
||||
return new InteractionResultHolder<>(InteractionResult.PASS, player.getItemInHand(hand));
|
||||
|
||||
@@ -30,7 +30,7 @@ import net.minecraft.world.InteractionResultHolder;
|
||||
public class ReachUpgrade2Item extends Item {
|
||||
|
||||
public ReachUpgrade2Item() {
|
||||
super(new Item.Properties().tab(CreativeModeTab.TAB_TOOLS).stacksTo(1));
|
||||
super(new Item.Properties().stacksTo(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,19 +48,19 @@ public class ReachUpgrade2Item extends Item {
|
||||
if (world.isClientSide) EffortlessBuilding.log(player, "Upgraded reach to " + ReachHelper.getMaxReach(player));
|
||||
player.setItemInHand(hand, ItemStack.EMPTY);
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("entity.player.levelup"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("entity.player.levelup"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
} else if (currentLevel < 1) {
|
||||
if (world.isClientSide) EffortlessBuilding.log(player, "Use Reach Upgrade 1 first.");
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
} else if (currentLevel > 1) {
|
||||
if (world.isClientSide)
|
||||
EffortlessBuilding.log(player, "Already used this upgrade! Current reach is " + ReachHelper
|
||||
.getMaxReach(player) + ".");
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
}
|
||||
return new InteractionResultHolder<>(InteractionResult.PASS, player.getItemInHand(hand));
|
||||
|
||||
@@ -29,7 +29,7 @@ import net.minecraft.world.InteractionResultHolder;
|
||||
public class ReachUpgrade3Item extends Item {
|
||||
|
||||
public ReachUpgrade3Item() {
|
||||
super(new Item.Properties().tab(CreativeModeTab.TAB_TOOLS).stacksTo(1));
|
||||
super(new Item.Properties().stacksTo(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,7 +47,7 @@ public class ReachUpgrade3Item extends Item {
|
||||
if (world.isClientSide) EffortlessBuilding.log(player, "Upgraded reach to " + ReachHelper.getMaxReach(player));
|
||||
player.setItemInHand(hand, ItemStack.EMPTY);
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("entity.player.levelup"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("entity.player.levelup"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
} else if (currentLevel < 2) {
|
||||
if (currentLevel == 0)
|
||||
@@ -55,14 +55,14 @@ public class ReachUpgrade3Item extends Item {
|
||||
if (currentLevel == 1)
|
||||
if (world.isClientSide) EffortlessBuilding.log(player, "Use Reach Upgrade 2 first.");
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
} else if (currentLevel > 2) {
|
||||
if (world.isClientSide)
|
||||
EffortlessBuilding.log(player, "Already used this upgrade! Current reach is " + ReachHelper
|
||||
.getMaxReach(player) + ".");
|
||||
|
||||
SoundEvent soundEvent = new SoundEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
SoundEvent soundEvent = SoundEvent.createVariableRangeEvent(new ResourceLocation("item.armor.equip_leather"));
|
||||
player.playSound(soundEvent, 1f, 1f);
|
||||
}
|
||||
return new InteractionResultHolder<>(InteractionResult.PASS, player.getItemInHand(hand));
|
||||
|
||||
@@ -3,13 +3,13 @@ package nl.requios.effortlessbuilding.render;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import com.mojang.math.Matrix4f;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import nl.requios.effortlessbuilding.buildmodifier.Mirror;
|
||||
import nl.requios.effortlessbuilding.buildmodifier.ModifierSettingsManager;
|
||||
import nl.requios.effortlessbuilding.buildmodifier.RadialMirror;
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
"key.effortlessbuilding.redo.desc": "Redo",
|
||||
"key.effortlessbuilding.altplacement.desc": "Alternative placement",
|
||||
|
||||
"effortlessbuilding:randomizer_bag": "Leather Randomizer Bag",
|
||||
"effortlessbuilding:golden_randomizer_bag": "Golden Randomizer Bag",
|
||||
"effortlessbuilding:diamond_randomizer_bag": "Diamond Randomizer Bag",
|
||||
"effortlessbuilding:reach_upgrade1": "Reach Upgrade 1",
|
||||
"effortlessbuilding:reach_upgrade2": "Reach Upgrade 2",
|
||||
"effortlessbuilding:reach_upgrade3": "Reach Upgrade 3",
|
||||
"item.effortlessbuilding.randomizer_bag": "Leather Randomizer Bag",
|
||||
"item.effortlessbuilding.golden_randomizer_bag": "Golden Randomizer Bag",
|
||||
"item.effortlessbuilding.diamond_randomizer_bag": "Diamond Randomizer Bag",
|
||||
"item.effortlessbuilding.reach_upgrade1": "Reach Upgrade 1",
|
||||
"item.effortlessbuilding.reach_upgrade2": "Reach Upgrade 2",
|
||||
"item.effortlessbuilding.reach_upgrade3": "Reach Upgrade 3",
|
||||
|
||||
"effortlessbuilding.mode.normal": "Disable",
|
||||
"effortlessbuilding.mode.normal_plus": "Single",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "effortlessbuilding:items/diamondrandomizerbag"
|
||||
"layer0": "effortlessbuilding:item/diamondrandomizerbag"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "effortlessbuilding:items/goldenrandomizerbag"
|
||||
"layer0": "effortlessbuilding:item/goldenrandomizerbag"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "effortlessbuilding:items/randomizerbag"
|
||||
"layer0": "effortlessbuilding:item/randomizerbag"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "effortlessbuilding:items/reachupgrade1"
|
||||
"layer0": "effortlessbuilding:item/reachupgrade1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "effortlessbuilding:items/reachupgrade2"
|
||||
"layer0": "effortlessbuilding:item/reachupgrade2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "effortlessbuilding:items/reachupgrade3"
|
||||
"layer0": "effortlessbuilding:item/reachupgrade3"
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 394 B After Width: | Height: | Size: 394 B |
|
Before Width: | Height: | Size: 625 B After Width: | Height: | Size: 625 B |
|
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 603 B |
|
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 618 B |