mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 03:49:14 +00:00
Fix up test mods (#4399)
This commit is contained in:
1 parent
0ad4218bc2
commit
9717882563
9 files changed
+49
-27
No files matched your search
@@ -16,7 +16,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
@Mod.EventBusSubscriber
|
||||
public class BigNetworkMessageTest
|
||||
{
|
||||
static final boolean ENABLED = true;
|
||||
static final boolean ENABLED = false;
|
||||
static final String MOD_ID = "big_packet_test";
|
||||
public static final SimpleNetworkWrapper INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);
|
||||
|
||||
|
||||
@@ -11,11 +11,15 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
public class BreedingTest
|
||||
{
|
||||
public static final String MODID = "breedingtest";
|
||||
static final boolean ENABLED = false;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
if (ENABLED)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -10,11 +10,15 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
@Mod(modid = "clientchateventtest", name = "Client Chat Event Test", version = "0.0.0", clientSideOnly = true)
|
||||
public class ClientChatEventTest
|
||||
{
|
||||
static final boolean ENABLED = false;
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
if (ENABLED)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -13,8 +13,9 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
public class DebugSearchTabs
|
||||
{
|
||||
public static final String MODID = "debugsearchtab";
|
||||
static final boolean ENABLED = false;
|
||||
|
||||
public static final CreativeTabs SEARCH_TAB = new CreativeTabs(1, "searchtab")
|
||||
public static final CreativeTabs SEARCH_TAB = !ENABLED ? null : new CreativeTabs(1, "searchtab")
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getTabIconItem()
|
||||
@@ -23,8 +24,8 @@ public class DebugSearchTabs
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSearchBar() {
|
||||
|
||||
public boolean hasSearchBar()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,15 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
@Mod(modid = "fovmodifiertest", name = "FOV Modifier Test", version = "0.0.0", clientSideOnly = true)
|
||||
public class FOVModifierTest
|
||||
{
|
||||
static final boolean ENABLED = false;
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
if (ENABLED)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -34,6 +34,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
@Mod (modid = "guicontainereventtest", name = "GuiContainer Event Tests!", version = "1.0", acceptableRemoteVersions = "*")
|
||||
public class GuiContainerEventTest
|
||||
{
|
||||
static final boolean ENABLED = false;
|
||||
|
||||
@ObjectHolder("minecraft:stone")
|
||||
public static final Item STONE_ITEM = null;
|
||||
@@ -41,6 +42,8 @@ public class GuiContainerEventTest
|
||||
@SubscribeEvent
|
||||
public static void onForegroundRender(GuiContainerEvent.DrawForeground event)
|
||||
{
|
||||
if (!ENABLED) return;
|
||||
|
||||
for (Slot slot : event.getGuiContainer().inventorySlots.inventorySlots)
|
||||
{
|
||||
if (slot.getStack().getItem() == STONE_ITEM)
|
||||
|
||||
@@ -216,30 +216,34 @@ public class MapDataTest
|
||||
{
|
||||
@Nullable
|
||||
@Override
|
||||
public IMessage onMessage(CustomMapPacket message, MessageContext ctx) {
|
||||
public IMessage onMessage(CustomMapPacket message, MessageContext ctx)
|
||||
{
|
||||
// Like NetHandlerPlayClient.handleMaps but using our custom type
|
||||
Minecraft.getMinecraft().addScheduledTask(() ->
|
||||
{
|
||||
MapItemRenderer mapitemrenderer = Minecraft.getMinecraft().entityRenderer.getMapItemRenderer();
|
||||
MapData mapdata = CustomMap.loadMapData(message.vanillaPacket.getMapId(), Minecraft.getMinecraft().world);
|
||||
Minecraft.getMinecraft().addScheduledTask(new Runnable() {
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
MapItemRenderer mapitemrenderer = Minecraft.getMinecraft().entityRenderer.getMapItemRenderer();
|
||||
MapData mapdata = CustomMap.loadMapData(message.vanillaPacket.getMapId(), Minecraft.getMinecraft().world);
|
||||
|
||||
if (mapdata == null) {
|
||||
String s = CustomMap.PREFIX + "_" + message.vanillaPacket.getMapId();
|
||||
mapdata = new CustomMapData(s);
|
||||
if (mapdata == null) {
|
||||
String s = CustomMap.PREFIX + "_" + message.vanillaPacket.getMapId();
|
||||
mapdata = new CustomMapData(s);
|
||||
|
||||
if (mapitemrenderer.getMapInstanceIfExists(s) != null) {
|
||||
MapData mapdata1 = mapitemrenderer.getData(mapitemrenderer.getMapInstanceIfExists(s));
|
||||
if (mapitemrenderer.getMapInstanceIfExists(s) != null) {
|
||||
MapData mapdata1 = mapitemrenderer.getData(mapitemrenderer.getMapInstanceIfExists(s));
|
||||
|
||||
if (mapdata1 != null) {
|
||||
mapdata = mapdata1;
|
||||
if (mapdata1 != null) {
|
||||
mapdata = mapdata1;
|
||||
}
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().world.setData(s, mapdata);
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().world.setData(s, mapdata);
|
||||
message.vanillaPacket.setMapdataTo(mapdata);
|
||||
mapitemrenderer.updateMapTexture(mapdata);
|
||||
}
|
||||
|
||||
message.vanillaPacket.setMapdataTo(mapdata);
|
||||
mapitemrenderer.updateMapTexture(mapdata);
|
||||
});
|
||||
|
||||
return null;
|
||||
|
||||
@@ -42,6 +42,7 @@ public class TestCapabilityMod
|
||||
@CapabilityInject(IExampleCapability.class)
|
||||
private static final Capability<IExampleCapability> TEST_CAP = null;
|
||||
|
||||
static final boolean ENABLED = false;
|
||||
private static Logger logger;
|
||||
|
||||
@Mod.EventHandler
|
||||
@@ -58,7 +59,7 @@ public class TestCapabilityMod
|
||||
@SubscribeEvent
|
||||
public void onInteract(PlayerInteractEvent.LeftClickBlock event)
|
||||
{
|
||||
if (event.getItemStack().getItem() != Items.STICK)
|
||||
if (!ENABLED || event.getItemStack().getItem() != Items.STICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -82,7 +83,7 @@ public class TestCapabilityMod
|
||||
@SubscribeEvent
|
||||
public void onInteractItem(PlayerInteractEvent.RightClickItem event)
|
||||
{
|
||||
if (!event.getEntityPlayer().isSneaking())
|
||||
if (!ENABLED || !event.getEntityPlayer().isSneaking())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -215,7 +216,7 @@ public class TestCapabilityMod
|
||||
@SubscribeEvent
|
||||
public void tick(TickEvent.WorldTickEvent event)
|
||||
{
|
||||
if (!event.world.isRemote)
|
||||
if (ENABLED && !event.world.isRemote)
|
||||
{
|
||||
List<EntityPlayer> players = event.world.playerEntities;
|
||||
int i = 0;
|
||||
|
||||
@@ -28,6 +28,7 @@ import javax.annotation.Nullable;
|
||||
public class WorldCapabilityRainTimerTest
|
||||
{
|
||||
public static final String MODID = "worldperiodicrainchecktest";
|
||||
static final boolean ENABLED = false;
|
||||
|
||||
@CapabilityInject(IRainTimer.class)
|
||||
public static final Capability<IRainTimer> TIMER_CAP = null;
|
||||
@@ -53,7 +54,7 @@ public class WorldCapabilityRainTimerTest
|
||||
@SubscribeEvent
|
||||
public void onTick(TickEvent.WorldTickEvent event)
|
||||
{
|
||||
if (event.world.isRemote)
|
||||
if (!ENABLED || event.world.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user