本文整理汇总了Java中net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType类的典型用法代码示例。如果您正苦于以下问题:Java TransformType类的具体用法?Java TransformType怎么用?Java TransformType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransformType类属于net.minecraft.client.renderer.block.model.ItemCameraTransforms包,在下文中一共展示了TransformType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bake
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);
TRSRTransformation transform = state.apply(Optional.empty()).orElse(TRSRTransformation.identity());
TextureAtlasSprite widgetSprite = bakedTextureGetter.apply(getWidgetTexture(widget));
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
int width = widget.getWidth() + (widget.getParameters() != null && widget.getParameters().length > 0 ? 10 : 0);
int height = widget.getHeight() + (widget.hasStepOutput() ? 5 : 0);
Pair<Double, Double> maxUV = widget.getMaxUV();
int textureSize = widget.getTextureSize();
float scale = 1F / (float) Math.max(maxUV.getLeft(), maxUV.getRight());
float transX = 0;//maxUV.getLeft().floatValue();
float transY = -1 + maxUV.getRight().floatValue();
transform = transform.compose(new TRSRTransformation(new Vector3f(0, 0, 0), null, new Vector3f(scale, scale, 1), null));
transform = transform.compose(new TRSRTransformation(new Vector3f(transX, transY, 0), null, new Vector3f(1, 1, 1), null));
builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16 * maxUV.getLeft().floatValue(), 16 * maxUV.getRight().floatValue(), NORTH_Z_BASE, widgetSprite, EnumFacing.NORTH, 0xffffffff));
builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16 * maxUV.getLeft().floatValue(), 16 * maxUV.getRight().floatValue(), SOUTH_Z_BASE, widgetSprite, EnumFacing.SOUTH, 0xffffffff));
return new BakedProgrammingPuzzle(this, builder.build(), widgetSprite, format, Maps.immutableEnumMap(transformMap), Maps.newHashMap());
}
示例2: handlePerspective
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
if (baseSpellPageModel instanceof IPerspectiveAwareModel) {
Matrix4f matrix4f = ((IPerspectiveAwareModel) baseSpellPageModel).handlePerspective(cameraTransformType)
.getRight();
return Pair.of(this, matrix4f);
}
ItemCameraTransforms itemCameraTransforms = baseSpellPageModel.getItemCameraTransforms();
ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
Matrix4f mat = null;
if (tr != null) {
mat = tr.getMatrix();
}
return Pair.of(this, mat);
}
示例3: handlePerspective
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
if (baseKnowledgeBookModel instanceof IPerspectiveAwareModel) {
Matrix4f matrix4f = ((IPerspectiveAwareModel) baseKnowledgeBookModel).handlePerspective(cameraTransformType)
.getRight();
return Pair.of(this, matrix4f);
}
ItemCameraTransforms itemCameraTransforms = baseKnowledgeBookModel.getItemCameraTransforms();
ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
Matrix4f mat = null;
if (tr != null) {
mat = tr.getMatrix();
}
return Pair.of(this, mat);
}
示例4: handlePerspective
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
@Override
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType) {
if (parentModel instanceof IPerspectiveAwareModel) {
Matrix4f matrix4f = ((IPerspectiveAwareModel) parentModel).handlePerspective(cameraTransformType)
.getRight();
return Pair.of(this, matrix4f);
}
ItemCameraTransforms itemCameraTransforms = parentModel.getItemCameraTransforms();
ItemTransformVec3f itemTransformVec3f = itemCameraTransforms.getTransform(cameraTransformType);
TRSRTransformation tr = new TRSRTransformation(itemTransformVec3f);
Matrix4f mat = null;
if (tr != null) {
mat = tr.getMatrix();
}
return Pair.of(this, mat);
}
示例5: renderItem
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
@Override
public void renderItem(@Nonnull ItemStack stack, TransformType transformType) {
if (Block.getBlockFromItem(stack.getItem()) == ModBlocks.DANKNULL_DOCK) {
GuiUtils.bindTexture(DankTextures.DOCK_TEXTURE);
GlStateManager.enableLighting();
GlStateManager.rotate(180, 0, 0, 180);
GlStateManager.translate(-0.5, -1.5, 0.5);
MODEL.render(0.0625F);
GlStateManager.translate(0.5, 1.5, -0.5);
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
renderDankNull(stack);
}
}
示例6: renderItem
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
public void renderItem(ItemStack stack, IBakedModel model) {
if (!stack.isEmpty()) {
if (model.isBuiltInRenderer() && !(stack.getItem() instanceof ItemDankNullHolder)) {
Minecraft.getMinecraft().getItemRenderer().renderItem(EasyMappings.player(), stack, ItemCameraTransforms.TransformType.NONE);
}
else {
RenderModel.render(model, stack);
if (stack.hasEffect()) {
if ((stack.getItem() instanceof ItemDankNull)) {
if (!Options.superShine) {
GlintEffectRenderer.apply(model, stack.getItemDamage());
}
else {
GlintEffectRenderer.apply2(model, DankNullUtils.getColor(stack.getItemDamage(), false));
}
}
else {
GlintEffectRenderer.apply(model, -1);
}
}
}
}
}
示例7: renderIngredients
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
private void renderIngredients(TileEntityInfusionRepair te, double x, double y, double z, float partialTicks)
{
GlStateManager.pushMatrix();
IItemHandler itemHandler = CapUtils.getItemHandler(te);
for(int slot = 0; slot < 8; slot++)
{
ItemStack stack = itemHandler.getStackInSlot(TileEntityInfusionRepair.SLOT_ENCH_ITEM + 1 + slot);
Vec2f ingredientPos = ingredientPositions[slot];
if(Prep1_11.isEmpty(stack)) continue;
GlStateManager.pushMatrix();
GlStateManager.translate(ingredientPos.x * PIXEL_SIZE, -0.15F, ingredientPos.y * PIXEL_SIZE);
GlStateManager.scale(0.5F, 0.5F, 0.5F);
GlStateManager.rotate(((mc.player.ticksExisted + partialTicks) * 60.0f) / 10.0F, 0.0F, 1.0F, 0.0F);
mc.getRenderItem().renderItem(stack, TransformType.GROUND);
GlStateManager.scale(1.0F, 1.0F, 1.0F);
GlStateManager.popMatrix();
}
GlStateManager.popMatrix();
}
示例8: render
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
@Override
public void render(TileEntityWickerBasket te, double x, double y, double z, float partialTicks,
int destroyStage, float alpha)
{
rand.setSeed(te.getWorld().getSeed());
IItemHandler itemHandler = CapUtils.getItemHandler(te);
for(int slot = 0; slot < itemHandler.getSlots(); slot++)
{
GlStateManager.pushMatrix();
//Translate into the centre of the basket, above the bottom
GlStateManager.translate(x + 0.5F, y + 0.2F + 0.075F * slot, z + 0.5F);
GlStateManager.translate(getRandDisplacement(rand), 0.0F, getRandDisplacement(rand));
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(360.0F * rand.nextFloat(), 0.0F, 0.0F, 1.0F);
GlStateManager.scale(0.8F, 0.8F, 0.8F);
Minecraft.getMinecraft().getRenderItem().renderItem(itemHandler.getStackInSlot(slot), TransformType.FIXED);
GlStateManager.popMatrix();
}
}
示例9: MultiLayerBakedModel
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
public MultiLayerBakedModel(ImmutableMap<Optional<BlockRenderLayer>, IBakedModel> models, IBakedModel missing, ImmutableMap<TransformType, TRSRTransformation> cameraTransforms)
{
this.models = models;
this.cameraTransforms = cameraTransforms;
this.missing = missing;
if(models.containsKey(Optional.absent()))
{
base = models.get(Optional.absent());
}
else
{
base = missing;
}
ImmutableMap.Builder<Optional<EnumFacing>, ImmutableList<BakedQuad>> quadBuilder = ImmutableMap.builder();
quadBuilder.put(Optional.<EnumFacing>absent(), buildQuads(models, Optional.<EnumFacing>absent()));
for(EnumFacing side: EnumFacing.values())
{
quadBuilder.put(Optional.of(side), buildQuads(models, Optional.of(side)));
}
quads = quadBuilder.build();
}
示例10: BakedItemModel
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
public BakedItemModel(ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, ImmutableMap<TransformType, TRSRTransformation> transforms, ItemOverrideList overrides, IBakedModel otherModel)
{
this.quads = quads;
this.particle = particle;
this.transforms = transforms;
this.overrides = overrides;
if(otherModel != null)
{
this.otherModel = otherModel;
this.isCulled = true;
}
else
{
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
for(BakedQuad quad : quads)
{
if(quad.getFace() == EnumFacing.SOUTH)
{
builder.add(quad);
}
}
this.otherModel = new BakedItemModel(builder.build(), particle, transforms, overrides, this);
isCulled = false;
}
}
示例11: bake
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
Optional<TRSRTransformation> transform = state.apply(Optional.<IModelPart>absent());
for(int i = 0; i < textures.size(); i++)
{
ResourceLocation tex = textures.get(i);
if(tex.toString().equals("minecraft:missingno"))
continue;
TextureAtlasSprite sprite = bakedTextureGetter.apply(tex);
String breakLocation = new ResourceLocation(Reference.MOD_ID,"items/breakmask").toString();
TextureAtlasSprite breakTemplate = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(breakLocation);
builder.addAll(getQuadsForSprite(i, breakTemplate, sprite, format, transform));
//builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, breakTemplate, sprite, NORTH_Z + Z_OFFSET * i, EnumFacing.NORTH, 0xffffffff));
// builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, breakTemplate, sprite, SOUTH_Z - Z_OFFSET * i, EnumFacing.SOUTH, 0xffffffff));
}
TextureAtlasSprite particle = bakedTextureGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0));
ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> map = IPerspectiveAwareModel.MapWrapper.getTransforms(state);
return new BakedItemModel(builder.build(), particle, map, null);
}
示例12: BakedItemModel
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
public BakedItemModel(ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, ImmutableMap<TransformType, TRSRTransformation> transforms, IBakedModel otherModel) {
this.quads = quads;
this.particle = particle;
this.transforms = transforms;
if(otherModel != null)
{
this.otherModel = otherModel;
this.isCulled = true;
}
else
{
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
for(BakedQuad quad : quads)
{
if(quad.getFace() == EnumFacing.SOUTH)
{
builder.add(quad);
}
}
this.otherModel = new BakedItemModel(builder.build(), particle, transforms, this);
isCulled = false;
}
}
示例13: getBlockTransforms
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
/** Get the default transformations for inside inventories and third person */
protected static ImmutableMap<TransformType, TRSRTransformation> getBlockTransforms() {
ImmutableMap.Builder<TransformType, TRSRTransformation> builder = ImmutableMap.builder();
// Copied from ForgeBlockStateV1
/*builder.put(TransformType.THIRD_PERSON, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, 1.5f / 16, -2.75f / 16),
TRSRTransformation.quatFromYXZDegrees(new Vector3f(10, -45, 170)), new Vector3f(0.375f, 0.375f, 0.375f), null)));
*/
// Gui
{
Matrix4f rotationMatrix = new Matrix4f();
rotationMatrix.setIdentity();
rotationMatrix = rotateTowardsFace(EnumFacing.SOUTH, EnumFacing.EAST);
Matrix4f result = new Matrix4f();
result.setIdentity();
// Multiply by the last matrix transformation FIRST
result.mul(rotationMatrix);
TRSRTransformation trsr = new TRSRTransformation(result);
builder.put(TransformType.GUI, trsr);
}
return builder.build();
}
示例14: render
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
@Override
public void render(ItemStack stack) {
TransformType type = lastTransform;
GlStateManager.pushMatrix();
GlStateManager.translate(0.5, 0.5, 0.5);
GlStateManager.rotate(180, 1, 0, 0);
if(type == TransformType.GUI){
GlStateManager.translate(-1, -0.1, 0);
GlStateManager.scale(0.8, 0.8, 0.8);
GlStateManager.rotate(90, 0, 1, 0);
}else if(type == TransformType.THIRD_PERSON_RIGHT_HAND){
GlStateManager.rotate(90, 0, 1, 0);
GlStateManager.rotate(80, -1, 0, 0);
GlStateManager.rotate(-50, 0, 0, 1);
GlStateManager.translate(-0.8, 0, 0.4);
}else if(type == TransformType.GROUND || type == TransformType.FIRST_PERSON_RIGHT_HAND){
GlStateManager.translate(-0.5, 0, 0.5);
GlStateManager.rotate(-45, 0, 1, 0);
}
GlStateManager.translate(-0.5, -0.5, -0.5);
int color = ItemNBTHelper.getInteger(stack, "FlagColor", Color.WHITE.getRGB());
TagManager.getInstance().renderFlag(color, 90);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.popMatrix();
}
示例15: renderSpawner
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; //导入依赖的package包/类
public void renderSpawner(CustomSpawnerBaseLogic baseLogic, double x, double y, double z, float partialTicks) {
Entity entity = baseLogic.getEntityForRenderer();
if (entity != null)
{
EntityEssenceInstance<?> essence = ItemMobEssence.getEssence(baseLogic.getEntityNameToSpawn());
if(essence == null){
return;
}
if (baseLogic.powered) partialTicks = 0f;
GlStateManager.pushMatrix();
entity.setWorld(baseLogic.getSpawnerWorld());
float f1 = 0.4375F * essence.getRenderScale(TransformType.NONE);
GlStateManager.translate(0.0F, 0.4F, 0.0F);
GlStateManager.rotate((float) (baseLogic.renderRotation1 + (baseLogic.renderRotation0 - baseLogic.renderRotation1) * partialTicks) * 10.0F, 0.0F, 1.0F, 0.0F);
//GlStateManager.rotate(-30.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(0.0F, -0.4F, 0.0F);
GlStateManager.scale(f1, f1, f1);
entity.setLocationAndAngles(x, y, z, 0.0F, 0.0F);
Minecraft.getMinecraft().getRenderManager().doRenderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, partialTicks, true);
GlStateManager.popMatrix();
}
}