mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-24 14:06:42 +01:00
Jar Fixes
- Fixed ScrollFixer not working in built jar - updated mods.toml - moved TreeFertilizer to item package
This commit is contained in:
parent
ebb9d6e490
commit
f0b9c30ef5
9 changed files with 46 additions and 44 deletions
|
@ -25,7 +25,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: 'snapshot', version: '20190621-1.14.2'
|
||||
mappings channel: 'snapshot', version: '20190717-1.14.3'
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
|
||||
// accessTransformer = file('build/resources/main/META-INF/accesstransformer.cfg')
|
||||
|
@ -89,7 +89,7 @@ dependencies {
|
|||
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
|
||||
// that the dep is a ForgeGradle 'patcher' dependency. And it's 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.14.3-27.0.43'
|
||||
minecraft 'net.minecraftforge:forge:1.14.3-27.0.57'
|
||||
|
||||
// You may put jars on which you depend on in ./libs or you may define them like so..
|
||||
// compile "some.group:artifact:version:classifier"
|
||||
|
|
|
@ -2,8 +2,8 @@ package com.simibubi.create;
|
|||
|
||||
import com.simibubi.create.item.ItemBlueprint;
|
||||
import com.simibubi.create.item.ItemBlueprintAndQuill;
|
||||
import com.simibubi.create.item.ItemTreeFertilizer;
|
||||
import com.simibubi.create.item.ItemWandSymmetry;
|
||||
import com.simibubi.create.supertree.ItemTreeFertilizer;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.Properties;
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.apache.logging.log4j.Logger;
|
|||
|
||||
import com.simibubi.create.gui.Keyboard;
|
||||
import com.simibubi.create.networking.Packets;
|
||||
import com.simibubi.create.schematic.BlueprintAndQuillHandler;
|
||||
import com.simibubi.create.schematic.BlueprintHandler;
|
||||
import com.simibubi.create.schematic.SchematicHologram;
|
||||
|
||||
|
@ -63,9 +62,6 @@ public class Create {
|
|||
new SchematicHologram();
|
||||
new BlueprintHandler();
|
||||
ScrollFixer.init();
|
||||
ScrollFixer.addMouseWheelListener(BlueprintHandler.instance::onScroll);
|
||||
ScrollFixer.addMouseWheelListener(BlueprintAndQuillHandler::onScroll);
|
||||
|
||||
TOOL_MENU = new KeyBinding("Tool Menu (Hold)", Keyboard.LALT, NAME);
|
||||
ClientRegistry.registerKeyBinding(TOOL_MENU);
|
||||
});
|
||||
|
|
|
@ -2,49 +2,45 @@ package com.simibubi.create;
|
|||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.glfw.GLFWScrollCallback;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.MouseHelper;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent.MouseScrollEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
|
||||
public class ScrollFixer {
|
||||
|
||||
private static List<Predicate<Double>> listeners;
|
||||
|
||||
public static void init() {
|
||||
listeners = new ArrayList<>();
|
||||
Method method;
|
||||
try {
|
||||
MouseHelper mouseHelper = Minecraft.getInstance().mouseHelper;
|
||||
method = mouseHelper.getClass().getDeclaredMethod("scrollCallback", Long.TYPE,
|
||||
Method method = ObfuscationReflectionHelper.findMethod(mouseHelper.getClass(), "func_198020_a", Long.TYPE,
|
||||
Double.TYPE, Double.TYPE);
|
||||
method.setAccessible(true);
|
||||
GLFW.glfwSetScrollCallback(Minecraft.getInstance().mainWindow.getHandle(), new GLFWScrollCallback() {
|
||||
|
||||
GLFWScrollCallback callback = new GLFWScrollCallback() {
|
||||
@Override
|
||||
public void invoke(long win, double dx, double dy) {
|
||||
for (Predicate<Double> consumer : listeners) {
|
||||
if (consumer.test(dy))
|
||||
return;
|
||||
}
|
||||
MouseScrollEvent.Post event = new MouseScrollEvent.Post(null, mouseHelper.getMouseX(),
|
||||
mouseHelper.getMouseY(), dy);
|
||||
boolean canceled = MinecraftForge.EVENT_BUS.post(event);
|
||||
if (canceled)
|
||||
return;
|
||||
|
||||
try {
|
||||
method.invoke(mouseHelper, win, dx, dy);
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (NoSuchMethodException | SecurityException e1) {
|
||||
};
|
||||
|
||||
GLFW.glfwSetScrollCallback(Minecraft.getInstance().mainWindow.getHandle(), callback);
|
||||
} catch (SecurityException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void addMouseWheelListener(Predicate<Double> callback) {
|
||||
listeners.add(callback);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ public class BlueprintHotbarOverlay extends AbstractGui {
|
|||
MainWindow mainWindow = Minecraft.getInstance().mainWindow;
|
||||
int x = mainWindow.getScaledWidth() / 2 - 92;
|
||||
int y = mainWindow.getScaledHeight() - 23;
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.enableAlphaTest();
|
||||
GuiResources.BLUEPRINT_SLOT.draw(this, x + 20 * slot, y);
|
||||
GlStateManager.disableAlphaTest();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.simibubi.create.supertree;
|
||||
package com.simibubi.create.item;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@ -68,6 +68,9 @@ public class ItemTreeFertilizer extends Item {
|
|||
|
||||
context.getWorld().setBlockState(actualPos, world.getBlockState(pos));
|
||||
}
|
||||
|
||||
if (!context.getPlayer().isCreative())
|
||||
context.getItem().shrink(1);
|
||||
return ActionResultType.SUCCESS;
|
||||
|
||||
}
|
|
@ -35,6 +35,7 @@ import net.minecraft.util.math.RayTraceResult.Type;
|
|||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.gen.feature.template.Template;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent.MouseScrollEvent;
|
||||
import net.minecraftforge.client.event.InputEvent.MouseInputEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
@ -58,13 +59,17 @@ public class BlueprintAndQuillHandler {
|
|||
&& Minecraft.getInstance().currentScreen == null && !Minecraft.getInstance().player.isSneaking();
|
||||
}
|
||||
|
||||
public static boolean onScroll(double delta) {
|
||||
@SubscribeEvent
|
||||
// TODO: This is a fabricated event call by ScrollFixer until a proper event exists
|
||||
public static void onMouseScrolled(MouseScrollEvent.Post event) {
|
||||
if (event.getGui() != null)
|
||||
return;
|
||||
if (!active())
|
||||
return false;
|
||||
return;
|
||||
if (!Keyboard.isKeyDown(GLFW.GLFW_KEY_LEFT_CONTROL))
|
||||
return false;
|
||||
range = (int) MathHelper.clamp(range + delta, 1, 100);
|
||||
return true;
|
||||
return;
|
||||
range = (int) MathHelper.clamp(range + event.getScrollDelta(), 1, 100);
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
@ -37,6 +37,7 @@ import net.minecraftforge.client.event.InputEvent.KeyInputEvent;
|
|||
import net.minecraftforge.client.event.InputEvent.MouseInputEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent.MouseScrollEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
|
||||
|
@ -215,6 +216,15 @@ public class BlueprintHandler {
|
|||
toolSelection.focused = true;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
// TODO: This is a fabricated event call by ScrollFixer until a proper event exists
|
||||
public static void onMouseScrolled(MouseScrollEvent.Post event) {
|
||||
if (event.getGui() != null)
|
||||
return;
|
||||
if (instance.onScroll(event.getScrollDelta()))
|
||||
event.setCanceled(true);
|
||||
}
|
||||
|
||||
public boolean onScroll(double delta) {
|
||||
if (!active)
|
||||
return false;
|
||||
|
|
|
@ -14,26 +14,18 @@ loaderVersion="[26,)" #mandatory (26 is current forge version)
|
|||
# The modid of the mod
|
||||
modId="create" #mandatory
|
||||
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
||||
version="${file.jarVersion}" #mandatory
|
||||
version="0.0.1" #mandatory
|
||||
# A display name for the mod
|
||||
displayName="Create" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification <here>
|
||||
#updateJSONURL=""#optional
|
||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||
displayURL="http://example.com/" #optional
|
||||
# A file name (in the root of the mod JAR) containing a logo for display
|
||||
logoFile="examplemod.png" #optional
|
||||
# A text field displayed in the mod UI
|
||||
credits="Thanks for this example mod goes to Java" #optional
|
||||
# A text field displayed in the mod UI
|
||||
authors="simibubi" #optional
|
||||
# The description text for the mod (multi line!) (#mandatory)
|
||||
description='''
|
||||
This is a long form description of the mod. You can write whatever you want here
|
||||
|
||||
Have some lorem ipsum.
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
A handful of additions to aid the creative survivalist.
|
||||
'''
|
||||
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
||||
[[dependencies.examplemod]] #optional
|
||||
|
|
Loading…
Reference in a new issue