use of net.minecraft.util.math.Vec3i in project ImmersiveEngineering by BluSunrize.
the class ClientUtils method renderQuads.
public static void renderQuads(Collection<BakedQuad> quads, float brightness, float red, float green, float blue) {
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
for (BakedQuad bakedquad : quads) {
vertexbuffer.begin(7, DefaultVertexFormats.ITEM);
vertexbuffer.addVertexData(bakedquad.getVertexData());
if (bakedquad.hasTintIndex())
vertexbuffer.putColorRGB_F4(red * brightness, green * brightness, blue * brightness);
else
vertexbuffer.putColorRGB_F4(brightness, brightness, brightness);
Vec3i vec3i = bakedquad.getFace().getDirectionVec();
vertexbuffer.putNormal((float) vec3i.getX(), (float) vec3i.getY(), (float) vec3i.getZ());
tessellator.draw();
}
}
use of net.minecraft.util.math.Vec3i in project malmo by Microsoft.
the class BuildBattleDecoratorImplementation method parseParameters.
/**
* Attempt to parse the given object as a set of parameters for this handler.
*
* @param params the parameter block to parse
* @return true if the object made sense for this handler; false otherwise.
*/
@Override
public boolean parseParameters(Object params) {
if (params == null || !(params instanceof BuildBattleDecorator))
return false;
this.params = (BuildBattleDecorator) params;
this.sourceBounds = this.params.getGoalStructureBounds();
this.destBounds = this.params.getPlayerStructureBounds();
this.delta = new Vec3i(destBounds.getMin().getX() - sourceBounds.getMin().getX(), destBounds.getMin().getY() - sourceBounds.getMin().getY(), destBounds.getMin().getZ() - sourceBounds.getMin().getZ());
this.structureVolume = volumeOfBounds(this.sourceBounds);
assert (this.structureVolume == volumeOfBounds(this.destBounds));
this.dest = new ArrayList<IBlockState>(Collections.nCopies(this.structureVolume, (IBlockState) null));
this.source = new ArrayList<IBlockState>(Collections.nCopies(this.structureVolume, (IBlockState) null));
DrawBlockBasedObjectType tickBlock = this.params.getBlockTypeOnCorrectPlacement();
DrawBlockBasedObjectType crossBlock = this.params.getBlockTypeOnIncorrectPlacement();
this.blockTypeOnCorrectPlacement = (tickBlock != null) ? new XMLBlockState(tickBlock.getType(), tickBlock.getColour(), tickBlock.getFace(), tickBlock.getVariant()) : null;
this.blockTypeOnIncorrectPlacement = (crossBlock != null) ? new XMLBlockState(crossBlock.getType(), crossBlock.getColour(), crossBlock.getFace(), crossBlock.getVariant()) : null;
return true;
}
use of net.minecraft.util.math.Vec3i in project MorePlanets by SteveKunG.
the class ClientRendererUtil method renderModelBrightnessColorQuads.
private static void renderModelBrightnessColorQuads(float brightness, float red, float green, float blue, List<BakedQuad> listQuads) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder vertexbuffer = tessellator.getBuffer();
int i = 0;
for (int j = listQuads.size(); i < j; ++i) {
BakedQuad bakedquad = listQuads.get(i);
vertexbuffer.begin(7, DefaultVertexFormats.ITEM);
vertexbuffer.addVertexData(bakedquad.getVertexData());
if (bakedquad.hasTintIndex()) {
ClientRendererUtil.putColorRGB_F4(vertexbuffer, red * brightness, green * brightness, blue * brightness);
} else {
ClientRendererUtil.putColorRGB_F4(vertexbuffer, brightness, brightness, brightness);
}
Vec3i vec3i = bakedquad.getFace().getDirectionVec();
vertexbuffer.putNormal(vec3i.getX(), vec3i.getY(), vec3i.getZ());
tessellator.draw();
}
}
use of net.minecraft.util.math.Vec3i in project Overloaded by CJ-MC-Mods.
the class ItemMultiTool method rightClickWithItem.
public void rightClickWithItem(@Nonnull World worldIn, @Nonnull EntityPlayerMP player, @Nonnull BlockPos pos, @Nonnull EnumFacing sideHit, float hitX, float hitY, float hitZ) {
ItemStack multiTool = player.getHeldItemMainhand();
if (multiTool.getItem() != this) {
return;
}
NBTTagCompound tagCompound = multiTool.getTagCompound();
if (tagCompound == null || !tagCompound.hasKey("Item")) {
player.sendStatusMessage(new TextComponentString("No block type selected to place."), true);
return;
}
NBTTagCompound itemTag = tagCompound.getCompoundTag("Item");
ItemStack blockStack = new ItemStack(itemTag);
if (!(blockStack.getItem() instanceof ItemBlock)) {
player.sendStatusMessage(new TextComponentString("No valid block type selected to place."), true);
return;
}
IEnergyStorage energy = multiTool.getCapability(ENERGY, null);
Vec3i sideVector = sideHit.getDirectionVec();
BlockPos.MutableBlockPos newPosition = new BlockPos.MutableBlockPos(pos.add(sideVector));
if (!placeBlock(blockStack, player, worldIn, newPosition, sideHit, energy, hitX, hitY, hitZ))
return;
if (player.isSneaking()) {
BlockPos playerPos = player.getPosition();
switch(sideHit) {
case UP:
while (newPosition.getY() < playerPos.getY()) {
newPosition.move(sideHit);
if (!placeBlock(blockStack, player, worldIn, newPosition, sideHit, energy, hitX, hitY, hitZ))
break;
}
break;
case DOWN:
while (newPosition.getY() > playerPos.getY()) {
newPosition.move(sideHit);
if (!placeBlock(blockStack, player, worldIn, newPosition, sideHit, energy, hitX, hitY, hitZ))
break;
}
break;
case NORTH:
while (newPosition.getZ() > playerPos.getZ()) {
newPosition.move(sideHit);
if (!placeBlock(blockStack, player, worldIn, newPosition, sideHit, energy, hitX, hitY, hitZ))
break;
}
break;
case SOUTH:
while (newPosition.getZ() < playerPos.getZ()) {
newPosition.move(sideHit);
if (!placeBlock(blockStack, player, worldIn, newPosition, sideHit, energy, hitX, hitY, hitZ))
break;
}
break;
case EAST:
while (newPosition.getX() < playerPos.getX()) {
newPosition.move(sideHit);
if (!placeBlock(blockStack, player, worldIn, newPosition, sideHit, energy, hitX, hitY, hitZ))
break;
}
break;
case WEST:
while (newPosition.getX() > playerPos.getX()) {
newPosition.move(sideHit);
if (!placeBlock(blockStack, player, worldIn, newPosition, sideHit, energy, hitX, hitY, hitZ))
break;
}
break;
}
}
}
use of net.minecraft.util.math.Vec3i in project Overloaded by CJ-MC-Mods.
the class ModelUtils method renderQuadsARGB.
public static void renderQuadsARGB(List<BakedQuad> listQuads, int ARGB_Hex) {
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getBuffer();
int i = 0;
for (int j = listQuads.size(); i < j; ++i) {
BakedQuad bakedquad = (BakedQuad) listQuads.get(i);
vertexbuffer.begin(7, DefaultVertexFormats.ITEM);
vertexbuffer.addVertexData(bakedquad.getVertexData());
vertexbuffer.putColor4(ARGB_Hex);
Vec3i vec3i = bakedquad.getFace().getDirectionVec();
vertexbuffer.putNormal((float) vec3i.getX(), (float) vec3i.getY(), (float) vec3i.getZ());
tessellator.draw();
}
}
Aggregations