Fix errors in test mods
This commit is contained in:
parent
bf014b1060
commit
ab4ac4db5a
5 changed files with 25 additions and 32 deletions
|
@ -19,6 +19,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
|
@ -52,23 +53,11 @@ public class FluidPlacementTest
|
|||
|
||||
public static final boolean ENABLE = true;
|
||||
|
||||
@SidedProxy
|
||||
public static CommonProxy proxy;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
if (!ENABLE || !ModelFluidDebug.ENABLE)
|
||||
return;
|
||||
proxy.preInit();
|
||||
}
|
||||
|
||||
|
||||
@Mod.EventBusSubscriber(modid = MODID)
|
||||
public static class Registration
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void registrBlocks(RegistryEvent.Register<Block> event)
|
||||
public static void registerBlocks(RegistryEvent.Register<Block> event)
|
||||
{
|
||||
if (!ENABLE || !ModelFluidDebug.ENABLE)
|
||||
return;
|
||||
|
@ -76,8 +65,9 @@ public class FluidPlacementTest
|
|||
FiniteFluidBlock.instance
|
||||
);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registrItems(RegistryEvent.Register<Item> event)
|
||||
public static void registerItems(RegistryEvent.Register<Item> event)
|
||||
{
|
||||
if (!ENABLE || !ModelFluidDebug.ENABLE)
|
||||
return;
|
||||
|
@ -90,20 +80,14 @@ public class FluidPlacementTest
|
|||
);
|
||||
MinecraftForge.EVENT_BUS.register(FluidContainer.instance);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CommonProxy {
|
||||
public void preInit(){}
|
||||
}
|
||||
public static class ServerProxy extends CommonProxy{}
|
||||
|
||||
public static class ClientProxy extends CommonProxy
|
||||
{
|
||||
private static ModelResourceLocation fluidLocation = new ModelResourceLocation(MODID.toLowerCase() + ":" + FiniteFluidBlock.name, "normal");
|
||||
|
||||
@Override
|
||||
public void preInit()
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent event)
|
||||
{
|
||||
if (!ENABLE || !ModelFluidDebug.ENABLE)
|
||||
return;
|
||||
ModelResourceLocation fluidLocation = new ModelResourceLocation(MODID.toLowerCase() + ":" + FiniteFluidBlock.name, "normal");
|
||||
|
||||
Item fluid = Item.getItemFromBlock(FiniteFluidBlock.instance);
|
||||
ModelLoader.setCustomModelResourceLocation(EmptyFluidContainer.instance, 0, new ModelResourceLocation("forge:bucket", "inventory"));
|
||||
ModelLoader.setBucketModelDefinition(FluidContainer.instance);
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -34,6 +35,8 @@ public class FogColorInsideMaterialTest
|
|||
@ObjectHolder ("test_fluid")
|
||||
public static final Item FLUID_ITEM = null;
|
||||
|
||||
private static final ResourceLocation testFluidRegistryName = new ResourceLocation(MOD_ID, "test_fluid");
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerBlocks(RegistryEvent.Register<Block> event)
|
||||
{
|
||||
|
@ -46,21 +49,21 @@ public class FogColorInsideMaterialTest
|
|||
}
|
||||
};
|
||||
fluid.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
|
||||
fluid.setUnlocalizedName(MOD_ID + ":" + "test_fluid");
|
||||
fluid.setRegistryName("test_fluid");
|
||||
fluid.setUnlocalizedName(testFluidRegistryName.toString());
|
||||
fluid.setRegistryName(testFluidRegistryName);
|
||||
event.getRegistry().register(fluid);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItems(RegistryEvent.Register<Item> event)
|
||||
{
|
||||
event.getRegistry().register(new ItemBlock(FLUID_BLOCK).setRegistryName(FLUID_BLOCK.getRegistryName()));
|
||||
event.getRegistry().register(new ItemBlock(FLUID_BLOCK).setRegistryName(testFluidRegistryName));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent event)
|
||||
{
|
||||
ModelResourceLocation fluidLocation = new ModelResourceLocation(MOD_ID.toLowerCase() + ":test_fluid", "fluid");
|
||||
ModelResourceLocation fluidLocation = new ModelResourceLocation(testFluidRegistryName, "fluid");
|
||||
ModelLoader.registerItemVariants(FLUID_ITEM);
|
||||
ModelLoader.setCustomMeshDefinition(FLUID_ITEM, stack -> fluidLocation);
|
||||
ModelLoader.setCustomStateMapper(FLUID_BLOCK, new StateMapperBase()
|
||||
|
|
|
@ -20,7 +20,7 @@ public class ItemCanDestroyBlocksInCreativeTest
|
|||
public static class Registration
|
||||
{
|
||||
@SubscribeEvent
|
||||
public static void registrItems(RegistryEvent.Register<Item> event)
|
||||
public static void registerItems(RegistryEvent.Register<Item> event)
|
||||
{
|
||||
if (!ENABLE)
|
||||
return;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"fluid": [
|
||||
{
|
||||
"custom": {
|
||||
"fluid": "test_fluid"
|
||||
"fluid": "water"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "items/beef_cooked"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue