mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Lexicon now uses lexicon_elven model if elven knowledge is unlocked
This commit is contained in:
1 parent
f569048f40
commit
086e8acc2c
6 files changed
+29
-22
No files matched your search
@@ -8,34 +8,21 @@
|
||||
*/
|
||||
package vazkii.botania.client.core.handler;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.client.model.FloatingFlowerModel;
|
||||
import vazkii.botania.client.model.GunModel;
|
||||
import vazkii.botania.client.model.LexiconModel;
|
||||
import vazkii.botania.client.model.PlatformModel;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.item.ItemSparkUpgrade;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
|
||||
import vazkii.botania.common.item.relic.ItemKingKey;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.IntBuffer;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
public class MiscellaneousIcons {
|
||||
|
||||
@@ -98,7 +85,10 @@ public class MiscellaneousIcons {
|
||||
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:platform", "normal"), new PlatformModel());
|
||||
|
||||
// Lexicon
|
||||
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:lexicon", "inventory"), new LexiconModel());
|
||||
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:lexicon_3d_default", "inventory"),
|
||||
new LexiconModel(new ModelResourceLocation("botania:lexicon_default", "inventory")));
|
||||
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:lexicon_3d_elven", "inventory"),
|
||||
new LexiconModel(new ModelResourceLocation("botania:lexicon_elven", "inventory")));
|
||||
|
||||
// Mana Blaster
|
||||
ModelResourceLocation key = new ModelResourceLocation("botania:manaGun", "inventory");
|
||||
|
||||
@@ -17,18 +17,21 @@ import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix4f;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class LexiconModel implements IBakedModel {
|
||||
private final ModelResourceLocation path2D;
|
||||
|
||||
private static final ModelResourceLocation path = new ModelResourceLocation("botania:lexicon_default", "inventory");
|
||||
public LexiconModel(ModelResourceLocation path) {
|
||||
this.path2D = path;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
|
||||
IBakedModel original = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getModel(path);
|
||||
if((cameraTransformType == ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND
|
||||
|| cameraTransformType == ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND)
|
||||
&& ConfigHandler.lexicon3dModel)
|
||||
return Pair.of(this, null);
|
||||
IBakedModel original = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getModel(path2D);
|
||||
return original.handlePerspective(cameraTransformType);
|
||||
}
|
||||
|
||||
@@ -37,6 +40,6 @@ public class LexiconModel implements IBakedModel {
|
||||
@Override public boolean isGui3d() { return false; }
|
||||
@Override public boolean isBuiltInRenderer() { return false; }
|
||||
@Nonnull @Override public TextureAtlasSprite getParticleTexture() { return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("botania:items/lexicon"); }
|
||||
@Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
|
||||
@SuppressWarnings("deprecation") @Nonnull @Override public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; }
|
||||
@Nonnull @Override public ItemOverrideList getOverrides() { return ItemOverrideList.NONE; }
|
||||
}
|
||||
@@ -263,8 +263,16 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels() {
|
||||
ModelBakery.registerItemVariants(this, new ModelResourceLocation("botania:lexicon_default", "inventory"));
|
||||
ModelLoader.setCustomModelResourceLocation(this, 0, new ModelResourceLocation(getRegistryName(), "inventory"));
|
||||
// Load and bake the 2D models
|
||||
ModelBakery.registerItemVariants(this,
|
||||
new ModelResourceLocation("botania:lexicon_default", "inventory"),
|
||||
new ModelResourceLocation("botania:lexicon_elven", "inventory"));
|
||||
|
||||
ModelResourceLocation default3dPath = new ModelResourceLocation("botania:lexicon_3d_default", "inventory");
|
||||
ModelResourceLocation elven3dPath = new ModelResourceLocation("botania:lexicon_3d_elven", "inventory");
|
||||
|
||||
// smart model will dispatch between 2d/3d appropriately, see LexiconModel
|
||||
ModelLoader.setCustomMeshDefinition(this, stack -> isElvenItem(stack) ? elven3dPath : default3dPath);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "botania:items/lexicon"
|
||||
"layer0": "botania:items/lexicon0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "botania:items/lexicon1"
|
||||
}
|
||||
}
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Reference in new issue
Block a user