mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-16 18:44:44 +00:00
Done with apothecaries for today >.>
This commit is contained in:
1 parent
b740a22684
commit
33a8d5e33c
90 files changed
+417
-181
No files matched your search
@@ -66,6 +66,11 @@ public class BotaniaStateProps {
|
||||
// BlockAlfPortal
|
||||
public static final PropertyEnum<AlfPortalState> ALFPORTAL_STATE = PropertyEnum.create("state", AlfPortalState.class);
|
||||
|
||||
// BlockAltar
|
||||
public static final PropertyEnum<AltarLiquidState> ALTAR_LIQUID_STATE = PropertyEnum.create("liquid", AltarLiquidState.class);
|
||||
public static final PropertyEnum<AltarVariant> ALTAR_VARIANT = PropertyEnum.create("variant", AltarVariant.class);
|
||||
public static final PropertyBool MOSSY = PropertyBool.create("mossy");
|
||||
|
||||
// BlockAltGrass
|
||||
public static final PropertyEnum<AltGrassVariant> ALTGRASS_VARIANT = PropertyEnum.create("variant", AltGrassVariant.class);
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package vazkii.botania.api.state.enums;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum AltarLiquidState implements IStringSerializable {
|
||||
NONE,
|
||||
WATER,
|
||||
LAVA;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package vazkii.botania.api.state.enums;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum AltarVariant implements IStringSerializable {
|
||||
DEFAULT,
|
||||
FOREST,
|
||||
PLAINS,
|
||||
MOUNTAIN,
|
||||
FUNGAL,
|
||||
SWAMP,
|
||||
DESERT,
|
||||
TAIGA,
|
||||
MESA;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import net.minecraftforge.fml.common.registry.GameData;
|
||||
import vazkii.botania.api.render.SpecialFlowerModel;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.AltGrassVariant;
|
||||
import vazkii.botania.api.state.enums.AltarVariant;
|
||||
import vazkii.botania.api.state.enums.BiomeBrickVariant;
|
||||
import vazkii.botania.api.state.enums.BiomeStoneVariant;
|
||||
import vazkii.botania.api.state.enums.CrateVariant;
|
||||
@@ -111,6 +112,7 @@ public final class ModelHandler {
|
||||
registerWalls();
|
||||
registerPanes();
|
||||
registerUnstableBeaconPetal();
|
||||
registerAltars();
|
||||
|
||||
/** Normal Items **/
|
||||
registerStandardItems();
|
||||
@@ -633,6 +635,16 @@ public final class ModelHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerAltars() {
|
||||
Item item = Item.getItemFromBlock(ModBlocks.altar);
|
||||
String name = GameData.getBlockRegistry().getNameForObject(ModBlocks.altar).toString();
|
||||
for (int i = 0; i < AltarVariant.values().length; i++) {
|
||||
String variantName = "liquid=none,mossy=false,variant=" + AltarVariant.values()[i].getName();
|
||||
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, variantName));
|
||||
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(name, variantName));
|
||||
}
|
||||
}
|
||||
|
||||
private static <T extends Enum<T> & IStringSerializable> void registerVariantsDefaulted(Block b, Class<T> enumclazz, String variantHeader) {
|
||||
Item item = Item.getItemFromBlock(b);
|
||||
for (T e : enumclazz.getEnumConstants()) {
|
||||
|
||||
@@ -62,11 +62,11 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(altar.isMossy ? textureMossy : textures[Math.min(textures.length - 1, forceMeta == -1 ? tileentity.getBlockMetadata() : forceMeta)]);
|
||||
//Minecraft.getMinecraft().renderEngine.bindTexture(altar.isMossy ? textureMossy : textures[Math.min(textures.length - 1, forceMeta == -1 ? tileentity.getBlockMetadata() : forceMeta)]);
|
||||
|
||||
GlStateManager.translate(d0 + 0.5, d1 + 1.5, d2 + 0.5);
|
||||
GlStateManager.scale(1F, -1F, -1F);
|
||||
model.render();
|
||||
//model.render();
|
||||
GlStateManager.scale(1F, -1F, -1F);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
|
||||
@@ -130,29 +130,7 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
// todo 1.8 this theoretically would be completely done in models and getActualState
|
||||
// Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
// Block block = lava ? Blocks.lava : Blocks.water;
|
||||
// int brightness = lava ? 240 : -1;
|
||||
// float alpha = lava ? 1F : 0.7F;
|
||||
//
|
||||
// GlStateManager.enableBlend();
|
||||
// GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
// GlStateManager.disableAlpha();
|
||||
// if(lava)
|
||||
// GlStateManager.disableLighting();
|
||||
// GlStateManager.color(1F, 1F, 1F, alpha);
|
||||
// GlStateManager.translate(w, -0.3F, w);
|
||||
// GlStateManager.rotate(90F, 1F, 0F, 0F);
|
||||
// GlStateManager.scale(s, s, s);
|
||||
//
|
||||
// renderIcon(0, 0, block.getIcon(0, 0), 16, 16, brightness);
|
||||
// if(lava)
|
||||
// GlStateManager.enableLighting();
|
||||
// GlStateManager.enableAlpha();
|
||||
// GlStateManager.disableBlend();
|
||||
// GlStateManager.popMatrix();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.BlockState;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -38,6 +38,9 @@ import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.AltarLiquidState;
|
||||
import vazkii.botania.api.state.enums.AltarVariant;
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.tile.TileAltar;
|
||||
@@ -63,6 +66,48 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
setBlockBounds(f, f, f, 1F - f, 1F / 16F * 20F, 1F - f);
|
||||
|
||||
random = new Random();
|
||||
|
||||
setDefaultState(blockState.getBaseState()
|
||||
.withProperty(BotaniaStateProps.MOSSY, false)
|
||||
.withProperty(BotaniaStateProps.ALTAR_LIQUID_STATE, AltarLiquidState.NONE)
|
||||
.withProperty(BotaniaStateProps.ALTAR_VARIANT, AltarVariant.DEFAULT)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlockState() {
|
||||
return new BlockState(this, BotaniaStateProps.ALTAR_LIQUID_STATE, BotaniaStateProps.ALTAR_VARIANT, BotaniaStateProps.MOSSY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(BotaniaStateProps.ALTAR_VARIANT).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
if (meta < 0 || meta >= AltarVariant.values().length) {
|
||||
meta = 0;
|
||||
}
|
||||
return getDefaultState().withProperty(BotaniaStateProps.ALTAR_VARIANT, AltarVariant.values()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
||||
TileEntity te = worldIn.getTileEntity(pos);
|
||||
if (te instanceof TileAltar) {
|
||||
TileAltar altar = ((TileAltar) te);
|
||||
if (altar.isMossy) {
|
||||
state = state.withProperty(BotaniaStateProps.MOSSY, true);
|
||||
}
|
||||
if (altar.hasLava()) {
|
||||
state = state.withProperty(BotaniaStateProps.ALTAR_LIQUID_STATE, AltarLiquidState.LAVA);
|
||||
}
|
||||
if (altar.hasWater()) {
|
||||
state = state.withProperty(BotaniaStateProps.ALTAR_LIQUID_STATE, AltarLiquidState.WATER);
|
||||
}
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -214,11 +259,6 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idAltar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileAltar();
|
||||
|
||||
Reference in new issue
Block a user