本文整理汇总了Java中net.minecraft.client.renderer.entity.RenderLivingBase类的典型用法代码示例。如果您正苦于以下问题:Java RenderLivingBase类的具体用法?Java RenderLivingBase怎么用?Java RenderLivingBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RenderLivingBase类属于net.minecraft.client.renderer.entity包,在下文中一共展示了RenderLivingBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRenderLiving
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@SideOnly(Side.CLIENT)
@Override
public void onRenderLiving(RenderLivingEvent.Pre event, RenderLivingBase renderer, int amplifier) {
GlStateManager.pushMatrix();
EnumDyeColor dye = EnumDyeColor.byDyeDamage(Math.min(amplifier, EnumDyeColor.values().length - 1));
int rgb = dye.getColorValue();
float r = (rgb >>> 16 & 0xFF) / 256.0F;
float g = (rgb >>> 8 & 0xFF) / 256.0F;
float b = (rgb & 0xFF) / 256.0F;
GlStateManager.color(r, g, b);
GlStateManager.popMatrix();
}
示例2: setupRenderer
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
/**
* Setup renderer
*
* This method is responsible for setting up any client side stuff like
* the renderer, texture of the entity and the "hands"
*/
@SideOnly(Side.CLIENT)
protected void setupRenderer()
{
this.renderer = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(this.entity);
if (this.renderer instanceof RenderLivingBase<?>)
{
ModelBase model = ((RenderLivingBase<?>) renderer).getMainModel();
if (this.customSettings && model instanceof ModelBiped || model instanceof ModelQuadruped)
{
this.settings.hands = true;
}
}
}
示例3: replaceEntriesInRenderPlayer
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
private static void replaceEntriesInRenderPlayer(RenderPlayer renderer, ModelPlayer newModel) {
if(renderer == null) {
return;
}
//replace relevant fields in RenderPlayer
for(Field field : RenderLivingBase.class.getDeclaredFields()) {
if(field.getType() == ModelBase.class) {
field.setAccessible(true);
try {
field.set(renderer, newModel);
} catch (IllegalAccessException e) {
InfinityLib.instance.getLogger().printStackTrace(e);
}
break;
}
}
}
示例4: replaceCapeLayer
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
private static void replaceCapeLayer(@Nonnull RenderPlayer renderLivingBase) {
try {
List<LayerRenderer<AbstractClientPlayer>> value = ReflectionHelper.getPrivateValue(RenderLivingBase.class, renderLivingBase, "layerRenderers",
"field_177097_h");
if (value != null) {
LayerRenderer<AbstractClientPlayer> capeLayer = null;
for (LayerRenderer<AbstractClientPlayer> layerRenderer : value) {
if (layerRenderer instanceof LayerCape && !(layerRenderer instanceof CapeFilterLayer)) {
capeLayer = layerRenderer;
break;
}
}
if (capeLayer != null) {
renderLivingBase.addLayer(new CapeFilterLayer(capeLayer));
value.remove(capeLayer);
}
}
} catch (UnableToAccessFieldException e) {
Log.warn("Unable to access RenderLivingBase.layerRenderers, reason: " + e);
}
}
示例5: preChildEntHeadRenderCalls
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
public void preChildEntHeadRenderCalls(E living, RenderLivingBase render)
{
if(living.isChild()) //I don't like this if statement any more than you do.
{
float modelScale = 0.0625F;
ModelBase model = render.getMainModel();
if(model instanceof ModelBiped)
{
GlStateManager.scale(0.75F, 0.75F, 0.75F);
GlStateManager.translate(0.0F, 16.0F * modelScale, 0.0F);
}
else if(model instanceof ModelQuadruped)
{
if(model instanceof ModelPolarBear)
{
GlStateManager.scale(0.6666667F, 0.6666667F, 0.6666667F);
}
GlStateManager.translate(0.0F, ((ModelQuadruped)model).childYOffset * modelScale, ((ModelQuadruped)model).childZOffset * modelScale);
}
else if(model instanceof ModelChicken)
{
GlStateManager.translate(0.0F, 5.0F * modelScale, 2.0F * modelScale);
}
}
}
示例6: preChildEntHeadRenderCalls
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
@Override
public void preChildEntHeadRenderCalls(AbstractHorse living, RenderLivingBase render)
{
if(living.isChild()) //I don't like this if statement any more than you do.
{
float modelScale = 0.0625F;
if(iChunUtil.config.horseEasterEgg == 1)
{
GlStateManager.scale(0.625F, 0.45454544F, 0.45454544F);
GlStateManager.translate(0.0F, 33.0F * modelScale, 0.0F);
}
else
{
GlStateManager.scale(0.71428573F, 0.64935064F, 0.7936508F);
GlStateManager.translate(0.0F, 21.0F * modelScale, 0.22F);
}
}
}
示例7: renderEnchantedGlint
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
@Inject(method = "renderEnchantedGlint", at = @At("HEAD"), cancellable = true)
private static void renderEnchantedGlint(RenderLivingBase<?> p_188364_0_, EntityLivingBase p_188364_1_, ModelBase model, float p_188364_3_, float p_188364_4_, float p_188364_5_, float p_188364_6_, float p_188364_7_, float p_188364_8_, float p_188364_9_, CallbackInfo ci) {
GlintEffectEvent event = new GlintEffectEvent(GlintEffectEvent.GlintTarget.ARMOR);
ClientAPI.EVENT_BUS.post(event);
if (event.isCancelled())
ci.cancel();
}
示例8: LayerWearables
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
public LayerWearables(RenderLivingBase<?> render, ModelBiped model) {
this.renderer = render;
this.head = model.bipedHead;
this.body = model.bipedBody;
this.modelBig = new ModelBiped(1.15F);
this.modelMedium = new ModelBiped(0.75F);
this.modelSmall = new ModelBiped(0.25F);
}
示例9: RenderLivingEvent
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
public RenderLivingEvent(EntityLivingBase entity, RenderLivingBase<T> renderer, double x, double y, double z)
{
this.entity = entity;
this.renderer = renderer;
this.x = x;
this.y = y;
this.z = z;
}
示例10: renderEnchantedGlint
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
public static void renderEnchantedGlint(RenderLivingBase<?> p_188364_0_, EntityLivingBase p_188364_1_, ModelBase model, float p_188364_3_, float p_188364_4_, float p_188364_5_, float p_188364_6_, float p_188364_7_, float p_188364_8_, float p_188364_9_)
{
float f = (float)p_188364_1_.ticksExisted + p_188364_5_;
p_188364_0_.bindTexture(ENCHANTED_ITEM_GLINT_RES);
GlStateManager.enableBlend();
GlStateManager.depthFunc(514);
GlStateManager.depthMask(false);
float f1 = 0.5F;
GlStateManager.color(0.5F, 0.5F, 0.5F, 1.0F);
for (int i = 0; i < 2; ++i)
{
GlStateManager.disableLighting();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_COLOR, GlStateManager.DestFactor.ONE);
float f2 = 0.76F;
GlStateManager.color(0.38F, 0.19F, 0.608F, 1.0F);
GlStateManager.matrixMode(5890);
GlStateManager.loadIdentity();
float f3 = 0.33333334F;
GlStateManager.scale(0.33333334F, 0.33333334F, 0.33333334F);
GlStateManager.rotate(30.0F - (float)i * 60.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(0.0F, f * (0.001F + (float)i * 0.003F) * 20.0F, 0.0F);
GlStateManager.matrixMode(5888);
model.render(p_188364_1_, p_188364_3_, p_188364_4_, p_188364_6_, p_188364_7_, p_188364_8_, p_188364_9_);
}
GlStateManager.matrixMode(5890);
GlStateManager.loadIdentity();
GlStateManager.matrixMode(5888);
GlStateManager.enableLighting();
GlStateManager.depthMask(true);
GlStateManager.depthFunc(515);
GlStateManager.disableBlend();
}
示例11: renderPlayer
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
/**
* Render player
*/
public void renderPlayer(EntityPlayer player, int x, int y, int scale)
{
EntityPlayerSP entity = (EntityPlayerSP) player;
RenderLivingBase<EntityPlayerSP> render = (RenderLivingBase<EntityPlayerSP>) this.mc.getRenderManager().getEntityRenderObject(entity);
ModelBase model = render.getMainModel();
model.isChild = false;
model.swingProgress = 0;
this.mc.renderEngine.bindTexture(entity.getLocationSkin());
GuiUtils.drawModel(model, player, x, y, scale);
}
示例12: replaceOldModel
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
public static void replaceOldModel() {
RenderPlayer renderer = getOldRenderer("default");
if(renderer == null) {
InfinityLib.instance.getLogger().debug("Failed overriding left arm swing behaviour");
return;
}
ModelPlayer oldModel = renderer.getMainModel();
ModelPlayer newModel = null;
for(Field field : RenderLivingBase.class.getDeclaredFields()) {
if(field.getType() == ModelBase.class) {
try {
field.setAccessible(true);
Object obj = field.get(renderer);
if (obj == oldModel) {
newModel = MODEL_MAIN;
field.set(renderer, newModel);
break;
}
} catch (Exception e) {
InfinityLib.instance.getLogger().printStackTrace(e);
}
}
}
if(newModel != null) {
//replace relevant fields in RenderPlayer
replaceEntriesInRenderPlayer(renderer, newModel);
replaceEntriesInRenderPlayer(getOldRenderer("slim"), MODEL_SLIM);
}
}
示例13: init
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
@Override
public void init (FMLInitializationEvent event) {
super.init(event);
registerRenders();
registerKeyBindings();
RenderLivingBase renderPlayer = Minecraft.getMinecraft().getRenderManager().getSkinMap().get("default");
renderPlayer.addLayer(new LayerRendererDrive(renderPlayer));
renderPlayer = Minecraft.getMinecraft().getRenderManager().getSkinMap().get("slim");
renderPlayer.addLayer(new LayerRendererDrive(renderPlayer));
MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityPedestal.class, new TESRPedestal());
}
示例14: WindowNewAction
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
public WindowNewAction(IWorkspace parent, int x, int y, int w, int h, int minW, int minH)
{
super(parent, x, y, w, h, minW, minH, "window.newAction.title", true);
elements.add(new ElementTextInput(this, 10, 30, width - 20, 12, 1, "window.newAction.name"));
elements.add(new ElementTextInput(this, 10, 135, width - 20, 12, 2, "window.newAction.playerName"));
ElementSelector selector = new ElementSelector(this, 10, 65, width - 20, 12, -2, "window.newAction.entityType", "EntityPlayer");
for(Object o : EntityList.NAME_TO_CLASS.values())
{
Class<? extends Entity> clz = (Class)o;
if(EntityLivingBase.class.isAssignableFrom(clz) && Minecraft.getMinecraft().getRenderManager().getEntityClassRenderObject(clz) instanceof RenderLivingBase)
{
selector.choices.put(clz.getSimpleName(), clz);
}
}
selector.choices.put(EntityPlayer.class.getSimpleName(), EntityPlayer.class);
selector.selected = EntityPlayer.class.getSimpleName();
elements.add(selector);
elements.add(new ElementCheckBox(this, 11, 89, -1, false, 0, 0, "window.newAction.preCreate", false));
elements.add(new ElementCheckBox(this, 11, 109, -2, false, 0, 0, "window.newAction.persist", false));
elements.add(new ElementButton(this, width - 140, height - 30, 60, 16, 100, false, 1, 1, "element.button.ok"));
elements.add(new ElementButton(this, width - 70, height - 30, 60, 16, 0, false, 1, 1, "element.button.cancel"));
}
示例15: ensureHasBackpackLayer
import net.minecraft.client.renderer.entity.RenderLivingBase; //导入依赖的package包/类
/** Ensures that the specified entity class' renderer has a backpack layer - if possible. */
public static void ensureHasBackpackLayer(Class<? extends EntityLivingBase> entityClass) {
if (!_hasLayerChecked.add(entityClass)) return;
RenderManager manager = Minecraft.getMinecraft().getRenderManager();
Render<?> render = manager.getEntityClassRenderObject(entityClass);
if (!(render instanceof RenderLivingBase)) return;
((RenderLivingBase<?>)render).addLayer(new RendererBackpack.Layer());
}