Fix objloader registering at wrong time. Closes #5847. Added test

class as suggested in the issue.

Note: most tests are commented out at the present time, pending
rework. Tests that work, work.

Signed-off-by: cpw <[email protected]>
This commit is contained in:
cpw committed 2019-07-20 21:04:00 -04:00
1 parent fcd9582133
commit c90b1732e9
136 files changed
+636 -848

No files matched your search

@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client;
@@ -40,9 +41,11 @@ import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.function.Function;
*/
/**
* Test for {@link TextureStitchEvent.Pre}.
*/
*//*
//@Mod(modid = CustomTextureAtlasSpriteTest.MOD_ID, name = CustomTextureAtlasSpriteTest.NAME, version = "1.0", clientSideOnly = true)
public class CustomTextureAtlasSpriteTest
{
@@ -124,3 +127,4 @@ public class CustomTextureAtlasSpriteTest
}
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client;
@@ -27,9 +28,11 @@ import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.event.FMLInitializationEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
*/
/**
* Simple mod to test fov modifier.
*/
*//*
//@Mod(modid = "fovmodifiertest", name = "FOV Modifier Test", version = "0.0.0", clientSideOnly = true)
public class FOVModifierEventTest
{
@@ -53,3 +56,4 @@ public class FOVModifierEventTest
}
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client;
@@ -60,3 +61,4 @@ public class SearchableCreativeTabTest
}
};
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.gui;
@@ -58,3 +59,4 @@ public class ContainerDrawForegroundEventTest
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.gui;
@@ -53,4 +54,4 @@ public class TooltipColorEventTest
event.setBorderEnd(0xF03f0f0f);
}
}
}
}*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.model;
@@ -178,7 +179,8 @@ public class AnimatedModelTest
return state.withProperty(Properties.StaticProperty, true);
}
/*@Override
*/
/*@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
TileEntity te = world.getTileEntity(pos);
if(te instanceof Chest && state instanceof IExtendedBlockState)
@@ -186,7 +188,8 @@ public class AnimatedModelTest
return ((Chest)te).getState((IExtendedBlockState)state);
}
return super.getExtendedState(state, world, pos);
}*/
}*//*
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
@@ -315,7 +318,8 @@ public class AnimatedModelTest
@SuppressWarnings("deprecation")
public Render<EntityChest> createRenderFor(RenderManager manager)
{
/*model = ModelLoaderRegistry.getModel(new ResourceLocation(ModelLoaderRegistryTest.MODID, "block/chest.b3d"));
*/
/*model = ModelLoaderRegistry.getModel(new ResourceLocation(ModelLoaderRegistryTest.MODID, "block/chest.b3d"));
if(model instanceof IRetexturableModel)
{
model = ((IRetexturableModel)model).retexture(ImmutableMap.of("#chest", "entity/chest/normal"));
@@ -323,7 +327,8 @@ public class AnimatedModelTest
if(model instanceof IModelCustomData)
{
model = ((IModelCustomData)model).process(ImmutableMap.of("mesh", "[\"Base\", \"Lid\"]"));
}*/
}*//*
ResourceLocation location = new ModelResourceLocation(new ResourceLocation(MODID, blockName), "entity");
return new RenderLiving<EntityChest>(manager, new net.minecraftforge.client.model.animation.AnimationModelBase<EntityChest>(location, new VertexLighterSmoothAo(Minecraft.getMinecraft().getBlockColors()))
{
@@ -420,9 +425,11 @@ public class AnimatedModelTest
public Chest()
{
/*asm = proxy.load(new ResourceLocation(MODID.toLowerCase(), "asms/block/chest.json"), ImmutableMap.<String, ITimeValue>of(
*/
/*asm = proxy.load(new ResourceLocation(MODID.toLowerCase(), "asms/block/chest.json"), ImmutableMap.<String, ITimeValue>of(
"click_time", clickTime
));*/
));*//*
asm = proxy.load(new ResourceLocation(MODID.toLowerCase(), "asms/block/engine.json"), ImmutableMap.<String, ITimeValue>of(
"cycle_length", cycleLength,
"click_time", clickTime
@@ -444,9 +451,11 @@ public class AnimatedModelTest
return true;
}
/*public IExtendedBlockState getState(IExtendedBlockState state) {
*/
/*public IExtendedBlockState getState(IExtendedBlockState state) {
return state.withProperty(B3DFrameProperty.instance, curState);
}*/
}*//*
public void click(boolean sneaking)
{
@@ -456,7 +465,8 @@ public class AnimatedModelTest
{
cycleLength.setValue(6 - cycleLength.apply(0));
}
/*else if(asm.currentState().equals("closed"))
*/
/*else if(asm.currentState().equals("closed"))
{
clickTime.setValue(Animation.getWorldTime(getWorld()));
asm.transition("opening");
@@ -465,7 +475,8 @@ public class AnimatedModelTest
{
clickTime.setValue(Animation.getWorldTime(getWorld()));
asm.transition("closing");
}*/
}*//*
else if (asm.currentState().equals("default"))
{
float time = Animation.getWorldTime(getWorld(), Animation.getPartialTickTime());
@@ -563,3 +574,4 @@ public class AnimatedModelTest
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.model;
@@ -116,7 +117,8 @@ public class ForgeBlockStatesLoaderTest
// this block is never actually used, it's only needed for the error message on load to see the variant it maps to
// disabling until we can make it a proper test
/*public static class CustomMappedBlock extends Block
*/
/*public static class CustomMappedBlock extends Block
{
public static final PropertyEnum<CustomVariant> VARIANT = PropertyEnum.create("type", CustomVariant.class);
@@ -152,5 +154,7 @@ public class ForgeBlockStatesLoaderTest
public String getName() { return this.toString(); };
}
}*/
}*//*
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.model;
@@ -118,3 +119,4 @@ public class ItemLayerModelTest
}
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.model;
@@ -80,3 +81,4 @@ public class ItemModelConflictTest
}
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.model;
@@ -97,3 +98,4 @@ public class ItemModelGenerationTest
}
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.model;
@@ -388,3 +389,4 @@ public class ModelBakeEventTest
throw new IllegalArgumentException("Unknown Side " + side);
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.model;
@@ -187,3 +188,4 @@ public class ModelDataTest
event.getRegistry().register(TileEntityType.Builder.func_223042_a(Tile::new, MY_BLOCK).build(null).setRegistryName(MODID, BLOCK_NAME));
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.model;
@@ -217,3 +218,4 @@ public class ModelFluidTest
}
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.model;
@@ -228,6 +229,7 @@ public class ModelLoaderRegistryTest
return this.getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite());
}
*/
/* @Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos)
{
@@ -235,7 +237,8 @@ public class ModelLoaderRegistryTest
B3DLoader.B3DState newState = new B3DLoader.B3DState(null, counter);
return ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, newState);
}
*/
*//*
@Override
public boolean onBlockActivated(IBlockState state, World world, BlockPos pos, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
@@ -263,7 +266,8 @@ public class ModelLoaderRegistryTest
}
}
/**
*/
/**
* This block is intended to demonstrate how to change the visibility of a group(s)
* from within the block's class.
* By right clicking on this block the player increments an integer value in the tile entity
@@ -273,7 +277,8 @@ public class ModelLoaderRegistryTest
* Holding shift decrements the value in the tile entity.
* @author shadekiller666
*
*/
*//*
public static class OBJTesseractBlock extends Block
{
public static final String name = "obj_tesseract_block";
@@ -342,6 +347,7 @@ public class ModelLoaderRegistryTest
return true;
}
*/
/* @Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos)
{
@@ -351,7 +357,8 @@ public class ModelLoaderRegistryTest
return ((IExtendedBlockState) state).withProperty(Properties.AnimationProperty, te.state);
}
return state;
}*/
}*//*
}
public static class OBJTesseractTileEntity extends TileEntity
@@ -427,7 +434,8 @@ public class ModelLoaderRegistryTest
}
}
/**
*/
/**
* This block demonstrates how to utilize the vertex coloring feature
* of the OBJ loader. See 'vertex_coloring.obj' and 'vertex_coloring.mtl' in
* 'test/resources/assets/forgedebugmodelloaderregistry/models/block/', to properly
@@ -436,7 +444,8 @@ public class ModelLoaderRegistryTest
* color instead of each vertex.
* @author shadekiller666
*
*/
*//*
public static class OBJVertexColoring1 extends Block
{
public static final String name = "obj_vertex_coloring1";
@@ -466,14 +475,16 @@ public class ModelLoaderRegistryTest
}
}
/**
*/
/**
* This block demonstrates how to use IProperties and IUnlistedProperties together
* in the same ExtendedBlockState. Similar to pistons, this block will face the player
* when placed. Unlike pistons, however; this block's model is an eyeball, because
* the OBJ loader can load spheres.
* @author shadekiller666
*
*/
*//*
public static class OBJDirectionEye extends Block
{
public static final DirectionProperty FACING = BlockStateProperties.FACING;
@@ -517,13 +528,15 @@ public class ModelLoaderRegistryTest
}
}
/**
*/
/**
* This block uses the same model as CustomModelBlock3 does, but
* this class allows the player to cycle the colors of each vertex to black
* and then back to the original color when right clicking on the block.
* @author shadekiller666
*
*/
*//*
public static class OBJVertexColoring2 extends Block
{
public static final String name = "obj_vertex_coloring2";
@@ -576,7 +589,8 @@ public class ModelLoaderRegistryTest
if (this.world.isRemote)
{
logger.info(shouldIncrement);
/*
*/
/*
IBakedModel bakedModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelFromBlockState(this.world.getBlockState(this.pos), this.world, this.pos);
if (bakedModel != null && bakedModel instanceof OBJBakedModel)
{
@@ -621,16 +635,19 @@ public class ModelLoaderRegistryTest
}
}
this.world.markBlockRangeForRenderUpdate(this.pos, this.pos);
}*/
}*//*
}
}
}
/**
*/
/**
* This block is a debug block that faces the player when placed, like a piston.
* @author shadekiller666
*
*/
*//*
public static class OBJDirectionBlock extends Block
{
public static final DirectionProperty FACING = BlockStateProperties.FACING;
@@ -674,12 +691,14 @@ public class ModelLoaderRegistryTest
}
}
/**
*/
/**
* This block is a testing block that will be used to test the use
* of "custom" data defined in a forge blockstate json. WIP, ignore for now.
* @author shadekiller666
*
*/
*//*
public static class OBJCustomDataBlock extends Block
{
public static final BooleanProperty NORTH = BooleanProperty.create("north");
@@ -726,12 +745,14 @@ public class ModelLoaderRegistryTest
}
}
/**
*/
/**
* This block uses the same model as CustomModelBlock4, but instead of facing the
* player when placed, this one ALWAYS faces the player. I know, creepy right?
* @author shadekiller666
*
*/
*//*
public static class OBJDynamicEye extends Block
{
public static final String name = "obj_dynamic_eye";
@@ -766,6 +787,7 @@ public class ModelLoaderRegistryTest
return true;
}
*/
/* @Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos)
{
@@ -778,7 +800,8 @@ public class ModelLoaderRegistryTest
}
}
return state;
}*/
}*//*
}
public static class OBJDynamicEyeTileEntity extends TileEntity implements ITickable
@@ -822,3 +845,4 @@ public class ModelLoaderRegistryTest
}
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.model;
@@ -100,3 +101,4 @@ public class MultiLayerModelTest
}
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.rendering;
@@ -265,3 +266,4 @@ public class FastTESRTransparentTest
}
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.rendering;
@@ -161,3 +162,4 @@ public class ItemTESRTest
{
}
}
*/
@@ -15,7 +15,8 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*//*
package net.minecraftforge.debug.client.rendering;
@@ -112,3 +113,4 @@ public class VertexBufferNormalTest
}
}
}
*/