mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 11:05:40 +00:00
Make all tests one side only, so we can test vanilla clients in dev env.
This commit is contained in:
1 parent
8f03658f1f
commit
8719fa0263
32 files changed
+263
-221
No files matched your search
@@ -7,7 +7,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod(modid = BreedingTest.MODID, name = "BreedingTest", version = "1.0")
|
||||
@Mod(modid = BreedingTest.MODID, name = "BreedingTest", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class BreedingTest
|
||||
{
|
||||
public static final String MODID = "breedingtest";
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraftforge.common.config.Config.*;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
@Mod(modid = ConfigTest.MODID, name = "ConfigTest", version = "1.0")
|
||||
@Mod(modid = ConfigTest.MODID, name = "ConfigTest", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class ConfigTest
|
||||
{
|
||||
public static final String MODID = "config_test";
|
||||
|
||||
@@ -8,7 +8,7 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod(modid = DecorateEventDebug.MODID, name = DecorateEventDebug.NAME, version = DecorateEventDebug.VERSION)
|
||||
@Mod(modid = DecorateEventDebug.MODID, name = DecorateEventDebug.NAME, version = DecorateEventDebug.VERSION, acceptableRemoteVersions = "*")
|
||||
public class DecorateEventDebug
|
||||
{
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ import net.minecraftforge.items.wrapper.CombinedInvWrapper;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Mod(modid = DynBucketTest.MODID, name = "DynBucketTest", version = "0.1", dependencies = "after:" + ModelFluidDebug.MODID)
|
||||
@Mod(modid = DynBucketTest.MODID, name = "DynBucketTest", version = "0.1", dependencies = "after:" + ModelFluidDebug.MODID, acceptableRemoteVersions = "*")
|
||||
public class DynBucketTest
|
||||
{
|
||||
public static final String MODID = "dynbuckettest";
|
||||
|
||||
@@ -7,43 +7,43 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
@Mod(modid = "enumplanttypetest", name = "EnumPlantTypeTest", version = "1.0")
|
||||
public class EnumPlantTypeTest
|
||||
@Mod(modid = "enumplanttypetest", name = "EnumPlantTypeTest", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class EnumPlantTypeTest
|
||||
{
|
||||
private static Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onInit(FMLInitializationEvent event)
|
||||
{
|
||||
BiomeType biomeType = null;
|
||||
try
|
||||
{
|
||||
biomeType = BiomeType.getType("FAKE");
|
||||
}
|
||||
catch (NullPointerException npe)
|
||||
{
|
||||
LOGGER.warn("EnumHelper in BiomeType is working incorrectly!", npe);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (biomeType == null || !biomeType.name().equals("FAKE"))
|
||||
LOGGER.warn("EnumHelper in BiomeType is working incorrectly!");
|
||||
}
|
||||
EnumPlantType plantType = null;
|
||||
if (plantType == null || !plantType.name().equals("FAKE"))
|
||||
;
|
||||
try
|
||||
{
|
||||
plantType = EnumPlantType.getPlantType("FAKE");
|
||||
}
|
||||
catch (NullPointerException npe)
|
||||
{
|
||||
LOGGER.warn("EnumHelper in EnumPlantType is working incorrectly!", npe);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (plantType == null || !plantType.name().equals("FAKE"))
|
||||
LOGGER.warn("EnumHelper in EnumPlantType is working incorrectly!");
|
||||
}
|
||||
}
|
||||
private static Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onInit(FMLInitializationEvent event)
|
||||
{
|
||||
BiomeType biomeType = null;
|
||||
try
|
||||
{
|
||||
biomeType = BiomeType.getType("FAKE");
|
||||
}
|
||||
catch (NullPointerException npe)
|
||||
{
|
||||
LOGGER.warn("EnumHelper in BiomeType is working incorrectly!", npe);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (biomeType == null || !biomeType.name().equals("FAKE"))
|
||||
LOGGER.warn("EnumHelper in BiomeType is working incorrectly!");
|
||||
}
|
||||
EnumPlantType plantType = null;
|
||||
if (plantType == null || !plantType.name().equals("FAKE"))
|
||||
;
|
||||
try
|
||||
{
|
||||
plantType = EnumPlantType.getPlantType("FAKE");
|
||||
}
|
||||
catch (NullPointerException npe)
|
||||
{
|
||||
LOGGER.warn("EnumHelper in EnumPlantType is working incorrectly!", npe);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (plantType == null || !plantType.name().equals("FAKE"))
|
||||
LOGGER.warn("EnumHelper in EnumPlantType is working incorrectly!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
@Mod(modid = ForgeBlockStatesLoaderDebug.MODID, name = "ForgeBlockStatesLoader", version = "1.0")
|
||||
@Mod(modid = ForgeBlockStatesLoaderDebug.MODID, name = "ForgeBlockStatesLoader", version = "1.0", acceptableRemoteVersions = "*")
|
||||
@Mod.EventBusSubscriber
|
||||
public class ForgeBlockStatesLoaderDebug {
|
||||
public static final String MODID = "forgeblockstatesloader";
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Mod(modid = ItemLayerModelDebug.MODID, name = "ForgeDebugItemLayerModel", version = ItemLayerModelDebug.VERSION)
|
||||
@Mod(modid = ItemLayerModelDebug.MODID, name = "ForgeDebugItemLayerModel", version = ItemLayerModelDebug.VERSION, acceptableRemoteVersions = "*")
|
||||
public class ItemLayerModelDebug
|
||||
{
|
||||
public static final String MODID = "forgedebugitemlayermodel";
|
||||
|
||||
@@ -26,7 +26,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
@Mod(modid = ItemTileDebug.MODID, name = "ForgeDebugItemTile", version = "1.0")
|
||||
@Mod(modid = ItemTileDebug.MODID, name = "ForgeDebugItemTile", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class ItemTileDebug
|
||||
{
|
||||
public static final String MODID = "forgedebugitemtile";
|
||||
|
||||
@@ -17,7 +17,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod(modid = LootTablesDebug.MODID, name = "Loot Table Debug", version = "1.0")
|
||||
@Mod(modid = LootTablesDebug.MODID, name = "Loot Table Debug", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class LootTablesDebug {
|
||||
public static final String MODID = "loot_table_debug";
|
||||
private static final ResourceLocation CUSTOM_LOOT = LootTableList.register(new ResourceLocation(MODID, "custom_loot"));
|
||||
|
||||
@@ -60,7 +60,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Mod(modid = ModelAnimationDebug.MODID, name = "ForgeDebugModelAnimation", version = ModelAnimationDebug.VERSION)
|
||||
@Mod(modid = ModelAnimationDebug.MODID, name = "ForgeDebugModelAnimation", version = ModelAnimationDebug.VERSION, acceptableRemoteVersions = "*")
|
||||
public class ModelAnimationDebug
|
||||
{
|
||||
public static final String MODID = "forgedebugmodelanimation";
|
||||
|
||||
@@ -49,7 +49,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.primitives.Ints;
|
||||
|
||||
@Mod(modid = ModelBakeEventDebug.MODID, name = "ForgeDebugModelBakeEvent", version = ModelBakeEventDebug.VERSION)
|
||||
@Mod(modid = ModelBakeEventDebug.MODID, name = "ForgeDebugModelBakeEvent", version = ModelBakeEventDebug.VERSION, acceptableRemoteVersions = "*")
|
||||
public class ModelBakeEventDebug
|
||||
{
|
||||
public static final String MODID = "forgedebugmodelbakeevent";
|
||||
|
||||
@@ -21,7 +21,7 @@ import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
@Mod(modid = ModelFluidDebug.MODID, name = "ForgeDebugModelFluid", version = ModelFluidDebug.VERSION)
|
||||
@Mod(modid = ModelFluidDebug.MODID, name = "ForgeDebugModelFluid", version = ModelFluidDebug.VERSION, acceptableRemoteVersions = "*")
|
||||
public class ModelFluidDebug
|
||||
{
|
||||
public static final String MODID = "forgedebugmodelfluid";
|
||||
|
||||
@@ -57,7 +57,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
@Mod(modid = ModelLoaderRegistryDebug.MODID, name = "ForgeDebugModelLoaderRegistry", version = ModelLoaderRegistryDebug.VERSION)
|
||||
@Mod(modid = ModelLoaderRegistryDebug.MODID, name = "ForgeDebugModelLoaderRegistry", version = ModelLoaderRegistryDebug.VERSION, acceptableRemoteVersions = "*")
|
||||
public class ModelLoaderRegistryDebug
|
||||
{
|
||||
public static final String MODID = "forgedebugmodelloaderregistry";
|
||||
|
||||
@@ -16,7 +16,7 @@ import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
@Mod(modid = MultiLayerModelDebug.MODID, name = "ForgeDebugMultiLayerModel", version = MultiLayerModelDebug.VERSION)
|
||||
@Mod(modid = MultiLayerModelDebug.MODID, name = "ForgeDebugMultiLayerModel", version = MultiLayerModelDebug.VERSION, acceptableRemoteVersions = "*")
|
||||
public class MultiLayerModelDebug
|
||||
{
|
||||
public static final String MODID = "forgedebugmultilayermodel";
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
|
||||
@Mod( modid = NoPotionEffectRenderTest.modID, name = "No Potion Effect Render Test", version = "0.0.0" )
|
||||
@Mod( modid = NoPotionEffectRenderTest.modID, name = "No Potion Effect Render Test", version = "0.0.0", acceptableRemoteVersions = "*" )
|
||||
public class NoPotionEffectRenderTest {
|
||||
public static final String modID = "nopotioneffect";
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.minecraftforge.fml.common.registry.IForgeRegistry;
|
||||
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
|
||||
import net.minecraftforge.fml.common.registry.RegistryBuilder;
|
||||
|
||||
@Mod(modid= ObjectHolderTest.MODID, name = "ObjectHolderTests", version = "1.0")
|
||||
@Mod(modid= ObjectHolderTest.MODID, name = "ObjectHolderTests", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class ObjectHolderTest
|
||||
{
|
||||
public static final String MODID = "objectholdertest";
|
||||
|
||||
@@ -19,7 +19,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
|
||||
@Mod(modid = PotionRegistryDebug.MODID, name = "ForgePotionRegistry", version = "1.0")
|
||||
@Mod(modid = PotionRegistryDebug.MODID, name = "ForgePotionRegistry", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class PotionRegistryDebug {
|
||||
public static final String MODID = "forgepotionregistry";
|
||||
|
||||
|
||||
@@ -19,64 +19,64 @@ import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
@Mod(modid = TextureDump.MODID, name = "Forge Texture Atlas Dump", version = TextureDump.VERSION, clientSideOnly = true)
|
||||
@Mod(modid = TextureDump.MODID, name = "Forge Texture Atlas Dump", version = TextureDump.VERSION, clientSideOnly = true, acceptableRemoteVersions = "*")
|
||||
public class TextureDump
|
||||
{
|
||||
public static final String MODID = "forge_texture_dump";
|
||||
public static final String VERSION = "1.0";
|
||||
public static final String MODID = "forge_texture_dump";
|
||||
public static final String VERSION = "1.0";
|
||||
|
||||
public static final boolean ENABLE = true;
|
||||
public static final boolean ENABLE = true;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
if (ENABLE)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
}
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
if (ENABLE)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void postTextureStitch(TextureStitchEvent.Post e) throws Exception
|
||||
{
|
||||
TextureMap map = e.getMap();
|
||||
String name = map.getBasePath().replace('/', '_');
|
||||
int mip = map.getMipmapLevels();
|
||||
saveGlTexture(name, map.getGlTextureId(), mip);
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void postTextureStitch(TextureStitchEvent.Post e) throws Exception
|
||||
{
|
||||
TextureMap map = e.getMap();
|
||||
String name = map.getBasePath().replace('/', '_');
|
||||
int mip = map.getMipmapLevels();
|
||||
saveGlTexture(name, map.getGlTextureId(), mip);
|
||||
}
|
||||
|
||||
public static void saveGlTexture(String name, int textureId, int mipmapLevels)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
|
||||
public static void saveGlTexture(String name, int textureId, int mipmapLevels)
|
||||
{
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
|
||||
|
||||
GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
|
||||
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
|
||||
GL11.glPixelStorei(GL11.GL_PACK_ALIGNMENT, 1);
|
||||
GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
for (int level = 0; level <= mipmapLevels; level++)
|
||||
{
|
||||
int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_WIDTH);
|
||||
int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_HEIGHT);
|
||||
int size = width * height;
|
||||
for (int level = 0; level <= mipmapLevels; level++)
|
||||
{
|
||||
int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_WIDTH);
|
||||
int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, level, GL11.GL_TEXTURE_HEIGHT);
|
||||
int size = width * height;
|
||||
|
||||
BufferedImage bufferedimage = new BufferedImage(width, height, 2);
|
||||
File output = new File("texture_atlas_dump_" + name + "_mipmap_" + level + ".png");
|
||||
BufferedImage bufferedimage = new BufferedImage(width, height, 2);
|
||||
File output = new File("texture_atlas_dump_" + name + "_mipmap_" + level + ".png");
|
||||
|
||||
IntBuffer buffer = BufferUtils.createIntBuffer(size);
|
||||
int[] data = new int[size];
|
||||
IntBuffer buffer = BufferUtils.createIntBuffer(size);
|
||||
int[] data = new int[size];
|
||||
|
||||
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, level, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
|
||||
buffer.get(data);
|
||||
bufferedimage.setRGB(0, 0, width, height, data, 0, width);
|
||||
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, level, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
|
||||
buffer.get(data);
|
||||
bufferedimage.setRGB(0, 0, width, height, data, 0, width);
|
||||
|
||||
try
|
||||
{
|
||||
ImageIO.write(bufferedimage, "png", output);
|
||||
FMLLog.info("[TextureDump] Exported png to: %s", output.getAbsolutePath());
|
||||
}
|
||||
catch (IOException ioexception)
|
||||
{
|
||||
FMLLog.info("[TextureDump] Unable to write: ", ioexception);
|
||||
}
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
ImageIO.write(bufferedimage, "png", output);
|
||||
FMLLog.info("[TextureDump] Exported png to: %s", output.getAbsolutePath());
|
||||
}
|
||||
catch (IOException ioexception)
|
||||
{
|
||||
FMLLog.info("[TextureDump] Unable to write: ", ioexception);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package net.minecraftforge.fml.test;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
|
||||
import net.minecraftforge.fml.common.network.FMLEventChannel;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
@Mod(modid = ForgeNetworkTestMod.MOD_ID, name = ForgeNetworkTestMod.MOD_ID, acceptableRemoteVersions = "*")
|
||||
public class ForgeNetworkTestMod
|
||||
{
|
||||
public static final String MOD_ID = "forgenetworktest";
|
||||
private FMLEventChannel channel;
|
||||
|
||||
@EventHandler
|
||||
public void onPreInit(FMLPreInitializationEvent e)
|
||||
{
|
||||
if (e.getSide() == Side.SERVER)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
channel = NetworkRegistry.INSTANCE.newEventDrivenChannel(MOD_ID);
|
||||
channel.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerLogin(PlayerLoggedInEvent e)
|
||||
{
|
||||
if (channel == null)
|
||||
return;
|
||||
PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());
|
||||
buffer.writeByte(0);
|
||||
channel.sendTo(new FMLProxyPacket(buffer, MOD_ID), (EntityPlayerMP)e.player); // disconnects vanilla clients in 1.11
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
|
||||
@Mod(modid="brewingreciperegistrytest", name="BrewingRecipeRegistryTest", version="0.0.0")
|
||||
@Mod(modid="brewingreciperegistrytest", name="BrewingRecipeRegistryTest", version="0.0.0", acceptableRemoteVersions = "*")
|
||||
public class BrewingRecipeRegistryTest
|
||||
{
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.server.command.CommandTreeBase;
|
||||
|
||||
@Mod(modid = CommandTreeBaseTest.MOD_ID, name = "CommandTreeBaseTest", version = "1.0.0")
|
||||
@Mod(modid = CommandTreeBaseTest.MOD_ID, name = "CommandTreeBaseTest", version = "1.0.0", acceptableRemoteVersions = "*")
|
||||
public class CommandTreeBaseTest
|
||||
{
|
||||
public static final String MOD_ID = "CommandTreeBaseTest";
|
||||
public static final String MOD_ID = "command_tree_base_test";
|
||||
|
||||
@Mod.Instance(CommandTreeBaseTest.MOD_ID)
|
||||
public static CommandTreeBaseTest inst;
|
||||
|
||||
@@ -8,7 +8,7 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod(modid = "createfluidsourcetest", name = "CreateFluidSourceTest", version = "1.0")
|
||||
@Mod(modid = "createfluidsourcetest", name = "CreateFluidSourceTest", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class CreateFluidSourceTest
|
||||
{
|
||||
public static final boolean ENABLE = false;
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod(modid="entitytraveltodimensioneventtest", name="EntityTravelToDimensionEventTest", version="0.0.0")
|
||||
@Mod(modid="entitytraveltodimensioneventtest", name="EntityTravelToDimensionEventTest", version="0.0.0", acceptableRemoteVersions = "*")
|
||||
public class EntityTravelToDimensionEventTest
|
||||
{
|
||||
public static final boolean ENABLE = false;
|
||||
|
||||
@@ -20,112 +20,112 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@Mod(modid="fluidhandlertest", name="FluidHandlerTest", version="0.0.0")
|
||||
@Mod(modid="fluidhandlertest", name="FluidHandlerTest", version="0.0.0", acceptableRemoteVersions = "*")
|
||||
public class FluidHandlerTest
|
||||
{
|
||||
public static final boolean ENABLE = true;
|
||||
public static final boolean ENABLE = true;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void loadComplete(FMLLoadCompleteEvent event)
|
||||
{
|
||||
if (!ENABLE || FMLCommonHandler.instance().getSide() != Side.CLIENT)
|
||||
return;
|
||||
@Mod.EventHandler
|
||||
public void loadComplete(FMLLoadCompleteEvent event)
|
||||
{
|
||||
if (!ENABLE || FMLCommonHandler.instance().getSide() != Side.CLIENT)
|
||||
return;
|
||||
|
||||
for (ItemStack stack : getAllItems())
|
||||
{
|
||||
testFluidContainer(stack);
|
||||
}
|
||||
}
|
||||
for (ItemStack stack : getAllItems())
|
||||
{
|
||||
testFluidContainer(stack);
|
||||
}
|
||||
}
|
||||
|
||||
private static void testFluidContainer(ItemStack stack)
|
||||
{
|
||||
ItemStack originalStack = stack.copy();
|
||||
private static void testFluidContainer(ItemStack stack)
|
||||
{
|
||||
ItemStack originalStack = stack.copy();
|
||||
|
||||
ItemStack preDrainStack = stack.copy();
|
||||
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(preDrainStack);
|
||||
if (fluidHandler != null)
|
||||
{
|
||||
FluidStack drain = fluidHandler.drain(Integer.MAX_VALUE, true);
|
||||
ItemStack drainedStack = fluidHandler.getContainer();
|
||||
FMLLog.info("Draining " + stackString(stack) + " gives " + fluidString(drain) + " and " + stackString(drainedStack));
|
||||
ItemStack preDrainStack = stack.copy();
|
||||
IFluidHandlerItem fluidHandler = FluidUtil.getFluidHandler(preDrainStack);
|
||||
if (fluidHandler != null)
|
||||
{
|
||||
FluidStack drain = fluidHandler.drain(Integer.MAX_VALUE, true);
|
||||
ItemStack drainedStack = fluidHandler.getContainer();
|
||||
FMLLog.info("Draining " + stackString(stack) + " gives " + fluidString(drain) + " and " + stackString(drainedStack));
|
||||
|
||||
if (drain == null && !ItemStack.areItemStacksEqual(originalStack, preDrainStack))
|
||||
{
|
||||
throw new RuntimeException("ItemStack was altered by its fluid handler when drain did nothing.");
|
||||
}
|
||||
if (drain == null && !ItemStack.areItemStacksEqual(originalStack, preDrainStack))
|
||||
{
|
||||
throw new RuntimeException("ItemStack was altered by its fluid handler when drain did nothing.");
|
||||
}
|
||||
|
||||
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values())
|
||||
{
|
||||
ItemStack preFillStack = stack.copy();
|
||||
fluidHandler = FluidUtil.getFluidHandler(preFillStack);
|
||||
if (fluidHandler != null)
|
||||
{
|
||||
int filled = fluidHandler.fill(new FluidStack(fluid, Integer.MAX_VALUE), true);
|
||||
ItemStack filledStack = fluidHandler.getContainer();
|
||||
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values())
|
||||
{
|
||||
ItemStack preFillStack = stack.copy();
|
||||
fluidHandler = FluidUtil.getFluidHandler(preFillStack);
|
||||
if (fluidHandler != null)
|
||||
{
|
||||
int filled = fluidHandler.fill(new FluidStack(fluid, Integer.MAX_VALUE), true);
|
||||
ItemStack filledStack = fluidHandler.getContainer();
|
||||
|
||||
if (filled > 0)
|
||||
{
|
||||
FMLLog.info("Filling " + stackString(stack) + " with " + fluidString(new FluidStack(fluid, filled)) + " gives " + stackString(filledStack));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ItemStack.areItemStacksEqual(originalStack, preFillStack))
|
||||
{
|
||||
throw new RuntimeException("ItemStack was altered by its fluid handler when fill did nothing.");
|
||||
}
|
||||
if (!ItemStack.areItemStacksEqual(preFillStack, filledStack))
|
||||
{
|
||||
throw new RuntimeException("ItemStack was altered by its fluid handler when fill did nothing.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (filled > 0)
|
||||
{
|
||||
FMLLog.info("Filling " + stackString(stack) + " with " + fluidString(new FluidStack(fluid, filled)) + " gives " + stackString(filledStack));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ItemStack.areItemStacksEqual(originalStack, preFillStack))
|
||||
{
|
||||
throw new RuntimeException("ItemStack was altered by its fluid handler when fill did nothing.");
|
||||
}
|
||||
if (!ItemStack.areItemStacksEqual(preFillStack, filledStack))
|
||||
{
|
||||
throw new RuntimeException("ItemStack was altered by its fluid handler when fill did nothing.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String fluidString(FluidStack stack)
|
||||
{
|
||||
if (stack == null)
|
||||
{
|
||||
return "no fluid";
|
||||
}
|
||||
else
|
||||
{
|
||||
return stack.amount + "mB " + stack.getLocalizedName();
|
||||
}
|
||||
}
|
||||
private static String fluidString(FluidStack stack)
|
||||
{
|
||||
if (stack == null)
|
||||
{
|
||||
return "no fluid";
|
||||
}
|
||||
else
|
||||
{
|
||||
return stack.amount + "mB " + stack.getLocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
private static String stackString(@Nonnull ItemStack stack)
|
||||
{
|
||||
if (stack.func_190926_b())
|
||||
{
|
||||
return "no item";
|
||||
}
|
||||
else
|
||||
{
|
||||
String resourceDomain;
|
||||
if (stack.getItem().getRegistryName() == null)
|
||||
{
|
||||
resourceDomain = "unknown";
|
||||
}
|
||||
else
|
||||
{
|
||||
resourceDomain = stack.getItem().getRegistryName().getResourceDomain();
|
||||
}
|
||||
return stack.func_190916_E() + " " + stack.getDisplayName() + " (" + resourceDomain + ")";
|
||||
}
|
||||
}
|
||||
private static String stackString(@Nonnull ItemStack stack)
|
||||
{
|
||||
if (stack.func_190926_b())
|
||||
{
|
||||
return "no item";
|
||||
}
|
||||
else
|
||||
{
|
||||
String resourceDomain;
|
||||
if (stack.getItem().getRegistryName() == null)
|
||||
{
|
||||
resourceDomain = "unknown";
|
||||
}
|
||||
else
|
||||
{
|
||||
resourceDomain = stack.getItem().getRegistryName().getResourceDomain();
|
||||
}
|
||||
return stack.func_190916_E() + " " + stack.getDisplayName() + " (" + resourceDomain + ")";
|
||||
}
|
||||
}
|
||||
|
||||
private static List<ItemStack> getAllItems()
|
||||
{
|
||||
NonNullList<ItemStack> list = NonNullList.func_191196_a();
|
||||
for (Item item : ForgeRegistries.ITEMS.getValues())
|
||||
{
|
||||
for (CreativeTabs tab : item.getCreativeTabs())
|
||||
{
|
||||
item.getSubItems(item, tab, list);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
private static List<ItemStack> getAllItems()
|
||||
{
|
||||
NonNullList<ItemStack> list = NonNullList.func_191196_a();
|
||||
for (Item item : ForgeRegistries.ITEMS.getValues())
|
||||
{
|
||||
for (CreativeTabs tab : item.getCreativeTabs())
|
||||
{
|
||||
item.getSubItems(item, tab, list);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -7,20 +7,20 @@ import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod(modid="neighbornotifyeventtest", name="NeighborNotifyEventTest", version="0.0.0")
|
||||
public class NeighborNotifyEventTest
|
||||
@Mod(modid="neighbornotifyeventtest", name="NeighborNotifyEventTest", version="0.0.0", acceptableRemoteVersions = "*")
|
||||
public class NeighborNotifyEventTest
|
||||
{
|
||||
|
||||
public static final boolean ENABLE = false;
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onNeighborNotify(NeighborNotifyEvent event)
|
||||
public void onNeighborNotify(NeighborNotifyEvent event)
|
||||
{
|
||||
if(ENABLE) {
|
||||
System.out.println(event.getPos().toString() + " with face information: " + event.getNotifiedSides());
|
||||
|
||||
@@ -35,7 +35,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Mod(modid = NoBedSleepingTest.MODID, name = "ForgeDebugNoBedSleeping", version = NoBedSleepingTest.VERSION)
|
||||
@Mod(modid = NoBedSleepingTest.MODID, name = "ForgeDebugNoBedSleeping", version = NoBedSleepingTest.VERSION, acceptableRemoteVersions = "*")
|
||||
public class NoBedSleepingTest
|
||||
{
|
||||
public static final String MODID = "forgedebugnobedsleeping";
|
||||
|
||||
@@ -21,7 +21,7 @@ import net.minecraftforge.server.permission.PermissionAPI;
|
||||
import net.minecraftforge.server.permission.context.BlockPosContext;
|
||||
import net.minecraftforge.server.permission.context.ContextKey;
|
||||
|
||||
@Mod(modid = PermissionTest.MOD_ID, name = "PermissionTest", version = "1.0.0")
|
||||
@Mod(modid = PermissionTest.MOD_ID, name = "PermissionTest", version = "1.0.0", acceptableRemoteVersions = "*")
|
||||
public class PermissionTest
|
||||
{
|
||||
public static final String MOD_ID = "permission_test";
|
||||
|
||||
@@ -19,7 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod(modid="playerinteracteventtest", name="PlayerInteractEventTest", version="0.0.0")
|
||||
@Mod(modid="playerinteracteventtest", name="PlayerInteractEventTest", version="0.0.0", acceptableRemoteVersions = "*")
|
||||
public class PlayerInteractEventTest
|
||||
{
|
||||
// NOTE: Test with both this ON and OFF - ensure none of the test behaviours show when this is off!
|
||||
|
||||
@@ -7,17 +7,17 @@ import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
@Mod(modid="playersetspawntest", name="Player Set Spawn Test", version="0.0.0")
|
||||
@Mod(modid="playersetspawntest", name="Player Set Spawn Test", version="0.0.0", acceptableRemoteVersions = "*")
|
||||
public class PlayerSetSpawnTest {
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerSetSpawn(PlayerSetSpawnEvent event)
|
||||
public void onPlayerSetSpawn(PlayerSetSpawnEvent event)
|
||||
{
|
||||
System.out.println(event.isForced() + " " + event.getNewSpawn().toString());
|
||||
event.setCanceled(true);
|
||||
|
||||
@@ -23,7 +23,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Mod(modid = "forge.testcapmod", name = "Forge TestCapMod", version = "1.0")
|
||||
@Mod(modid = "forge.testcapmod", name = "Forge TestCapMod", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class TestCapabilityMod
|
||||
{
|
||||
// A Holder/Marker for if this capability is installed.
|
||||
|
||||
@@ -17,7 +17,7 @@ import net.minecraftforge.fml.common.Mod.Instance;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
|
||||
@Mod(modid = "wrnormal", name = "WRNormal", version = "1.0")
|
||||
@Mod(modid = "wrnormal", name = "WRNormal", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class WRNormalMod
|
||||
{
|
||||
@Instance("wrnormal")
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/** Simple mod to test world capability, by adding timer logic and check for raining time. */
|
||||
@Mod(modid=WorldCapabilityRainTimerTest.MODID, name="World Periodic Rain Check Test", version="0.0.0")
|
||||
@Mod(modid=WorldCapabilityRainTimerTest.MODID, name="World Periodic Rain Check Test", version="0.0.0", acceptableRemoteVersions = "*")
|
||||
public class WorldCapabilityRainTimerTest {
|
||||
public static final String MODID = "worldperiodicrainchecktest";
|
||||
|
||||
@@ -166,4 +166,4 @@ public class WorldCapabilityRainTimerTest {
|
||||
TIMER_CAP.readNBT(this.timer, null, nbt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user