Clean up formatting of Forge Test mods and disable noisy ones (#3908)

This commit is contained in:
mezz authored and LexManos committed 2017-05-29 02:10:40 -07:00
1 parent 4ea73399de
commit e6dcfde214
75 files changed
+1378 -820

No files matched your search

@@ -1,7 +1,7 @@
package net.minecraftforge.debug;
import com.google.common.collect.ImmutableMap;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
@@ -54,8 +54,7 @@ import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import com.google.common.collect.ImmutableMap;
import org.apache.logging.log4j.Logger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -75,6 +74,7 @@ public class ModelAnimationDebug
@SidedProxy
public static CommonProxy proxy;
private static Logger logger;
public static abstract class CommonProxy
{
@@ -91,14 +91,20 @@ public class ModelAnimationDebug
@Override
public ExtendedBlockState createBlockState()
{
return new ExtendedBlockState(this, new IProperty[]{ FACING, Properties.StaticProperty }, new IUnlistedProperty[]{ Properties.AnimationProperty });
return new ExtendedBlockState(this, new IProperty[]{FACING, Properties.StaticProperty}, new IUnlistedProperty[]{Properties.AnimationProperty});
}
@Override
public boolean isOpaqueCube(IBlockState state) { return false; }
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullCube(IBlockState state) { return false; }
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
@@ -107,27 +113,32 @@ public class ModelAnimationDebug
}
@Override
public IBlockState getStateFromMeta(int meta) {
public IBlockState getStateFromMeta(int meta)
{
return getDefaultState().withProperty(FACING, EnumFacing.getFront(meta));
}
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumFacing)state.getValue(FACING)).getIndex();
public int getMetaFromState(IBlockState state)
{
return state.getValue(FACING).getIndex();
}
@Override
public boolean hasTileEntity(IBlockState state) {
public boolean hasTileEntity(IBlockState state)
{
return true;
}
@Override
public TileEntity createTileEntity(World world, IBlockState state) {
public TileEntity createTileEntity(World world, IBlockState state)
{
return new Chest();
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
{
return state.withProperty(Properties.StaticProperty, true);
}
@@ -144,12 +155,12 @@ public class ModelAnimationDebug
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
if(world.isRemote)
if (world.isRemote)
{
TileEntity te = world.getTileEntity(pos);
if(te instanceof Chest)
if (te instanceof Chest)
{
((Chest)te).click(player.isSneaking());
((Chest) te).click(player.isSneaking());
}
}
return true;
@@ -214,13 +225,13 @@ public class ModelAnimationDebug
}*/
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()))
{
@Override
public void handleEvents(EntityChest chest, float time, Iterable<Event> pastEvents)
{
@Override
public void handleEvents(EntityChest chest, float time, Iterable<Event> pastEvents)
{
chest.handleEvents(time, pastEvents);
}
}, 0.5f)
chest.handleEvents(time, pastEvents);
}
}, 0.5f)
{
protected ResourceLocation getEntityTexture(EntityChest entity)
{
@@ -243,7 +254,7 @@ public class ModelAnimationDebug
private final VariableValue cycleLength = new VariableValue(4);
private final IAnimationStateMachine asm = proxy.load(new ResourceLocation(MODID.toLowerCase(), "asms/block/engine.json"), ImmutableMap.<String, ITimeValue>of(
"cycle_length", cycleLength
"cycle_length", cycleLength
));
@Override
@@ -256,7 +267,7 @@ public class ModelAnimationDebug
@Nullable
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing)
{
if(capability == CapabilityAnimation.ANIMATION_CAPABILITY)
if (capability == CapabilityAnimation.ANIMATION_CAPABILITY)
{
return CapabilityAnimation.ANIMATION_CAPABILITY.cast(asm);
}
@@ -265,7 +276,11 @@ public class ModelAnimationDebug
}
@EventHandler
public void preInit(FMLPreInitializationEvent event) { proxy.preInit(event); }
public void preInit(FMLPreInitializationEvent event)
{
logger = event.getModLog();
proxy.preInit(event);
}
public static class Chest extends TileEntity
{
@@ -275,22 +290,23 @@ public class ModelAnimationDebug
private final VariableValue clickTime = new VariableValue(Float.NEGATIVE_INFINITY);
//private final VariableValue offset = new VariableValue(0);
public Chest() {
public Chest()
{
/*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
//"offset", offset
"cycle_length", cycleLength,
"click_time", clickTime
//"offset", offset
));
}
public void handleEvents(float time, Iterable<Event> pastEvents)
{
for(Event event : pastEvents)
for (Event event : pastEvents)
{
System.out.println("Event: " + event.event() + " " + event.offset() + " " + getPos() + " " + time);
logger.info("Event: " + event.event() + " " + event.offset() + " " + getPos() + " " + time);
}
}
@@ -306,9 +322,9 @@ public class ModelAnimationDebug
public void click(boolean sneaking)
{
if(asm != null)
if (asm != null)
{
if(sneaking)
if (sneaking)
{
cycleLength.setValue(6 - cycleLength.apply(0));
}
@@ -322,7 +338,7 @@ public class ModelAnimationDebug
clickTime.setValue(Animation.getWorldTime(getWorld()));
asm.transition("closing");
}*/
else if(asm.currentState().equals("default"))
else if (asm.currentState().equals("default"))
{
float time = Animation.getWorldTime(getWorld(), Animation.getPartialTickTime());
clickTime.setValue(time);
@@ -330,7 +346,7 @@ public class ModelAnimationDebug
//asm.transition("moving");
asm.transition("starting");
}
else if(asm.currentState().equals("moving"))
else if (asm.currentState().equals("moving"))
{
clickTime.setValue(Animation.getWorldTime(getWorld(), Animation.getPartialTickTime()));
asm.transition("stopping");
@@ -341,7 +357,7 @@ public class ModelAnimationDebug
@Override
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing side)
{
if(capability == CapabilityAnimation.ANIMATION_CAPABILITY)
if (capability == CapabilityAnimation.ANIMATION_CAPABILITY)
{
return true;
}
@@ -352,7 +368,7 @@ public class ModelAnimationDebug
@Nullable
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing side)
{
if(capability == CapabilityAnimation.ANIMATION_CAPABILITY)
if (capability == CapabilityAnimation.ANIMATION_CAPABILITY)
{
return CapabilityAnimation.ANIMATION_CAPABILITY.cast(asm);
}
@@ -370,7 +386,7 @@ public class ModelAnimationDebug
super(world);
setSize(1, 1);
asm = proxy.load(new ResourceLocation(MODID.toLowerCase(), "asms/block/engine.json"), ImmutableMap.<String, ITimeValue>of(
"cycle_length", cycleLength
"cycle_length", cycleLength
));
}
@@ -399,7 +415,7 @@ public class ModelAnimationDebug
@Override
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing side)
{
if(capability == CapabilityAnimation.ANIMATION_CAPABILITY)
if (capability == CapabilityAnimation.ANIMATION_CAPABILITY)
{
return true;
}
@@ -410,7 +426,7 @@ public class ModelAnimationDebug
@Nullable
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing side)
{
if(capability == CapabilityAnimation.ANIMATION_CAPABILITY)
if (capability == CapabilityAnimation.ANIMATION_CAPABILITY)
{
return CapabilityAnimation.ANIMATION_CAPABILITY.cast(asm);
}