net.minecraft.client.renderer.block.model.ModelRotation Java Examples
The following examples show how to use
net.minecraft.client.renderer.block.model.ModelRotation.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GTModelWire.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
@SuppressWarnings({ "rawtypes", "unchecked" }) private List<BakedQuad> generateQuadsForSide(GTBlockBaseConnect wire, EnumFacing facing, int min, int max) { List<BakedQuad> quads = new ArrayList(); Pair<Vector3f, Vector3f> position = this.getPosForSide(facing, min, max); EnumFacing[] var7 = EnumFacing.VALUES; int var8 = var7.length; for (int var9 = 0; var9 < var8; ++var9) { EnumFacing side = var7[var9]; if (side.getOpposite() != facing) { BlockPartFace face = null; if (side == facing) { face = new BlockPartFace((EnumFacing) null, 0, "", new BlockFaceUV(new float[] { (float) min, (float) min, (float) max, (float) max }, 0)); } else if (facing.getAxis() == Axis.Z && side.getAxis() == Axis.X) { face = new BlockPartFace((EnumFacing) null, 0, "", new BlockFaceUV(new float[] { (float) max, (float) min, 16.0F, (float) max }, 0)); } else { face = this.getFace(facing, min, max); } // If you would like a different texture for connected sides, change the sprite // var to what you want quads.add(this.getBakery().makeBakedQuad((Vector3f) position.getKey(), (Vector3f) position.getValue(), face, wire.getTextureFromState(this.state, side), side, ModelRotation.X0_Y0, (BlockPartRotation) null, true, true)); } } return quads; }
Example #2
Source File: GTModelMortar.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void init() { this.quads = this.createList(7);// wut? this.setParticalTexture(bowlSprite); EnumFacing side; ModelRotation sideRotation; EnumFacing[] facings; int facingLength; int j; BlockPartFace face; facings = EnumFacing.VALUES; facingLength = facings.length; for (j = 0; j < facingLength; ++j) { side = facings[j]; sideRotation = ModelRotation.X0_Y0; face = this.createBottomLayerFace(side); this.quads[side.getIndex()].add(this.getBakery().makeBakedQuad(this.getMinBox(side, AABB_BOTTOMLAYER), this.getMaxBox(side, AABB_BOTTOMLAYER), face, bowlSprite, side, sideRotation, (BlockPartRotation) null, false, true)); face = this.createPostFace(side); this.quads[side.getIndex()].add(this.getBakery().makeBakedQuad(this.getMinBox(side, AABB_CENTERPOST), this.getMaxBox(side, AABB_CENTERPOST), face, postSprite, side, sideRotation, (BlockPartRotation) null, false, true)); face = this.createWallFaceEW(side); this.quads[side.getIndex()].add(this.getBakery().makeBakedQuad(this.getMinBox(side, AABB_WALL_EAST), this.getMaxBox(side, AABB_WALL_EAST), face, bowlSprite, side, sideRotation, (BlockPartRotation) null, false, true)); this.quads[side.getIndex()].add(this.getBakery().makeBakedQuad(this.getMinBox(side, AABB_WALL_WEST), this.getMaxBox(side, AABB_WALL_WEST), face, bowlSprite, side, sideRotation, (BlockPartRotation) null, false, true)); face = this.createWallFaceNS(side); this.quads[side.getIndex()].add(this.getBakery().makeBakedQuad(this.getMinBox(side, AABB_WALL_SOUTH), this.getMaxBox(side, AABB_WALL_SOUTH), face, bowlSprite, side, sideRotation, (BlockPartRotation) null, false, true)); this.quads[side.getIndex()].add(this.getBakery().makeBakedQuad(this.getMinBox(side, AABB_WALL_NORTH), this.getMaxBox(side, AABB_WALL_NORTH), face, bowlSprite, side, sideRotation, (BlockPartRotation) null, false, true)); } }
Example #3
Source File: GTModelWire.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@SuppressWarnings({ "rawtypes", "unchecked" }) private Map<EnumFacing, BakedQuad> generateCoreQuads(GTBlockBaseConnect wire, int min, int max) { Vector3f minF = new Vector3f((float) min, (float) min, (float) min); Vector3f maxF = new Vector3f((float) max, (float) max, (float) max); BlockPartFace face = new BlockPartFace((EnumFacing) null, 0, "", new BlockFaceUV(new float[] { (float) min, (float) min, (float) max, (float) max }, 0)); Map<EnumFacing, BakedQuad> quads = new EnumMap(EnumFacing.class); EnumFacing[] var8 = EnumFacing.VALUES; int var9 = var8.length; for (int var10 = 0; var10 < var9; ++var10) { EnumFacing side = var8[var10]; quads.put(side, this.getBakery().makeBakedQuad(minF, maxF, face, wire.getTextureFromState(this.state, side), side, ModelRotation.X0_Y0, (BlockPartRotation) null, true, true)); } return quads; }
Example #4
Source File: GTModelOre.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
public void init() { int layers = this.block.getLayers(this.meta); this.quads = this.createList(7); this.setParticalTexture(this.block.getParticleTexture(this.meta)); boolean color = this.block instanceof IGTColorBlock; EnumFacing blockFacing = EnumFacing.NORTH; ModelRotation rotation = ModelRotation.X0_Y0; for (int i = 0; i < layers; ++i) { AxisAlignedBB box = this.block.getRenderBox(this.meta, i); EnumFacing[] facings; int facingLength; int j; EnumFacing side; ModelRotation sideRotation; BlockPartFace face; TextureAtlasSprite sprite; facings = EnumFacing.VALUES; facingLength = facings.length; for (j = 0; j < facingLength; ++j) { side = facings[j]; sideRotation = this.getRotation(blockFacing, side, rotation); face = this.createBlockFace(side, i, color); sprite = this.block.getLayerTexture(this.meta, side, i); if (sprite != null) { this.quads[side.getIndex()].add(this.getBakery().makeBakedQuad(this.getMinBox(side, box), this.getMaxBox(side, box), face, sprite, side, sideRotation, (BlockPartRotation) null, false, true)); } } } }
Example #5
Source File: GTModelOre.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
protected ModelRotation getRotation(EnumFacing facing, EnumFacing side, ModelRotation defaultRotation) { if (facing.getAxis().isHorizontal() && side.getAxis().isVertical()) { return defaultRotation; } else { return facing.getAxis().isVertical() && side.getAxis() == Axis.X ? defaultRotation : ModelRotation.X0_Y0; } }
Example #6
Source File: GTModelBlock.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
public void init() { int layers = this.block.getLayers(this.meta); this.quads = this.createList(7); this.setParticalTexture(this.block.getParticleTexture(this.meta)); boolean color = this.block instanceof IGTColorBlock; EnumFacing blockFacing = EnumFacing.NORTH; ModelRotation rotation = ModelRotation.X0_Y0; for (int i = 0; i < layers; ++i) { AxisAlignedBB box = this.block.getRenderBox(this.meta, i); EnumFacing[] facings; int facingLength; int j; EnumFacing side; ModelRotation sideRotation; BlockPartFace face; TextureAtlasSprite sprite; facings = EnumFacing.VALUES; facingLength = facings.length; for (j = 0; j < facingLength; ++j) { side = facings[j]; sideRotation = this.getRotation(blockFacing, side, rotation); face = this.createBlockFace(side, i, color); sprite = this.block.getLayerTexture(this.meta, side, i); if (sprite != null) { this.quads[side.getIndex()].add(this.getBakery().makeBakedQuad(this.getMinBox(side, box), this.getMaxBox(side, box), face, sprite, side, sideRotation, (BlockPartRotation) null, false, true)); } } } }
Example #7
Source File: GTModelBlock.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
protected ModelRotation getRotation(EnumFacing facing, EnumFacing side, ModelRotation defaultRotation) { if (facing.getAxis().isHorizontal() && side.getAxis().isVertical()) { return defaultRotation; } else { return facing.getAxis().isVertical() && side.getAxis() == Axis.X ? defaultRotation : ModelRotation.X0_Y0; } }
Example #8
Source File: OrientationInfoGenerator.java From OpenModsLib with MIT License | 5 votes |
private static String modelRotationToJson(ModelRotation m) { final Matcher matcher = namePattern.matcher(m.name()); Preconditions.checkState(matcher.matches()); final String x = matcher.group(1); final String y = matcher.group(2); List<String> result = Lists.newArrayList(); if (!x.equals("0")) result.add("\"x\": " + x); if (!y.equals("0")) result.add("\"y\": " + y); return Joiner.on(", ").join(result); }
Example #9
Source File: OrientationInfoGenerator.java From OpenModsLib with MIT License | 5 votes |
private static Multimap<Orientation, ModelRotation> calculateVanillaRotations(Map<Matrix3f, Orientation> fromMatrix) { final Multimap<Orientation, ModelRotation> toVanilla = HashMultimap.create(); for (ModelRotation rot : ModelRotation.values()) { final Matrix4f rotMatrix = TRSRTransformation.toVecmath(rot.getMatrix4d()); final Matrix3f key = roundAndReduceMatrixElements(rotMatrix); final Orientation orientation = fromMatrix.get(key); Preconditions.checkNotNull(orientation, rot); toVanilla.put(orientation, rot); } return toVanilla; }
Example #10
Source File: BakedModelInserter.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public IModelState getDefaultState() { return ModelRotation.X0_Y0; }
Example #11
Source File: ModelCamouflageBlock.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public IModelState getDefaultState() { return ModelRotation.X0_Y0; }
Example #12
Source File: ModelNullifierBaked.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
private void addQuads(ModelNullifierBaked nullifierModel, boolean locked, ItemStack containedStack) { IBakedModel itemModel = null; IBakedModel textModel = null; if (containedStack.isEmpty() == false) { ItemType type = new ItemType(containedStack, true); itemModel = ITEM_MODEL_CACHE.get(type); if (itemModel == null) { IModel iModel = this.getItemModel(containedStack); if (iModel != null && iModel.getClass().getName().equals("net.minecraftforge.client.model.FancyMissingModel") == false) { TRSRTransformation trn = new TRSRTransformation(new javax.vecmath.Vector3f(-0.5f, -0.5f, -0.5f), null, null, null); TRSRTransformation trr = TRSRTransformation.from(ModelRotation.X0_Y180); TRSRTransformation trp = new TRSRTransformation(new javax.vecmath.Vector3f( 0.5f, 0.5f, 0.5f), null, null, null); TRSRTransformation trs = new TRSRTransformation(null, null, new javax.vecmath.Vector3f(0.6f, 0.6f, 0.6f), null); TRSRTransformation tr = trn.compose(trr).compose(trp).compose(trs); IModelState state = new ModelStateComposition(this.modelState, TRSRTransformation.blockCenterToCorner(tr)); itemModel = iModel.bake(state, this.format, this.bakedTextureGetter); } else { Minecraft mc = Minecraft.getMinecraft(); itemModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel(containedStack); itemModel = itemModel.getOverrides().handleItemState(itemModel, containedStack, mc.world, mc.player); } ITEM_MODEL_CACHE.put(type, itemModel); } } this.addQuadsForSide(null, nullifierModel, itemModel, textModel, locked); for (EnumFacing side : EnumFacing.values()) { this.addQuadsForSide(side, nullifierModel, itemModel, textModel, locked); } }
Example #13
Source File: OrientationInfoGenerator.java From OpenModsLib with MIT License | 4 votes |
public static void main(String[] args) throws IOException { OUTPUT_DIR.mkdirs(); final Map<Matrix3f, Orientation> fromMatrix = Maps.newHashMap(); for (Orientation o : Orientation.VALUES) fromMatrix.put(o.getLocalToWorldMatrix(), o); final Multimap<Orientation, ModelRotation> vanilla = calculateVanillaRotations(fromMatrix); final Multimap<Orientation, XYZRotation> xyz = calculateXyzRotations(fromMatrix); dumpOrientations(vanilla, xyz); for (BlockRotationMode brm : BlockRotationMode.values()) dumpBlockRotationsRotations(brm, vanilla, xyz); }