Fixed a few force field projector regressions

This commit is contained in:
Unknown 2019-04-27 15:47:46 +02:00 committed by unknown
parent 3102520372
commit 4f89702b39
3 changed files with 16 additions and 9 deletions

View file

@ -475,11 +475,11 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
// => recover it
tileEntityForceField.setProjector(new VectorI(this));
tileEntityForceField.cache_blockStateCamouflage = forceFieldSetup.getCamouflageBlockState();
world.setBlockState(vector.getBlockPos(), tileEntityForceField.cache_blockStateCamouflage, 2);
// world.setBlockState(vector.getBlockPos(), tileEntityForceField.cache_blockStateCamouflage, 2);
} else if (tileEntityForceFieldProjector == this) {// this is ours
if ( tileEntityForceField.cache_blockStateCamouflage.equals(forceFieldSetup.getCamouflageBlockState())
|| blockState.equals(blockStateForceField) ) {
if ( !tileEntityForceField.cache_blockStateCamouflage.equals(forceFieldSetup.getCamouflageBlockState())
|| !blockState.equals(blockStateForceField) ) {
// camouflage changed while chunk wasn't loaded or de-synchronisation
// force field downgraded during explosion
// => force a new placement
@ -490,7 +490,8 @@ public class TileEntityForceFieldProjector extends TileEntityAbstractForceField
}
}
doProjectThisBlock = blockState.getBlock().isReplaceable(world, vector.getBlockPos()) || (blockState.getBlock() == WarpDrive.blockForceFields[enumTier.getIndex()]);
doProjectThisBlock = blockState.getBlock().isReplaceable(world, vector.getBlockPos())
|| blockState.getBlock() == WarpDrive.blockForceFields[enumTier.getIndex()];
}
}

View file

@ -37,7 +37,7 @@ public class ClientProxy extends CommonProxy {
OBJLoader.INSTANCE.addDomain(WarpDrive.MODID);
ModelLoaderRegistry.registerLoader(MyCustomModelLoader.INSTANCE);
ModelLoaderRegistry.registerLoader(CustomModelLoaderProjector.INSTANCE);
MinecraftForge.EVENT_BUS.register(ModelBakeEventHandler.INSTANCE);
MinecraftForge.EVENT_BUS.register(SpriteManager.INSTANCE);
}

View file

@ -28,7 +28,7 @@ import javax.vecmath.Matrix4f;
import java.util.*;
// Wrapper around OBJLoader to re-texture faces depending on IExtendedBlockState
public enum MyCustomModelLoader implements ICustomModelLoader {
public enum CustomModelLoaderProjector implements ICustomModelLoader {
INSTANCE;
@ -103,6 +103,8 @@ public enum MyCustomModelLoader implements ICustomModelLoader {
private final IBakedModel bakedModel;
private long timeLastError = -1L;
MyBakedModel(final IBakedModel bakedModel) {
this.bakedModel = bakedModel;
initSprites();
@ -115,9 +117,13 @@ public enum MyCustomModelLoader implements ICustomModelLoader {
final IExtendedBlockState exState = (IExtendedBlockState) blockState;
EnumForceFieldShape enumForceFieldShape = exState != null ? exState.getValue(BlockForceFieldProjector.SHAPE) : EnumForceFieldShape.NONE;
if (enumForceFieldShape == null) {
new RuntimeException("Invalid shape").printStackTrace();
WarpDrive.logger.error(String.format("Invalid shape for %s facing %s",
blockState, enumFacing));
final long time = System.currentTimeMillis();
if (time - timeLastError > 5000L) {
timeLastError = time;
new RuntimeException("Invalid shape").printStackTrace();
WarpDrive.logger.error(String.format("Invalid shape for %s facing %s",
blockState, enumFacing));
}
enumForceFieldShape = EnumForceFieldShape.NONE;
}
final TextureAtlasSprite spriteShape = spriteShapes.get(enumForceFieldShape);