use of net.minecraft.util.math.BlockPos in project RFToolsDimensions by McJty.
the class GuiProxy method getServerGuiElement.
@Override
public Object getServerGuiElement(int guiid, EntityPlayer entityPlayer, World world, int x, int y, int z) {
if (guiid == RFToolsDim.GUI_MANUAL_DIMENSION) {
return null;
}
// if (guiid == RFToolsDim.GUI_MANUAL_MAIN || guiid == RFTools.GUI_TELEPORTPROBE || guiid == RFTools.GUI_ADVANCEDPORTER) {
// return null;
// } else if (guiid == RFTools.GUI_REMOTE_STORAGE_ITEM) {
// return new RemoteStorageItemContainer(entityPlayer);
// } else if (guiid == RFTools.GUI_MODULAR_STORAGE_ITEM) {
// return new ModularStorageItemContainer(entityPlayer);
// } else if (guiid == RFTools.GUI_STORAGE_FILTER) {
// return new StorageFilterContainer(entityPlayer);
// }
BlockPos pos = new BlockPos(x, y, z);
Block block = world.getBlockState(pos).getBlock();
if (block instanceof GenericBlock) {
GenericBlock genericBlock = (GenericBlock) block;
TileEntity te = world.getTileEntity(pos);
return genericBlock.createServerContainer(entityPlayer, te);
}
return null;
}
use of net.minecraft.util.math.BlockPos in project ImmersiveEngineering by BluSunrize.
the class SmartLightingQuad method pipe.
@Override
public void pipe(IVertexConsumer consumer) {
IBlockAccess world = null;
BlockInfo info = null;
if (consumer instanceof VertexLighterFlat) {
try {
info = (BlockInfo) blockInfo.get(consumer);
world = info.getWorld();
if (world instanceof ChunkCache)
world = ((ChunkCache) world).worldObj;
consumer = (IVertexConsumer) parent.get(consumer);
} catch (Throwable e) {
e.printStackTrace();
}
}
consumer.setQuadOrientation(this.getFace());
if (this.hasTintIndex())
consumer.setQuadTint(this.getTintIndex());
float[] data = new float[4];
VertexFormat format = consumer.getVertexFormat();
int count = format.getElementCount();
int[] eMap = LightUtil.mapFormats(format, DefaultVertexFormats.ITEM);
int itemCount = DefaultVertexFormats.ITEM.getElementCount();
eMap[eMap.length - 1] = 2;
for (int v = 0; v < 4; v++) for (int e = 0; e < count; e++) if (eMap[e] != itemCount) {
if (//lightmap is UV with 2 shorts
format.getElement(e).getUsage() == EnumUsage.UV && format.getElement(e).getType() == EnumType.SHORT) {
int brightness;
if (!ignoreLight && world != null && !(world instanceof ChunkCache)) {
BlockPos here = blockPos.add(relativePos[v][0], relativePos[v][1], relativePos[v][2]);
brightness = world.getCombinedLight(here, 0);
} else
brightness = staticBrightness;
data[0] = ((float) ((brightness >> 0x04) & 0xF) * 0x20) / 0xFFFF;
data[1] = ((float) ((brightness >> 0x14) & 0xF) * 0x20) / 0xFFFF;
} else
LightUtil.unpack(this.getVertexData(), data, DefaultVertexFormats.ITEM, v, eMap[e]);
consumer.put(e, data);
} else
consumer.put(e, 0);
}
use of net.minecraft.util.math.BlockPos in project ImmersiveEngineering by BluSunrize.
the class ConnModelReal method getQuads.
@Override
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
if (side == null && state instanceof IExtendedBlockState) {
IExtendedBlockState iExtendedBlockState = (IExtendedBlockState) state;
ExtBlockstateAdapter ad = new ExtBlockstateAdapter(iExtendedBlockState, null, ExtBlockstateAdapter.ONLY_OBJ_CALLBACK);
int x = 0, z = 0;
if (iExtendedBlockState.getUnlistedProperties().containsKey(IEProperties.CONNECTIONS)) {
Set<Connection> conns = iExtendedBlockState.getValue(IEProperties.CONNECTIONS);
if (conns != null && conns.size() > 0) {
BlockPos tmp = conns.iterator().next().start;
x = (tmp.getX() % 16 + 16) % 16;
z = (tmp.getZ() % 16 + 16) % 16;
}
}
Pair<Byte, ExtBlockstateAdapter> key = new ImmutablePair<>((byte) ((x << 4) | z), ad);
IBakedModel ret = cache.get(key);
if (ret == null) {
ret = new AssembledBakedModel(iExtendedBlockState, textureAtlasSprite, base, rand);
cache.put(key, ret);
}
return ret.getQuads(state, side, rand);
}
return base.getQuads(state, side, rand);
}
use of net.minecraft.util.math.BlockPos in project ImmersiveEngineering by BluSunrize.
the class EntityChemthrowerShot method onEntityUpdate.
@Override
public void onEntityUpdate() {
if (this.getFluid() == null && this.worldObj.isRemote)
this.fluid = getFluidSynced();
IBlockState state = worldObj.getBlockState(new BlockPos(posX, posY, posZ));
Block b = state.getBlock();
if (b != null && this.canIgnite() && (state.getMaterial() == Material.FIRE || state.getMaterial() == Material.LAVA))
this.setFire(6);
super.onEntityUpdate();
}
use of net.minecraft.util.math.BlockPos in project ImmersiveEngineering by BluSunrize.
the class TileEntityWatermill method placeDummies.
@Override
public void placeDummies(BlockPos pos, IBlockState state, EnumFacing side, float hitX, float hitY, float hitZ) {
for (int hh = -2; hh <= 2; hh++) for (int ww = -2; ww <= 2; ww++) if ((hh > -2 && hh < 2) || (ww > -2 && ww < 2)) {
BlockPos pos2 = pos.add(facing.getAxis() == Axis.Z ? ww : 0, hh, facing.getAxis() == Axis.Z ? 0 : ww);
worldObj.setBlockState(pos2, state);
TileEntityWatermill dummy = (TileEntityWatermill) worldObj.getTileEntity(pos2);
dummy.facing = facing;
dummy.offset = new int[] { ww, hh };
}
}
Aggregations