本文整理汇总了Java中net.minecraftforge.client.ForgeHooksClient类的典型用法代码示例。如果您正苦于以下问题:Java ForgeHooksClient类的具体用法?Java ForgeHooksClient怎么用?Java ForgeHooksClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ForgeHooksClient类属于net.minecraftforge.client包,在下文中一共展示了ForgeHooksClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderBlockModel
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
public static void renderBlockModel(World world, BlockPos pos, IBlockState state) {
VertexBuffer wr = Tessellator.getInstance().getBuffer();
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
wr.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ());
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
BlockModelShapes modelShapes = blockrendererdispatcher.getBlockModelShapes();
IBakedModel ibakedmodel = modelShapes.getModelForState(state);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
for(BlockRenderLayer layer : BlockRenderLayer.values()) {
if(state.getBlock().canRenderInLayer(state, layer)) {
ForgeHooksClient.setRenderLayer(layer);
blockrendererdispatcher.getBlockModelRenderer().renderModel(world, ibakedmodel, state, pos, wr, true);
}
}
ForgeHooksClient.setRenderLayer(null);
wr.setTranslation(0, 0, 0);
Tessellator.getInstance().draw();
}
示例2: renderItemInWorld
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static void renderItemInWorld(ItemStack stack){
if(!stack.isEmpty()){
Minecraft mc = Minecraft.getMinecraft();
RenderItem renderer = mc.getRenderItem();
TextureManager manager = mc.getTextureManager();
IBakedModel model = renderer.getItemModelWithOverrides(stack, null, null);
manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
GlStateManager.enableRescaleNormal();
GlStateManager.enableBlend();
GlStateManager.pushMatrix();
model = ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.FIXED, false);
renderer.renderItem(stack, model);
GlStateManager.cullFace(GlStateManager.CullFace.BACK);
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
}
}
示例3: addBakedQuadRotated
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
/**
* Add a given rotated quad to a list of quads.
* @param quads The quads to append to.
* @param x1 Start X
* @param x2 End X
* @param z1 Start Z
* @param z2 End Z
* @param y Y
* @param texture The base texture
* @param side The side to add render quad at.
* @param rotation The rotation index to rotate by.
* @param isColored When set to true a colored baked quad will be made, otherwise a regular baked quad is used.
* @param shadeColor The shade color
* @param uvs A double array of 4 uv pairs
*/
public static void addBakedQuadRotated(List<BakedQuad> quads, float x1, float x2, float z1, float z2, float y,
TextureAtlasSprite texture, EnumFacing side, int rotation,
boolean isColored, int shadeColor, float[][] uvs) {
Vec3d v1 = rotate(new Vec3d(x1 - .5, y - .5, z1 - .5), side).addVector(.5, .5, .5);
Vec3d v2 = rotate(new Vec3d(x1 - .5, y - .5, z2 - .5), side).addVector(.5, .5, .5);
Vec3d v3 = rotate(new Vec3d(x2 - .5, y - .5, z2 - .5), side).addVector(.5, .5, .5);
Vec3d v4 = rotate(new Vec3d(x2 - .5, y - .5, z1 - .5), side).addVector(.5, .5, .5);
int[] data = Ints.concat(
vertexToInts((float) v1.xCoord, (float) v1.yCoord, (float) v1.zCoord, shadeColor, texture, uvs[(0 + rotation) % 4][0] * 16, uvs[(0 + rotation) % 4][1] * 16),
vertexToInts((float) v2.xCoord, (float) v2.yCoord, (float) v2.zCoord, shadeColor, texture, uvs[(1 + rotation) % 4][0] * 16, uvs[(1 + rotation) % 4][1] * 16),
vertexToInts((float) v3.xCoord, (float) v3.yCoord, (float) v3.zCoord, shadeColor, texture, uvs[(2 + rotation) % 4][0] * 16, uvs[(2 + rotation) % 4][1] * 16),
vertexToInts((float) v4.xCoord, (float) v4.yCoord, (float) v4.zCoord, shadeColor, texture, uvs[(3 + rotation) % 4][0] * 16, uvs[(3 + rotation) % 4][1] * 16)
);
ForgeHooksClient.fillNormal(data, side); // This fixes lighting issues when item is rendered in hand/inventory
quads.add(new BakedQuad(data, -1, side, texture, false, Attributes.DEFAULT_BAKED_FORMAT));
}
示例4: getQuads
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
private void getQuads(ModelHolder holder, List<BakedQuad> quads)
{
if (holder.actualState.getRenderType() == EnumBlockRenderType.MODEL/* ||
holder.actualState.getRenderType() == EnumBlockRenderType.LIQUID*/)
{
BlockRenderLayer originalLayer = MinecraftForgeClient.getRenderLayer();
for (BlockRenderLayer layer : BlockRenderLayer.values())
{
if (holder.actualState.getBlock().canRenderInLayer(holder.actualState, layer))
{
ForgeHooksClient.setRenderLayer(layer);
for (final EnumFacing facing : EnumFacing.values())
{
quads.addAll(holder.model.getQuads(holder.extendedState, facing, 0));
}
quads.addAll(holder.model.getQuads(holder.extendedState, null, 0));
}
}
ForgeHooksClient.setRenderLayer(originalLayer);
}
}
示例5: renderMultiblock
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
public static final void renderMultiblock(final IBlockState state, final double x, final double y, final double z,
final BlockRendererDispatcher blockRender)
{
final Minecraft minecraft = Minecraft.getMinecraft();
minecraft.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
ForgeHooksClient.setRenderLayer(BlockRenderLayer.CUTOUT);
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
RenderHelper.disableStandardItemLighting();
GlStateManager.color(1f, 1f, 1f, 1f);
final int alpha = (int) (0.5 * 0xFF) << 24;
GlStateManager.enableBlend();
GlStateManager.enableTexture2D();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.colorMask(true, true, true, true);
GlStateManager.depthFunc(GL11.GL_LEQUAL);
RenderUtil.renderQuads(blockRender.getModelForState(state).getQuads(state, null, 0), alpha);
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
示例6: renderStackOnBlock
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
protected void renderStackOnBlock(ItemStack stack, ForgeDirection side, ForgeDirection orientation, Coordinates barrelPos, float size, double posx, double posy)
{
if (stack == null) {
return;
}
int[][] savedGLState = saveGLState(new int[] { 3008, 2896 });
GL11.glPushMatrix();
alignRendering(side, orientation, barrelPos);
moveRendering(size, posx, posy, -0.001D);
if (!ForgeHooksClient.renderInventoryItem(this.renderBlocks, this.texManager, stack, true, 0.0F, 0.0F, 0.0F)) {
this.renderItem.func_77015_a(this.renderFont, this.texManager, stack, 0, 0);
}
GL11.glPopMatrix();
restoreGlState(savedGLState);
}
示例7: getMatrix4f
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
/**
* Find appropriate transformation assuming base model is oriented to Y orthogonalAxis, positive.
* This is different than the Minecraft/Forge default because I brain that way.<br><br>
*
* @see #getMatrixForAxisAndRotation(net.minecraft.util.EnumFacing.Axis, boolean, Rotation) for
* more explanation.
*/
protected static Matrix4f getMatrix4f(ModelState modelState)
{
if(modelState.hasAxis())
{
if(modelState.hasAxisRotation())
{
return getMatrixForAxisAndRotation(modelState.getAxis(), modelState.isAxisInverted(), modelState.getAxisRotation());
}
else
{
return getMatrixForAxis(modelState.getAxis(), modelState.isAxisInverted());
}
}
else if(modelState.hasAxisRotation())
{
return getMatrixForRotation(modelState.getAxisRotation());
}
else
{
return ForgeHooksClient.getMatrix(ModelRotation.X0_Y0);
}
}
示例8: getMatrixForAxis
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
/**
* See {@link #getMatrixForAxisAndRotation(net.minecraft.util.EnumFacing.Axis, boolean, Rotation)}
*/
protected static Matrix4f getMatrixForAxis(EnumFacing.Axis axis, boolean isAxisInverted)
{
switch(axis)
{
case X:
return ForgeHooksClient.getMatrix(isAxisInverted ? ModelRotation.X90_Y270 : ModelRotation.X90_Y90);
case Y:
return ForgeHooksClient.getMatrix(isAxisInverted ? ModelRotation.X180_Y0 : ModelRotation.X0_Y0);
case Z:
return ForgeHooksClient.getMatrix(isAxisInverted ? ModelRotation.X90_Y0 : ModelRotation.X270_Y0);
default:
return ForgeHooksClient.getMatrix(ModelRotation.X0_Y0);
}
}
示例9: getMatrixForRotation
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
/**
* See {@link #getMatrixForAxisAndRotation(net.minecraft.util.EnumFacing.Axis, boolean, Rotation)}
*/
protected static Matrix4f getMatrixForRotation(Rotation rotation)
{
switch(rotation)
{
default:
case ROTATE_NONE:
return ForgeHooksClient.getMatrix(ModelRotation.X0_Y0);
case ROTATE_90:
return ForgeHooksClient.getMatrix(ModelRotation.X0_Y90);
case ROTATE_180:
return ForgeHooksClient.getMatrix(ModelRotation.X0_Y180);
case ROTATE_270:
return ForgeHooksClient.getMatrix(ModelRotation.X0_Y270);
}
}
示例10: renderBlock
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
protected void renderBlock(SuperTileEntity te, BufferBuilder buffer)
{
SuperBlock block = (SuperBlock) te.getBlockType();
if(block.blockRenderMode != BlockRenderMode.TESR) return;
if(MinecraftForgeClient.getRenderPass() == 0)
{
ForgeHooksClient.setRenderLayer(BlockRenderLayer.SOLID);
// FIXME: only do this when texture demands it and use FastTESR other times
GlStateManager.disableAlpha();
renderBlockInner(te, block, false, buffer);
GlStateManager.enableAlpha();
ForgeHooksClient.setRenderLayer(null);
}
else if(MinecraftForgeClient.getRenderPass() == 1)
{
ForgeHooksClient.setRenderLayer(BlockRenderLayer.TRANSLUCENT);
renderBlockInner(te, block, true, buffer);
ForgeHooksClient.setRenderLayer(null);
}
}
示例11: getArmorResource
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
/**
* More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide.
*
* @param entity Entity wearing the armor
* @param stack ItemStack for the armor
* @param slot Slot ID that the item is in
* @param type Subtype, can be null or "overlay"
* @return ResourceLocation pointing at the armor's texture
*/
public static ResourceLocation getArmorResource(Entity entity, ItemStack stack, int slot, String type)
{
ItemArmor item = (ItemArmor)stack.getItem();
String s1 = String.format("textures/models/armor/%s_layer_%d%s.png",
bipedArmorFilenamePrefix[item.renderIndex], (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type));
s1 = ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type);
ResourceLocation resourcelocation = (ResourceLocation)field_110859_k.get(s1);
if (resourcelocation == null)
{
resourcelocation = new ResourceLocation(s1);
field_110859_k.put(s1, resourcelocation);
}
return resourcelocation;
}
示例12: handlePerspective
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
@Override
public Pair<? extends IFlexibleBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
switch (cameraTransformType) {
case FIRST_PERSON:
GlStateManager.scale(2.0F, 2.0F, 2.0F);
ForgeHooksClient.handleCameraTransforms(parent, cameraTransformType);
GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(0.0F, 0.0F, -0.35F);
break;
case THIRD_PERSON:
GlStateManager.scale(2.0F, 2.0F, 2.0F);
ForgeHooksClient.handleCameraTransforms(parent, cameraTransformType);
GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(-0.15F, 0.25F, -0.25F);
break;
default:
ForgeHooksClient.handleCameraTransforms(parent, cameraTransformType);
break;
}
return Pair.of(this, null);
}
示例13: getRenderBlockPass
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
/**
* Returns which pass this block be rendered on. 0 for solids and 1 for alpha.
*/
public int getRenderBlockPass()
{
/*
* Alpha properties of block or cover depend on this returning a value
* of 1, so it's the default value. However, when rendering in player
* hand we'll encounter sorting artifacts, and thus need to enforce
* opaque rendering, or 0.
*/
if (ForgeHooksClient.getWorldRenderPass() < 0) {
return 0;
} else {
return 1;
}
}
示例14: init
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
@Override
public void init() {
new ClientEventListener();
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBChest.class, TESRBChest.INSTANCE);
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBBarrel.class, TESRBBarrel.INSTANCE);
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBTank.class, TESRBTank.INSTANCE);
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(BlocksItemsBetterChests.betterchest), 0, TileEntityBChest.class);
TickRegistry.CLIENT.addContinuousCallback(() -> {
if (!pressed && keyBind.isPressed() && Minecraft.getMinecraft().world != null) {
//Open bag
int idx = InvUtil.findInInvInternal(Minecraft.getMinecraft().player.inventory, null, stack -> stack.getItem() instanceof ItemBBag);
if (idx != -1) {
BetterChests.instance.ph.sendPacketToPlayers(new PacketOpenBag(idx));
}
}
pressed = keyBind.isPressed();
});
ClientRegistry.registerKeyBinding(keyBind);
}
示例15: renderBlockModel
import net.minecraftforge.client.ForgeHooksClient; //导入依赖的package包/类
@SuppressWarnings("null")
public static void renderBlockModel(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, boolean translateToOrigin, boolean relight) {
VertexBuffer wr = Tessellator.getInstance().getBuffer();
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
if (translateToOrigin) {
wr.setTranslation(-pos.getX(), -pos.getY(), -pos.getZ());
}
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
BlockModelShapes modelShapes = blockrendererdispatcher.getBlockModelShapes();
IBakedModel ibakedmodel = modelShapes.getModelForState(state);
final IBlockAccess worldWrapper = relight ? new WorldWrapper(world, pos) : world;
for (BlockRenderLayer layer : BlockRenderLayer.values()) {
if (state.getBlock().canRenderInLayer(state, layer)) {
ForgeHooksClient.setRenderLayer(layer);
blockrendererdispatcher.getBlockModelRenderer().renderModel(worldWrapper, ibakedmodel, state, pos, wr, false);
}
}
ForgeHooksClient.setRenderLayer(null);
if (translateToOrigin) {
wr.setTranslation(0, 0, 0);
}
Tessellator.getInstance().draw();
}