Fullbright
This commit is contained in:
@@ -64,7 +64,7 @@ __Warning:__ Access Transformers are bugged and will deny you any sources for th
|
|||||||
Mixins are usually used to modify vanilla or mod/library in runtime without having to change source code. For example, redirect a call, change visibility or make class implement your interface. It's an advanced topic and most mods don't need to do that.
|
Mixins are usually used to modify vanilla or mod/library in runtime without having to change source code. For example, redirect a call, change visibility or make class implement your interface. It's an advanced topic and most mods don't need to do that.
|
||||||
|
|
||||||
You can activate Mixin in 'gradle.properties'. In that case a mixin configuration (usually named `mixins.mymodid.json`) will be generated automatically, and you only have to write the mixins itself. Dependencies are handled as well.
|
You can activate Mixin in 'gradle.properties'. In that case a mixin configuration (usually named `mixins.mymodid.json`) will be generated automatically, and you only have to write the mixins itself. Dependencies are handled as well.
|
||||||
Take a look at the examples in [`com.lumijiez.cacheduper.mixinplugin.*`](https://github.com/SinTh0r4s/ExampleMod1.7.10/tree/example-mixins/src/main/java/com/myname/mymodid/mixinplugin) and [`com.lumijiez.cacheduper.mixins.*`](https://github.com/SinTh0r4s/ExampleMod1.7.10/tree/example-mixins/src/main/java/com/myname/mymodid/mixins).
|
Take a look at the examples in [`com.lumijiez.luminous.mixinplugin.*`](https://github.com/SinTh0r4s/ExampleMod1.7.10/tree/example-mixins/src/main/java/com/myname/mymodid/mixinplugin) and [`com.lumijiez.luminous.mixins.*`](https://github.com/SinTh0r4s/ExampleMod1.7.10/tree/example-mixins/src/main/java/com/myname/mymodid/mixins).
|
||||||
|
|
||||||
Check out the [`example-mixins`](https://github.com/SinTh0r4s/ExampleMod1.7.10/tree/example-mixins) brach for a working example!
|
Check out the [`example-mixins`](https://github.com/SinTh0r4s/ExampleMod1.7.10/tree/example-mixins) brach for a working example!
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
modName = CacheDuper
|
modName = Luminous
|
||||||
|
|
||||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||||
modId = cacheduper
|
modId = luminous
|
||||||
|
|
||||||
modGroup = com.lumijiez.cacheduper
|
modGroup = com.lumijiez.luminous
|
||||||
|
|
||||||
# WHY is there no version field?
|
# WHY is there no version field?
|
||||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
||||||
@@ -15,7 +15,7 @@ autoUpdateBuildScript = false
|
|||||||
minecraftVersion = 1.7.10
|
minecraftVersion = 1.7.10
|
||||||
forgeVersion = 10.13.4.1614
|
forgeVersion = 10.13.4.1614
|
||||||
|
|
||||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
|
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
|
||||||
# restart Minecraft in development. Choose this dependent on your mod:
|
# restart Minecraft in development. Choose this dependent on your mod:
|
||||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||||
@@ -34,7 +34,7 @@ gradleTokenGroupName = GRADLETOKEN_GROUPNAME
|
|||||||
|
|
||||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||||
# leave this property empty.
|
# leave this property empty.
|
||||||
# Example value: apiPackage = api + modGroup = com.lumijiez.cacheduper -> com.lumijiez.cacheduper.api
|
# Example value: apiPackage = api + modGroup = com.lumijiez.luminous -> com.lumijiez.luminous.api
|
||||||
apiPackage =
|
apiPackage =
|
||||||
|
|
||||||
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
|
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
|
||||||
@@ -49,7 +49,7 @@ mixinPlugin =
|
|||||||
mixinsPackage =
|
mixinsPackage =
|
||||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||||
# This parameter is for legacy compatibility only
|
# This parameter is for legacy compatibility only
|
||||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.lumijiez.cacheduper -> com.lumijiez.cacheduper.asm.FMLPlugin
|
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.lumijiez.luminous -> com.lumijiez.luminous.asm.FMLPlugin
|
||||||
coreModClass =
|
coreModClass =
|
||||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
package com.lumijiez.cacheduper;
|
|
||||||
|
|
||||||
import net.minecraft.command.CommandBase;
|
|
||||||
import net.minecraft.command.ICommandSender;
|
|
||||||
import java.util.UUID;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.ChatComponentText;
|
|
||||||
|
|
||||||
public class CacheDupeCommand extends CommandBase {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCommandName() {
|
|
||||||
return "cachedp";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRequiredPermissionLevel() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canCommandSenderUseCommand(ICommandSender sender) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCommandUsage(ICommandSender sender) {
|
|
||||||
return "/cachedp <block_id> <number>";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void processCommand(ICommandSender sender, String[] args) {
|
|
||||||
if (args.length != 2) {
|
|
||||||
sender.addChatMessage(new ChatComponentText("Invalid arguments. Usage: " + getCommandUsage(sender)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String itemId = args[0];
|
|
||||||
int number;
|
|
||||||
|
|
||||||
try {
|
|
||||||
number = Integer.parseInt(args[1]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
sender.addChatMessage(new ChatComponentText("The number parameter must be an integer."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Utils utils = new Utils();
|
|
||||||
|
|
||||||
ItemStack stack = Utils.getItemStackFromId(itemId, number);
|
|
||||||
|
|
||||||
TileEntity checkTile = utils.tile();
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (Class.forName("cofh.thermalexpansion.block.cache.TileCache").isInstance(checkTile)) {
|
|
||||||
Object packet = Class.forName("cofh.core.network.PacketTile").getConstructor(TileEntity.class).newInstance(checkTile);
|
|
||||||
Class.forName("cofh.core.network.PacketCoFHBase").getMethod("addString", String.class).invoke(packet, "");
|
|
||||||
Class.forName("cofh.core.network.PacketCoFHBase").getMethod("addByte", byte.class).invoke(packet, (byte) 0);
|
|
||||||
Class.forName("cofh.core.network.PacketCoFHBase").getMethod("addUUID", UUID.class).invoke(packet, UUID.randomUUID());
|
|
||||||
Class.forName("cofh.core.network.PacketCoFHBase").getMethod("addString", String.class).invoke(packet, "");
|
|
||||||
Class.forName("cofh.core.network.PacketCoFHBase").getMethod("addBool", boolean.class).invoke(packet, true);
|
|
||||||
Class.forName("cofh.core.network.PacketCoFHBase").getMethod("addByte", byte.class).invoke(packet, (byte) 0);
|
|
||||||
Class.forName("cofh.core.network.PacketCoFHBase").getMethod("addBool", boolean.class).invoke(packet, true);
|
|
||||||
Class.forName("cofh.core.network.PacketCoFHBase").getMethod("addInt", int.class).invoke(packet, 0);
|
|
||||||
Class.forName("cofh.core.network.PacketCoFHBase").getMethod("addByteArray", byte[].class).invoke(packet, new byte[6]);
|
|
||||||
Class.forName("cofh.core.network.PacketCoFHBase").getMethod("addByte", byte.class).invoke(packet, (byte) 0);
|
|
||||||
Class.forName("cofh.core.network.PacketCoFHBase").getMethod("addBool", boolean.class).invoke(packet, false);
|
|
||||||
Class.forName("cofh.core.network.PacketCoFHBase").getMethod("addItemStack", ItemStack.class).invoke(packet, stack);
|
|
||||||
Class.forName("cofh.core.network.PacketCoFHBase").getMethod("addInt", int.class).invoke(packet, number);
|
|
||||||
Class.forName("cofh.core.network.PacketHandler").getMethod("sendToServer", Class.forName("cofh.core.network.PacketBase")).invoke(null, packet);
|
|
||||||
}
|
|
||||||
} catch(Exception ignored) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.lumijiez.cacheduper;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.Mod;
|
|
||||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
|
||||||
|
|
||||||
@Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME, acceptedMinecraftVersions = "[1.7.10]")
|
|
||||||
public class CacheDuper {
|
|
||||||
|
|
||||||
@Mod.EventHandler
|
|
||||||
public void onServerStarting(FMLServerStartingEvent event) {
|
|
||||||
event.registerServerCommand(new CacheDupeCommand());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.lumijiez.cacheduper;
|
|
||||||
|
|
||||||
// Use this class for Strings only. Do not import any classes here. It will lead to issues with Mixins if in use!
|
|
||||||
|
|
||||||
public class Tags {
|
|
||||||
|
|
||||||
// GRADLETOKEN_* will be replaced by your configuration values at build time
|
|
||||||
public static final String MODID = "GRADLETOKEN_MODID";
|
|
||||||
public static final String MODNAME = "GRADLETOKEN_MODNAME";
|
|
||||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
|
||||||
public static final String GROUPNAME = "GRADLETOKEN_GROUPNAME";
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
package com.lumijiez.cacheduper;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.multiplayer.WorldClient;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
|
||||||
|
|
||||||
public class Utils {
|
|
||||||
|
|
||||||
public Minecraft mc() {
|
|
||||||
return Minecraft.getMinecraft();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] mop() {
|
|
||||||
MovingObjectPosition mop = mc().renderViewEntity.rayTrace(200, 1.0F);
|
|
||||||
Entity ent = pointedEntity();
|
|
||||||
return new int[] { mop.blockX, mop.blockY, mop.blockZ, mop.sideHit, (ent != null) ? ent.getEntityId() : -1 };
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getItemStackFromId(String itemId, int quantity) {
|
|
||||||
String[] parts = itemId.split(":");
|
|
||||||
if (parts.length != 2) {
|
|
||||||
System.out.println("Invalid item ID format. Expected modid:itemname");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
String modId = parts[0];
|
|
||||||
String itemName = parts[1];
|
|
||||||
|
|
||||||
Item item = GameRegistry.findItem(modId, itemName);
|
|
||||||
if (item == null) {
|
|
||||||
System.out.println("Item not found: " + itemId);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ItemStack(item, quantity);
|
|
||||||
}
|
|
||||||
|
|
||||||
public WorldClient world() {
|
|
||||||
return mc().theWorld;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileEntity tile() {
|
|
||||||
return tile(mop());
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileEntity tile(int[] mop) {
|
|
||||||
return tile(mop[0], mop[1], mop[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileEntity tile(int x, int y, int z) {
|
|
||||||
return world().getTileEntity(x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Entity pointedEntity() {
|
|
||||||
return mc().objectMouseOver.entityHit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
33
src/main/java/com/lumijiez/luminous/HelloCommand.java
Normal file
33
src/main/java/com/lumijiez/luminous/HelloCommand.java
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package com.lumijiez.luminous;
|
||||||
|
|
||||||
|
import net.minecraft.command.CommandBase;
|
||||||
|
import net.minecraft.command.ICommandSender;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
|
||||||
|
public class HelloCommand extends CommandBase {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandName() {
|
||||||
|
return "hello";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRequiredPermissionLevel() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canCommandSenderUseCommand(ICommandSender sender) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommandUsage(ICommandSender sender) {
|
||||||
|
return "/hello";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processCommand(ICommandSender sender, String[] args) {
|
||||||
|
sender.addChatMessage(new ChatComponentText("Hello!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
42
src/main/java/com/lumijiez/luminous/Luminous.java
Normal file
42
src/main/java/com/lumijiez/luminous/Luminous.java
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package com.lumijiez.luminous;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Mod;
|
||||||
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||||
|
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraftforge.client.event.RenderWorldEvent;
|
||||||
|
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
@Mod(modid = Tags.MODID, version = Tags.VERSION, name = Tags.MODNAME, acceptedMinecraftVersions = "[1.7.10]")
|
||||||
|
public class Luminous {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(Tags.MODID);
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onRender(RenderWorldLastEvent event) {
|
||||||
|
if (Minecraft.getMinecraft().theWorld != null) {
|
||||||
|
float[] bTable = Minecraft.getMinecraft().theWorld.provider.lightBrightnessTable;
|
||||||
|
if (bTable != null) {
|
||||||
|
Arrays.fill(bTable, 1.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void onServerStarting(FMLServerStartingEvent event) {
|
||||||
|
event.registerServerCommand(new HelloCommand());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
|
logger.info("Luminous mod initialized.");
|
||||||
|
}
|
||||||
|
}
|
||||||
9
src/main/java/com/lumijiez/luminous/Tags.java
Normal file
9
src/main/java/com/lumijiez/luminous/Tags.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package com.lumijiez.luminous;
|
||||||
|
|
||||||
|
|
||||||
|
public class Tags {
|
||||||
|
public static final String MODID = "GRADLETOKEN_MODID";
|
||||||
|
public static final String MODNAME = "GRADLETOKEN_MODNAME";
|
||||||
|
public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||||
|
public static final String ROUPNAME = "GRADLETOKEN_GROUPNAME";
|
||||||
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"modid": "${modId}",
|
"modid": "luminous",
|
||||||
"name": "${modName}",
|
"name": "Luminous",
|
||||||
"description": "An example mod for Minecraft 1.7.10 with Forge focussed on a stable setup.",
|
"description": "Simple, fast fullbright mod for 1.7.10",
|
||||||
"version": "${modVersion}",
|
"version": "1.0.0",
|
||||||
"mcversion": "${minecraftVersion}",
|
"mcversion": "1.7.10",
|
||||||
"url": "https://github.com/SinTh0r4s/MyMod",
|
"url": "https://github.com/lumijiez/forge-luminous",
|
||||||
"updateUrl": "",
|
"updateUrl": "",
|
||||||
"authorList": ["SinTho0r4s"],
|
"authorList": ["Lumijiez"],
|
||||||
"credits": "",
|
"credits": "",
|
||||||
"logoFile": "",
|
"logoFile": "",
|
||||||
"screenshots": [],
|
"screenshots": [],
|
||||||
|
|||||||
Reference in New Issue
Block a user