mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-18 11:19:28 +00:00
CleanUp, improven Crate Model, and add IModelState parameter to the model baker
This commit is contained in:
1 parent
03c1c26258
commit
898860975a
58 files changed
+282
-271
No files matched your search
@@ -14,6 +14,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -41,6 +42,8 @@ public interface IModelBaker {
|
||||
|
||||
void addFace(@Nonnull EnumFacing facing, @Nonnull TextureAtlasSprite sprite);
|
||||
|
||||
void setModelState(@Nullable IModelState modelState);
|
||||
|
||||
void setParticleSprite(@Nullable TextureAtlasSprite particleSprite);
|
||||
|
||||
IModelBakerModel bakeModel(boolean flip);
|
||||
|
||||
@@ -5,29 +5,27 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.SimpleBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IModelBakerModel extends IBakedModel {
|
||||
public interface IModelBakerModel extends IPerspectiveAwareModel {
|
||||
|
||||
void setGui3d(boolean gui3d);
|
||||
|
||||
void setAmbientOcclusion(boolean ambientOcclusion);
|
||||
|
||||
void setParticleSprite(TextureAtlasSprite particleSprite);
|
||||
void setParticleSprite(@Nullable TextureAtlasSprite particleSprite);
|
||||
|
||||
// void setFormat(VertexFormat formate);
|
||||
|
||||
void addQuad(EnumFacing facing, BakedQuad quad);
|
||||
void addQuad(@Nullable EnumFacing facing, @Nonnull BakedQuad quad);
|
||||
|
||||
void setRotation(float[] rotation);
|
||||
|
||||
@@ -35,6 +33,8 @@ public interface IModelBakerModel extends IBakedModel {
|
||||
|
||||
void setScale(float[] scale);
|
||||
|
||||
IModelState getModelState();
|
||||
|
||||
float[] getRotation();
|
||||
|
||||
float[] getTranslation();
|
||||
|
||||
@@ -31,8 +31,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -96,7 +94,6 @@ import forestry.apiculture.network.PacketRegistryApiculture;
|
||||
import forestry.apiculture.proxy.ProxyApiculture;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.apiculture.tiles.TileHive;
|
||||
import forestry.apiculture.trigger.ApicultureTriggers;
|
||||
import forestry.apiculture.worldgen.HiveDecorator;
|
||||
import forestry.apiculture.worldgen.HiveDescription;
|
||||
import forestry.apiculture.worldgen.HiveGenHelper;
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.List;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.trigger;
|
||||
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class ApicultureTriggers {
|
||||
// public static Trigger noFrames;
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.trigger;
|
||||
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
public class TriggerNoFrames {//extends Trigger {
|
||||
|
||||
// public TriggerNoFrames() {
|
||||
|
||||
@@ -20,8 +20,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType;
|
||||
import net.minecraftforge.event.terraingen.TerrainGen;
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
package forestry.arboriculture.blocks.property;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -15,8 +15,6 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
|
||||
import forestry.arboriculture.blocks.TreeTypePredicate;
|
||||
|
||||
@@ -15,8 +15,6 @@ import java.util.EnumSet;
|
||||
import net.minecraft.init.Biomes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.arboriculture.EnumGrowthConditions;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
@@ -55,7 +55,6 @@ import forestry.arboriculture.genetics.alleles.AlleleFruit;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.genetics.Chromosome;
|
||||
import forestry.core.genetics.Individual;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
public class Tree extends Individual implements ITree, IPlantable {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ItemBlockWoodDoor extends ItemBlockWood<BlockArbDoor> {
|
||||
}
|
||||
|
||||
if (playerIn.canPlayerEdit(pos, facing, stack) && this.block.canPlaceBlockAt(worldIn, pos)) {
|
||||
EnumFacing enumfacing = EnumFacing.fromAngle((double) playerIn.rotationYaw);
|
||||
EnumFacing enumfacing = EnumFacing.fromAngle(playerIn.rotationYaw);
|
||||
int x = enumfacing.getFrontOffsetX();
|
||||
int z = enumfacing.getFrontOffsetZ();
|
||||
boolean isRightHinge = x < 0 && hitZ < 0.5F || x > 0 && hitZ > 0.5F || z < 0 && hitX > 0.5F || z > 0 && hitX < 0.5F;
|
||||
|
||||
@@ -10,16 +10,23 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.models;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
@@ -28,49 +35,63 @@ import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.arboriculture.blocks.BlockDecorativeLeaves;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
import forestry.core.models.ModelBlockOverlay;
|
||||
import forestry.core.models.ModelBlockDefault;
|
||||
import forestry.core.models.baker.ModelBaker;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.TextureManager;
|
||||
|
||||
public class ModelDecorativeLeaves extends ModelBlockOverlay<BlockDecorativeLeaves> {
|
||||
public class ModelDecorativeLeaves extends ModelBlockDefault<BlockDecorativeLeaves> {
|
||||
|
||||
public ModelDecorativeLeaves() {
|
||||
super(BlockDecorativeLeaves.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
IModelBaker baker = new ModelBaker();
|
||||
|
||||
// @Override
|
||||
// public IBakedModel handleBlockState(IBlockState state) {
|
||||
// IModelBaker baker = new ModelBaker();
|
||||
//
|
||||
// Block block = state.getBlock();
|
||||
// if (!blockClass.isInstance(block)) {
|
||||
// return null;
|
||||
// }
|
||||
// BlockDecorativeLeaves bBlock = blockClass.cast(block);
|
||||
// TreeDefinition tree = state.getValue(bBlock.getVariant());
|
||||
//
|
||||
// baker.setRenderBoundsFromBlock(block);
|
||||
// bakeBlock(bBlock, tree, baker);
|
||||
//
|
||||
// return latestBlockModel = baker.bakeModel(false);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IBakedModel handleItemState(ItemStack stack) {
|
||||
// IModelBaker baker = new ModelBaker();
|
||||
// Block block = Block.getBlockFromItem(stack.getItem());
|
||||
// if (!blockClass.isInstance(block)) {
|
||||
// return null;
|
||||
// }
|
||||
// BlockDecorativeLeaves bBlock = blockClass.cast(block);
|
||||
// TreeDefinition tree = bBlock.getTreeType(stack.getMetadata());
|
||||
//
|
||||
// baker.setRenderBoundsFromBlock(block);
|
||||
// bakeBlock(bBlock, tree, baker);
|
||||
//
|
||||
// return latestItemModel = baker.bakeModel(true);
|
||||
// }
|
||||
Block block = state.getBlock();
|
||||
if (!blockClass.isInstance(block)) {
|
||||
return null;
|
||||
}
|
||||
BlockDecorativeLeaves bBlock = blockClass.cast(block);
|
||||
TreeDefinition tree = state.getValue(bBlock.getVariant());
|
||||
|
||||
baker.setRenderBounds(Block.FULL_BLOCK_AABB);
|
||||
bakeBlock(bBlock, tree, baker);
|
||||
|
||||
blockModel = baker.bakeModel(false);
|
||||
return blockModel.getQuads(state, side, rand);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemOverrideList createOverrides() {
|
||||
return new LeaveOverideList();
|
||||
}
|
||||
|
||||
private class LeaveOverideList extends ItemOverrideList{
|
||||
|
||||
public LeaveOverideList() {
|
||||
super(Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) {
|
||||
IModelBaker baker = new ModelBaker();
|
||||
Block block = Block.getBlockFromItem(stack.getItem());
|
||||
if (!blockClass.isInstance(block)) {
|
||||
return null;
|
||||
}
|
||||
BlockDecorativeLeaves bBlock = blockClass.cast(block);
|
||||
TreeDefinition tree = bBlock.getTreeType(stack.getMetadata());
|
||||
|
||||
baker.setRenderBounds(Block.FULL_BLOCK_AABB);
|
||||
bakeBlock(bBlock, tree, baker);
|
||||
|
||||
return itemModel = baker.bakeModel(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bakeInventoryBlock(@Nonnull BlockDecorativeLeaves block, @Nonnull ItemStack item, @Nonnull IModelBaker baker) {
|
||||
|
||||
@@ -25,11 +25,11 @@ import forestry.arboriculture.blocks.BlockForestryLeaves;
|
||||
import forestry.arboriculture.genetics.TreeRoot;
|
||||
import forestry.arboriculture.items.ItemBlockLeaves;
|
||||
import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.core.models.ModelBlockOverlay;
|
||||
import forestry.core.models.ModelBlockDefault;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
public class ModelLeaves extends ModelBlockOverlay<BlockForestryLeaves> {
|
||||
public class ModelLeaves extends ModelBlockDefault<BlockForestryLeaves> {
|
||||
|
||||
public ModelLeaves() {
|
||||
super(BlockForestryLeaves.class);
|
||||
|
||||
@@ -17,7 +17,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.core.models.ModelManager;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.block.properties.IProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleProperty;
|
||||
|
||||
@@ -17,9 +17,7 @@ import java.util.List;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.PlayerNotFoundException;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.Style;
|
||||
|
||||
@@ -12,7 +12,6 @@ package forestry.core.commands;
|
||||
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@ import java.util.List;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.PlayerNotFoundException;
|
||||
import net.minecraft.command.WrongUsageException;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
@@ -82,9 +82,9 @@ public class BlockForestryFluid extends BlockFluidClassic implements IItemModelR
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
|
||||
double d0 = (double) pos.getX();
|
||||
double d1 = (double) pos.getY();
|
||||
double d2 = (double) pos.getZ();
|
||||
double d0 = pos.getX();
|
||||
double d1 = pos.getY();
|
||||
double d2 = pos.getZ();
|
||||
|
||||
if (this.blockMaterial == Material.WATER) {
|
||||
int i = stateIn.getValue(LEVEL);
|
||||
@@ -94,15 +94,15 @@ public class BlockForestryFluid extends BlockFluidClassic implements IItemModelR
|
||||
worldIn.playSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, SoundEvents.BLOCK_WATER_AMBIENT, SoundCategory.BLOCKS, rand.nextFloat() * 0.25F + 0.75F, rand.nextFloat() + 0.5F, false);
|
||||
}
|
||||
} else if (rand.nextInt(10) == 0) {
|
||||
worldIn.spawnParticle(EnumParticleTypes.SUSPENDED, d0 + (double) rand.nextFloat(), d1 + (double) rand.nextFloat(), d2 + (double) rand.nextFloat(), 0.0D, 0.0D, 0.0D);
|
||||
worldIn.spawnParticle(EnumParticleTypes.SUSPENDED, d0 + rand.nextFloat(), d1 + rand.nextFloat(), d2 + rand.nextFloat(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.blockMaterial == Material.LAVA && worldIn.getBlockState(pos.up()).getMaterial() == Material.AIR && !worldIn.getBlockState(pos.up()).isOpaqueCube()) {
|
||||
if (rand.nextInt(100) == 0) {
|
||||
double d8 = d0 + (double) rand.nextFloat();
|
||||
double d8 = d0 + rand.nextFloat();
|
||||
double d4 = d1 + stateIn.getBoundingBox(worldIn, pos).maxY;
|
||||
double d6 = d2 + (double) rand.nextFloat();
|
||||
double d6 = d2 + rand.nextFloat();
|
||||
worldIn.spawnParticle(EnumParticleTypes.LAVA, d8, d4, d6, 0.0D, 0.0D, 0.0D);
|
||||
worldIn.playSound(d8, d4, d6, SoundEvents.BLOCK_LAVA_POP, SoundCategory.BLOCKS, 0.2F + rand.nextFloat() * 0.2F, 0.9F + rand.nextFloat() * 0.15F, false);
|
||||
}
|
||||
@@ -116,9 +116,9 @@ public class BlockForestryFluid extends BlockFluidClassic implements IItemModelR
|
||||
Material material = worldIn.getBlockState(pos.down(2)).getMaterial();
|
||||
|
||||
if (!material.blocksMovement() && !material.isLiquid()) {
|
||||
double px = d0 + (double) rand.nextFloat();
|
||||
double px = d0 + rand.nextFloat();
|
||||
double py = d1 - 1.05D;
|
||||
double pz = d2 + (double) rand.nextFloat();
|
||||
double pz = d2 + rand.nextFloat();
|
||||
|
||||
EntityFX fx = new EntityFXColoredDripParticle(worldIn, px, py, pz, color.getRed(), color.getGreen(), color.getBlue());
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
|
||||
|
||||
@@ -20,7 +20,6 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.RenderItem;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
-1
@@ -18,7 +18,6 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import forestry.core.inventory.filters.IStackFilter;
|
||||
import forestry.core.inventory.iterators.IInvSlot;
|
||||
import forestry.core.inventory.iterators.InventoryIterator;
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import java.util.List;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.inventory.filters.IStackFilter;
|
||||
import forestry.core.inventory.iterators.IExtInvSlot;
|
||||
import forestry.core.inventory.iterators.InventoryIterator;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
|
||||
@@ -82,8 +82,7 @@ public class ItemCrated extends ItemForestry implements IItemColor {
|
||||
manager.registerItemModel(item, 0);
|
||||
manager.registerItemModel(item, 1, "crate-filled");
|
||||
} else {
|
||||
String itemName = ItemStackUtil.getItemNameFromRegistry(item).getResourcePath();
|
||||
ModelResourceLocation modelLocation = new ModelResourceLocation("forestry:crate-filled", itemName);
|
||||
ModelResourceLocation modelLocation = new ModelResourceLocation("forestry:crate-filled", "crate-filled");
|
||||
ModelLoader.setCustomModelResourceLocation(item, 0, modelLocation);
|
||||
ModelBakery.registerItemVariants(item, modelLocation);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package forestry.core.items;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.core.models.ModelManager;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
|
||||
@@ -25,14 +25,23 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class BlankItemModel implements IBakedModel {
|
||||
protected ItemOverrideList overrideList;
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
protected ItemOverrideList createOverrides(){
|
||||
return new ItemOverrideList(Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
return new ItemOverrideList(Collections.emptyList());
|
||||
if(overrideList == null){
|
||||
overrideList = createOverrides();
|
||||
}
|
||||
return overrideList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+35
-40
@@ -39,84 +39,79 @@ import forestry.core.models.baker.ModelBaker;
|
||||
/**
|
||||
* A overlay block model to make a block with 2 or more texture layers
|
||||
*/
|
||||
public abstract class ModelBlockOverlay<B extends Block> implements IBakedModel {
|
||||
public abstract class ModelBlockDefault<B extends Block> implements IBakedModel {
|
||||
private ItemOverrideList overrideList;
|
||||
@Nonnull
|
||||
protected final Class<B> blockClass;
|
||||
protected IModelBakerModel latestBlockModel;
|
||||
protected IModelBakerModel latestItemModel;
|
||||
protected IModelBakerModel blockModel;
|
||||
protected IModelBakerModel itemModel;
|
||||
|
||||
protected ModelBlockOverlay(@Nonnull Class<B> blockClass) {
|
||||
protected ModelBlockDefault(@Nonnull Class<B> blockClass) {
|
||||
this.blockClass = blockClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
IModelBaker baker = new ModelBaker();
|
||||
IExtendedBlockState stateExtended = (IExtendedBlockState) state;
|
||||
|
||||
IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
|
||||
Block block = state.getBlock();
|
||||
if (!blockClass.isInstance(block)) {
|
||||
return null;
|
||||
if(state instanceof IExtendedBlockState){
|
||||
IModelBaker baker = new ModelBaker();
|
||||
IExtendedBlockState stateExtended = (IExtendedBlockState) state;
|
||||
|
||||
IBlockAccess world = stateExtended.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = stateExtended.getValue(UnlistedBlockPos.POS);
|
||||
Block block = state.getBlock();
|
||||
if (!blockClass.isInstance(block)) {
|
||||
return null;
|
||||
}
|
||||
B bBlock = blockClass.cast(block);
|
||||
|
||||
baker.setRenderBounds(block.getBoundingBox(state, world, pos));
|
||||
bakeWorldBlock(bBlock, world, pos, stateExtended, baker);
|
||||
|
||||
blockModel = baker.bakeModel(false);
|
||||
return blockModel.getQuads(state, side, rand);
|
||||
}
|
||||
B bBlock = blockClass.cast(block);
|
||||
|
||||
baker.setRenderBounds(block.getBoundingBox(state, world, pos));
|
||||
bakeWorldBlock(bBlock, world, pos, stateExtended, baker);
|
||||
|
||||
latestBlockModel = baker.bakeModel(false);
|
||||
return latestBlockModel.getQuads(state, side, rand);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion() {
|
||||
if(latestItemModel == null && latestBlockModel == null) {
|
||||
if(itemModel == null && blockModel == null) {
|
||||
return false;
|
||||
}
|
||||
return latestBlockModel != null ? latestBlockModel.isAmbientOcclusion() : latestItemModel.isAmbientOcclusion();
|
||||
return blockModel != null ? blockModel.isAmbientOcclusion() : itemModel.isAmbientOcclusion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGui3d() {
|
||||
return latestItemModel.isGui3d();
|
||||
return itemModel.isGui3d();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer() {
|
||||
if(latestItemModel == null && latestBlockModel == null) {
|
||||
if(itemModel == null && blockModel == null) {
|
||||
return false;
|
||||
}
|
||||
return latestBlockModel != null ? latestBlockModel.isBuiltInRenderer() : latestItemModel.isBuiltInRenderer();
|
||||
return blockModel != null ? blockModel.isBuiltInRenderer() : itemModel.isBuiltInRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
if(latestBlockModel != null) {
|
||||
return latestBlockModel.getParticleTexture();
|
||||
if(blockModel != null) {
|
||||
return blockModel.getParticleTexture();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemCameraTransforms getItemCameraTransforms() {
|
||||
if(latestItemModel == null) {
|
||||
if(itemModel == null) {
|
||||
return null;
|
||||
}
|
||||
return latestItemModel.getItemCameraTransforms();
|
||||
return itemModel.getItemCameraTransforms();
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public VertexFormat getFormat() {
|
||||
// if(latestItemModel == null && latestBlockModel == null) {
|
||||
// return DefaultVertexFormats.BLOCK;
|
||||
// }
|
||||
// return latestBlockModel != null ? latestBlockModel.getFormat() : latestItemModel.getFormat();
|
||||
// }
|
||||
|
||||
protected ItemOverrideList createOverrides() {
|
||||
return new OverlayItemOverrideList();
|
||||
return new DefaultItemOverrideList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -131,8 +126,8 @@ public abstract class ModelBlockOverlay<B extends Block> implements IBakedModel
|
||||
|
||||
protected abstract void bakeWorldBlock(@Nonnull B block, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull IExtendedBlockState stateExtended, @Nonnull IModelBaker baker);
|
||||
|
||||
private class OverlayItemOverrideList extends ItemOverrideList {
|
||||
public OverlayItemOverrideList() {
|
||||
private class DefaultItemOverrideList extends ItemOverrideList {
|
||||
public DefaultItemOverrideList() {
|
||||
super(Collections.emptyList());
|
||||
}
|
||||
|
||||
@@ -148,7 +143,7 @@ public abstract class ModelBlockOverlay<B extends Block> implements IBakedModel
|
||||
baker.setRenderBounds(block.getBoundingBox(block.getStateFromMeta(stack.getItemDamage()), world, null));
|
||||
bakeInventoryBlock(bBlock, stack, baker);
|
||||
|
||||
return latestItemModel = baker.bakeModel(true);
|
||||
return itemModel = baker.bakeModel(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,8 @@
|
||||
package forestry.core.models;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import javax.vecmath.Vector3f;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.Closeable;
|
||||
@@ -28,7 +23,6 @@ import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -37,18 +31,12 @@ import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverride;
|
||||
import net.minecraft.client.renderer.block.model.ModelBlock;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.model.MultipartBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -58,16 +46,10 @@ import net.minecraftforge.client.ItemModelMesherForge;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.MultiModel;
|
||||
import net.minecraftforge.client.model.SimpleModelState;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.core.items.ItemCrated;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
@@ -192,7 +174,7 @@ public class ModelCrate extends BlankItemModel {
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(reader);
|
||||
IOUtils.closeQuietly((Closeable)iresource);
|
||||
IOUtils.closeQuietly(iresource);
|
||||
}
|
||||
|
||||
return model;
|
||||
@@ -210,12 +192,12 @@ public class ModelCrate extends BlankItemModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
public ItemOverrideList createOverrides() {
|
||||
return new CrateOverrideList();
|
||||
}
|
||||
|
||||
private class CrateOverrideList extends ItemOverrideList{
|
||||
|
||||
|
||||
public CrateOverrideList() {
|
||||
super(Collections.emptyList());
|
||||
}
|
||||
@@ -234,7 +216,7 @@ public class ModelCrate extends BlankItemModel {
|
||||
ObfuscationReflectionHelper.setPrivateValue(BakedQuad.class, quad, 100, 1);
|
||||
}
|
||||
|
||||
crates.put(crateUID, new IPerspectiveAwareModel.MapWrapper(new CrateBakedModel( bakeContentModels(crated, baseBaked)), getTransformations()));
|
||||
crates.put(crateUID, new IPerspectiveAwareModel.MapWrapper(new CrateBakedModel( bakeContentModels(crated, baseBaked)), ModelManager.getInstance().DEFAULT_ITEM));
|
||||
}
|
||||
return crates.get(crateUID);
|
||||
}
|
||||
@@ -259,35 +241,6 @@ public class ModelCrate extends BlankItemModel {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static IModelState getTransformations() {
|
||||
TRSRTransformation thirdperson = get(0, 3, 1, 0, 0, 0, 0.55f);
|
||||
TRSRTransformation firstperson = get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f);
|
||||
ImmutableMap.Builder<TransformType, TRSRTransformation> builder = ImmutableMap.builder();
|
||||
builder.put(TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f));
|
||||
builder.put(TransformType.HEAD, get(0, 13, 7, 0, 180, 0, 1));
|
||||
builder.put(TransformType.THIRD_PERSON_RIGHT_HAND, thirdperson);
|
||||
builder.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(thirdperson));
|
||||
builder.put(TransformType.FIRST_PERSON_RIGHT_HAND, firstperson);
|
||||
builder.put(TransformType.FIRST_PERSON_LEFT_HAND, leftify(firstperson));
|
||||
return new SimpleModelState(builder.build());
|
||||
}
|
||||
|
||||
private static TRSRTransformation get(float tx, float ty, float tz, float ax, float ay, float az, float s)
|
||||
{
|
||||
return TRSRTransformation.blockCenterToCorner(new TRSRTransformation(
|
||||
new Vector3f(tx / 16, ty / 16, tz / 16),
|
||||
TRSRTransformation.quatFromXYZDegrees(new Vector3f(ax, ay, az)),
|
||||
new Vector3f(s, s, s),
|
||||
null));
|
||||
}
|
||||
|
||||
private static final TRSRTransformation flipX = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null);
|
||||
|
||||
private static TRSRTransformation leftify(TRSRTransformation transform)
|
||||
{
|
||||
return TRSRTransformation.blockCenterToCorner(flipX.compose(TRSRTransformation.blockCornerToCenter(transform)).compose(flipX));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGui3d() {
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
package forestry.core.models;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Vector3f;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,6 +24,7 @@ import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
@@ -30,6 +35,9 @@ import net.minecraft.util.registry.IRegistry;
|
||||
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.SimpleModelState;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -53,6 +61,41 @@ public class ModelManager implements IModelManager {
|
||||
private final List<IBlockColor> blockColorList = new ArrayList<>();
|
||||
private final List<IItemColor> itemColorList = new ArrayList<>();
|
||||
|
||||
private TRSRTransformation flipX = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null);
|
||||
public final IModelState DEFAULT_BLOCK;
|
||||
public final IModelState DEFAULT_ITEM;
|
||||
public final IModelState DEFAULT_TOOL;
|
||||
|
||||
public ModelManager() {
|
||||
TRSRTransformation blockThirdperson = get(0, 2.5f, 0, 75, 45, 0, 0.375f);
|
||||
ImmutableMap.Builder<TransformType, TRSRTransformation> blockBuilder = ImmutableMap.builder();
|
||||
blockBuilder.put(TransformType.GUI, get(0, 0, 0, 30, 225, 0, 0.625f));
|
||||
blockBuilder.put(TransformType.GROUND, get(0, 3, 0, 0, 0, 0, 0.25f));
|
||||
blockBuilder.put(TransformType.FIXED, get(0, 0, 0, 0, 0, 0, 0.5f));
|
||||
blockBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, blockThirdperson);
|
||||
blockBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(blockThirdperson));
|
||||
blockBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, get(0, 0, 0, 0, 45, 0, 0.4f));
|
||||
blockBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, get(0, 0, 0, 0, 225, 0, 0.4f));
|
||||
DEFAULT_BLOCK = new SimpleModelState(blockBuilder.build());
|
||||
|
||||
TRSRTransformation itemThirdperson = get(0, 3, 1, 0, 0, 0, 0.55f);
|
||||
TRSRTransformation firstperson = get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f);
|
||||
ImmutableMap.Builder<TransformType, TRSRTransformation> itemBuilder = ImmutableMap.builder();
|
||||
itemBuilder.put(TransformType.GROUND, get(0, 2, 0, 0, 0, 0, 0.5f));
|
||||
itemBuilder.put(TransformType.HEAD, get(0, 13, 7, 0, 180, 0, 1));
|
||||
itemBuilder.put(TransformType.THIRD_PERSON_RIGHT_HAND, itemThirdperson);
|
||||
itemBuilder.put(TransformType.THIRD_PERSON_LEFT_HAND, leftify(itemThirdperson));
|
||||
itemBuilder.put(TransformType.FIRST_PERSON_RIGHT_HAND, firstperson);
|
||||
itemBuilder.put(TransformType.FIRST_PERSON_LEFT_HAND, leftify(firstperson));
|
||||
DEFAULT_ITEM = new SimpleModelState(itemBuilder.build());
|
||||
|
||||
DEFAULT_TOOL = new SimpleModelState(ImmutableMap.of(
|
||||
TransformType.THIRD_PERSON_RIGHT_HAND, get(0, 4, 0.5f, 0, -90, 55, 0.85f),
|
||||
TransformType.THIRD_PERSON_LEFT_HAND, get(0, 4, 0.5f, 0, 90, -55, 0.85f),
|
||||
TransformType.FIRST_PERSON_RIGHT_HAND, get(1.13f, 3.2f, 1.13f, 0, -90, 25, 0.68f),
|
||||
TransformType.FIRST_PERSON_LEFT_HAND, get(1.13f, 3.2f, 1.13f, 0, 90, -25, 0.68f)));
|
||||
}
|
||||
|
||||
static {
|
||||
ForestryAPI.modelManager = instance;
|
||||
}
|
||||
@@ -60,6 +103,21 @@ public class ModelManager implements IModelManager {
|
||||
public static ModelManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private TRSRTransformation get(float tx, float ty, float tz, float ax, float ay, float az, float s){
|
||||
return TRSRTransformation.blockCenterToCorner(new TRSRTransformation(
|
||||
new Vector3f(tx / 16, ty / 16, tz / 16),
|
||||
TRSRTransformation.quatFromXYZDegrees(new Vector3f(ax, ay, az)),
|
||||
new Vector3f(s, s, s),
|
||||
null));
|
||||
}
|
||||
|
||||
private TRSRTransformation leftify(TRSRTransformation transform){
|
||||
if(flipX == null){
|
||||
flipX = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null);
|
||||
}
|
||||
return TRSRTransformation.blockCenterToCorner(flipX.compose(TRSRTransformation.blockCornerToCenter(transform)).compose(flipX));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerItemModel(Item item, int meta, String identifier) {
|
||||
|
||||
@@ -13,6 +13,8 @@ package forestry.core.models.baker;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -29,14 +31,13 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.api.core.IModelBakerModel;
|
||||
import forestry.core.models.ModelManager;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
/**
|
||||
@@ -48,10 +49,10 @@ public class ModelBaker implements IModelBaker {
|
||||
private static final float quadsUV[] = new float[]{0, 0, 1, 1, 0, 0, 1, 1};
|
||||
private final List<ModelBakerFace> faces = new ArrayList<>();
|
||||
private final List<IBakedModel> bakedModels = new ArrayList<>();
|
||||
|
||||
|
||||
protected AxisAlignedBB renderBounds;
|
||||
|
||||
protected ModelBakerModel currentModel = new ModelBakerModel();
|
||||
protected ModelBakerModel currentModel = new ModelBakerModel(ModelManager.getInstance().DEFAULT_BLOCK);
|
||||
|
||||
protected final FaceBakery faceBakery = new FaceBakery();
|
||||
|
||||
@@ -234,6 +235,11 @@ public class ModelBaker implements IModelBaker {
|
||||
|
||||
return currentModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setModelState(IModelState modelState){
|
||||
currentModel.setModelState(modelState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParticleSprite(TextureAtlasSprite particleSprite) {
|
||||
|
||||
@@ -12,14 +12,14 @@ package forestry.core.models.baker;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
/**
|
||||
* A face of a {@link ModelBakerModel }
|
||||
*/
|
||||
|
||||
@@ -11,21 +11,26 @@
|
||||
package forestry.core.models.baker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.vecmath.Matrix4f;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -33,41 +38,45 @@ import forestry.api.core.IModelBakerModel;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelBakerModel implements IModelBakerModel {
|
||||
private final List<IBakedModel> models;
|
||||
|
||||
private boolean isGui3d;
|
||||
private boolean isAmbientOcclusion;
|
||||
private VertexFormat format;
|
||||
private TextureAtlasSprite particleSprite;
|
||||
private IModelState modelState;
|
||||
private ImmutableMap<TransformType, TRSRTransformation> transforms;
|
||||
|
||||
private final Map<EnumFacing, List<BakedQuad>> faceQuads;
|
||||
private final List<BakedQuad> generalQuads;
|
||||
private final List<IBakedModel> models;
|
||||
|
||||
private float[] rotation = getDefaultRotation();
|
||||
private float[] translation = getDefaultTranslation();
|
||||
private float[] scale = getDefaultScale();
|
||||
|
||||
public ModelBakerModel() {
|
||||
public ModelBakerModel(IModelState modelState) {
|
||||
models = new ArrayList<>();
|
||||
faceQuads = new HashMap<>();
|
||||
generalQuads = new ArrayList<>();
|
||||
format = DefaultVertexFormats.BLOCK;
|
||||
isGui3d = true;
|
||||
isAmbientOcclusion = false;
|
||||
setModelState(modelState);
|
||||
|
||||
for(EnumFacing face : EnumFacing.VALUES){
|
||||
faceQuads.put(face, new ArrayList());
|
||||
}
|
||||
}
|
||||
|
||||
private ModelBakerModel(List<IBakedModel> models, Map<EnumFacing, List<BakedQuad>> faceQuads, List<BakedQuad> generalQuads, boolean isGui3d, boolean isAmbientOcclusion, VertexFormat format, float[] rotation, float[] translation, float[] scale, TextureAtlasSprite particleSprite) {
|
||||
private ModelBakerModel(List<IBakedModel> models, Map<EnumFacing, List<BakedQuad>> faceQuads, List<BakedQuad> generalQuads, boolean isGui3d, boolean isAmbientOcclusion, IModelState modelState, float[] rotation, float[] translation, float[] scale, TextureAtlasSprite particleSprite) {
|
||||
this.models = models;
|
||||
this.faceQuads = faceQuads;
|
||||
this.generalQuads = generalQuads;
|
||||
this.isGui3d = isGui3d;
|
||||
this.isAmbientOcclusion = isAmbientOcclusion;
|
||||
this.format = format;
|
||||
this.rotation = rotation;
|
||||
this.translation = translation;
|
||||
this.scale = scale;
|
||||
this.particleSprite = particleSprite;
|
||||
setModelState(modelState);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -156,6 +165,16 @@ public class ModelBakerModel implements IModelBakerModel {
|
||||
public float[] getScale() {
|
||||
return scale;
|
||||
}
|
||||
|
||||
public void setModelState(IModelState modelState) {
|
||||
this.modelState = modelState;
|
||||
this.transforms = MapWrapper.getTransforms(modelState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModelState getModelState() {
|
||||
return modelState;
|
||||
}
|
||||
|
||||
public void addModelQuads(IBakedModel model) {
|
||||
this.models.add(model);
|
||||
@@ -184,6 +203,12 @@ public class ModelBakerModel implements IModelBakerModel {
|
||||
}
|
||||
|
||||
public ModelBakerModel copy() {
|
||||
return new ModelBakerModel(models, faceQuads, generalQuads, isGui3d, isAmbientOcclusion, format, rotation, translation, scale, particleSprite);
|
||||
return new ModelBakerModel(models, faceQuads, generalQuads, isGui3d, isAmbientOcclusion, modelState, rotation, translation, scale, particleSprite);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective(TransformType cameraTransformType)
|
||||
{
|
||||
return MapWrapper.handlePerspective(this, transforms, cameraTransformType);
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@ import net.minecraftforge.common.animation.ITimeValue;
|
||||
import net.minecraftforge.common.model.animation.IAnimationStateMachine;
|
||||
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.items.ItemCrated;
|
||||
import forestry.core.models.BlockModelIndex;
|
||||
import forestry.core.models.ModelIndex;
|
||||
import forestry.core.tiles.TileBase;
|
||||
@@ -85,9 +84,6 @@ public class ProxyRender {
|
||||
public void registerModel(ModelIndex index) {
|
||||
}
|
||||
|
||||
public void registerModelCrate(ItemCrated crated) {
|
||||
}
|
||||
|
||||
public void registerStateMapper(Block block, IStateMapper mapper) {
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +48,7 @@ import forestry.core.entities.EntityFXIgnition;
|
||||
import forestry.core.entities.EntityFXSmoke;
|
||||
import forestry.core.entities.EntityFXSnow;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.items.ItemCrated;
|
||||
import forestry.core.models.BlockModelIndex;
|
||||
import forestry.core.models.ModelCrate;
|
||||
import forestry.core.models.ModelIndex;
|
||||
import forestry.core.models.ModelManager;
|
||||
import forestry.core.render.RenderAnalyzer;
|
||||
@@ -63,7 +61,6 @@ import forestry.core.tiles.TileBase;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
import forestry.core.tiles.TileMill;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class ProxyRenderClient extends ProxyRender {
|
||||
|
||||
@@ -137,13 +134,6 @@ public class ProxyRenderClient extends ProxyRender {
|
||||
ModelManager.getInstance().registerCustomModel(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerModelCrate(ItemCrated crate) {
|
||||
String cleanItemName = ItemStackUtil.getItemNameFromRegistry(crate).getResourcePath();
|
||||
ModelResourceLocation modelLocation = new ModelResourceLocation("forestry:crate-filled", cleanItemName);
|
||||
registerModel(new ModelIndex(modelLocation, new ModelCrate()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerFluidStateMapper(Block block, final Fluids forestryFluid) {
|
||||
final ModelResourceLocation fluidLocation = new ModelResourceLocation("forestry:blockforestryfluid",
|
||||
|
||||
@@ -25,7 +25,6 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -49,31 +48,31 @@ public class ParticleHelper {
|
||||
int z = pos.getZ();
|
||||
float f = 0.1F;
|
||||
AxisAlignedBB axisalignedbb = iblockstate.getBoundingBox(world, pos);
|
||||
double px = (double)x + world.rand.nextDouble() * (axisalignedbb.maxX - axisalignedbb.minX - (double)(f * 2.0F)) + (double)f + axisalignedbb.minX;
|
||||
double py = (double)y + world.rand.nextDouble() * (axisalignedbb.maxY - axisalignedbb.minY - (double)(f * 2.0F)) + (double)f + axisalignedbb.minY;
|
||||
double pz = (double)z + world.rand.nextDouble() * (axisalignedbb.maxZ - axisalignedbb.minZ - (double)(f * 2.0F)) + (double)f + axisalignedbb.minZ;
|
||||
double px = x + world.rand.nextDouble() * (axisalignedbb.maxX - axisalignedbb.minX - f * 2.0F) + f + axisalignedbb.minX;
|
||||
double py = y + world.rand.nextDouble() * (axisalignedbb.maxY - axisalignedbb.minY - f * 2.0F) + f + axisalignedbb.minY;
|
||||
double pz = z + world.rand.nextDouble() * (axisalignedbb.maxZ - axisalignedbb.minZ - f * 2.0F) + f + axisalignedbb.minZ;
|
||||
if(side == EnumFacing.DOWN) {
|
||||
py = (double)y + axisalignedbb.minY - (double)f;
|
||||
py = y + axisalignedbb.minY - f;
|
||||
}
|
||||
|
||||
if(side == EnumFacing.UP) {
|
||||
py = (double)y + axisalignedbb.maxY + (double)f;
|
||||
py = y + axisalignedbb.maxY + f;
|
||||
}
|
||||
|
||||
if(side == EnumFacing.NORTH) {
|
||||
pz = (double)z + axisalignedbb.minZ - (double)f;
|
||||
pz = z + axisalignedbb.minZ - f;
|
||||
}
|
||||
|
||||
if(side == EnumFacing.SOUTH) {
|
||||
pz = (double)z + axisalignedbb.maxZ + (double)f;
|
||||
pz = z + axisalignedbb.maxZ + f;
|
||||
}
|
||||
|
||||
if(side == EnumFacing.WEST) {
|
||||
px = (double)x + axisalignedbb.minX - (double)f;
|
||||
px = x + axisalignedbb.minX - f;
|
||||
}
|
||||
|
||||
if(side == EnumFacing.EAST) {
|
||||
px = (double)x + axisalignedbb.maxX + (double)f;
|
||||
px = x + axisalignedbb.maxX + f;
|
||||
}
|
||||
|
||||
EntityDiggingFX fx = (EntityDiggingFX) effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(), px, py, pz, 0.0D, 0.0D, 0.0D, Block.getStateId(iblockstate));
|
||||
|
||||
@@ -16,22 +16,17 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.GameData;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.ISpriteProvider;
|
||||
import forestry.api.core.ISpriteRegister;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.ITextureManager;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.widgets.SocketWidget;
|
||||
import forestry.core.render.EnumTankLevel;
|
||||
import forestry.energy.tiles.TileEngineElectric;
|
||||
|
||||
// TODO: IC2 for 1.9
|
||||
|
||||
@@ -10,9 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.energy.tiles;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
@@ -21,11 +18,6 @@ import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -40,7 +32,6 @@ import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.energy.gui.ContainerEnginePeat;
|
||||
import forestry.energy.gui.GuiEnginePeat;
|
||||
import forestry.energy.inventory.InventoryEnginePeat;
|
||||
import forestry.factory.triggers.FactoryTriggers;
|
||||
|
||||
public class TileEnginePeat extends TileEngine implements ISidedInventory {
|
||||
private Item fuelItem;
|
||||
|
||||
@@ -19,9 +19,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
|
||||
|
||||
import forestry.core.inventory.InventoryAdapterTile;
|
||||
import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
|
||||
@@ -11,12 +11,12 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.core.models.ModelBlockOverlay;
|
||||
import forestry.core.models.ModelBlockDefault;
|
||||
import forestry.farming.blocks.BlockFarm;
|
||||
import forestry.farming.blocks.EnumFarmBlockType;
|
||||
import forestry.farming.tiles.TileFarm;
|
||||
|
||||
public class ModelFarmBlock extends ModelBlockOverlay<BlockFarm> {
|
||||
public class ModelFarmBlock extends ModelBlockDefault<BlockFarm> {
|
||||
|
||||
public ModelFarmBlock() {
|
||||
super(BlockFarm.class);
|
||||
|
||||
@@ -12,7 +12,6 @@ package forestry.food;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BeverageEffectAntidote extends BeverageEffect {
|
||||
|
||||
@@ -12,7 +12,6 @@ package forestry.food;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ package forestry.food.items;
|
||||
|
||||
import net.minecraft.init.MobEffects;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ItemBlockGreenhouseDoor extends ItemBlockForestry<BlockGreenhouseDo
|
||||
}
|
||||
|
||||
if (playerIn.canPlayerEdit(pos, facing, stack) && this.block.canPlaceBlockAt(worldIn, pos)) {
|
||||
EnumFacing enumfacing = EnumFacing.fromAngle((double) playerIn.rotationYaw);
|
||||
EnumFacing enumfacing = EnumFacing.fromAngle(playerIn.rotationYaw);
|
||||
int i = enumfacing.getFrontOffsetX();
|
||||
int j = enumfacing.getFrontOffsetZ();
|
||||
boolean flag = i < 0 && hitZ < 0.5F || i > 0 && hitZ > 0.5F || j < 0 && hitX > 0.5F || j > 0 && hitX < 0.5F;
|
||||
|
||||
@@ -25,12 +25,12 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
import forestry.api.core.IModelBaker;
|
||||
import forestry.core.models.ModelBlockOverlay;
|
||||
import forestry.core.models.ModelBlockDefault;
|
||||
import forestry.core.utils.CamouflageUtil;
|
||||
import forestry.greenhouse.blocks.BlockGreenhouse;
|
||||
import forestry.greenhouse.blocks.BlockGreenhouseType;
|
||||
|
||||
public class ModelGreenhouse extends ModelBlockOverlay<BlockGreenhouse> {
|
||||
public class ModelGreenhouse extends ModelBlockDefault<BlockGreenhouse> {
|
||||
|
||||
public ModelGreenhouse() {
|
||||
super(BlockGreenhouse.class);
|
||||
|
||||
@@ -28,8 +28,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
@@ -40,23 +40,15 @@ import forestry.core.models.TRSRBakedModel;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelButterflyItem extends BlankItemModel {
|
||||
private ItemOverrideList overrideList;
|
||||
private final Function<ResourceLocation, TextureAtlasSprite> textureGetter = new DefaultTextureGetter();
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IRetexturableModel modelButterfly;
|
||||
|
||||
@Override
|
||||
protected ItemOverrideList createOverrides() {
|
||||
return new ButterflyItemOverrideList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
if (overrideList == null) {
|
||||
overrideList = createOverrides();
|
||||
}
|
||||
return overrideList;
|
||||
}
|
||||
|
||||
private IBakedModel bakeModel(IButterfly butterfly) {
|
||||
ImmutableMap.Builder<String, String> textures = ImmutableMap.builder();
|
||||
textures.put("butterfly", butterfly.getGenome().getSecondary().getItemTexture());
|
||||
|
||||
@@ -12,11 +12,7 @@ package forestry.lepidopterology.render;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.resources.data.AnimationMetadataSection;
|
||||
|
||||
public class TextureAtlasButterfly extends TextureAtlasSprite {
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ import forestry.mail.commands.CommandMail;
|
||||
import forestry.mail.items.EnumStampDefinition;
|
||||
import forestry.mail.items.ItemRegistryMail;
|
||||
import forestry.mail.network.PacketRegistryMail;
|
||||
import forestry.mail.triggers.MailTriggers;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
@@ -19,8 +19,6 @@ import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
|
||||
import forestry.api.mail.EnumAddressee;
|
||||
import forestry.api.mail.ILetter;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
|
||||
@@ -21,8 +21,6 @@ import net.minecraft.command.ICommand;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
|
||||
@@ -18,7 +18,6 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.core.items.ItemCrated;
|
||||
import forestry.core.models.ModelManager;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
@@ -37,7 +36,6 @@ public class CrateRegistry implements ICrateRegistry {
|
||||
crate.setUnlocalizedName(crateName);
|
||||
GameRegistry.registerItem(crate, crateName);
|
||||
Proxies.common.registerItem(crate);
|
||||
Proxies.render.registerModelCrate(crate);
|
||||
PluginStorage.registerCrate(crate);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -66,10 +67,14 @@ import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import forestry.storage.items.ItemRegistryStorage;
|
||||
import forestry.storage.proxy.ProxyStorage;
|
||||
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.STORAGE, name = "Storage", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.storage.description")
|
||||
public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
@SidedProxy(clientSide = "forestry.storage.proxy.ProxyStorageClient", serverSide = "forestry.storage.proxy.ProxyStorage")
|
||||
public static ProxyStorage proxy;
|
||||
|
||||
private static final List<ItemCrated> crates = new ArrayList<>();
|
||||
private static final String CONFIG_CATEGORY = "backpacks";
|
||||
|
||||
@@ -115,6 +120,8 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
definition = new BackpackDefinition(new Color(0xdd3a3a));
|
||||
BackpackManager.backpackInterface.registerBackpack(BackpackManager.BUILDER_UID, definition);
|
||||
|
||||
proxy.registerCrateModel();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package forestry.storage.proxy;
|
||||
|
||||
public class ProxyStorage {
|
||||
|
||||
public void registerCrateModel(){
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package forestry.storage.proxy;
|
||||
|
||||
import forestry.core.models.ModelCrate;
|
||||
import forestry.core.models.ModelIndex;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
|
||||
public class ProxyStorageClient extends ProxyStorage {
|
||||
|
||||
@Override
|
||||
public void registerCrateModel() {
|
||||
ModelResourceLocation modelLocation = new ModelResourceLocation("forestry:crate-filled", "crate-filled");
|
||||
Proxies.render.registerModel(new ModelIndex(modelLocation, new ModelCrate()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user