mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 19:29:31 +00:00
Floating Flower variants!
This commit is contained in:
1 parent
6535359231
commit
eb724c9a6b
9 files changed
+129
-8
No files matched your search
@@ -92,7 +92,6 @@ public final class LibResources {
|
||||
public static final String MODEL_ELEMENTIUM_1 = PREFIX_MODEL + "elementium1.png";
|
||||
public static final String MODEL_ELEMENTIUM_2 = PREFIX_MODEL + "elementium2.png";
|
||||
public static final String MODEL_PIXIE = PREFIX_MODEL + "pixie.png";
|
||||
public static final String MODEL_MINI_ISLAND = PREFIX_MODEL + "miniIsland.png";
|
||||
public static final String MODEL_TINY_POTATO = PREFIX_MODEL + "tinyPotato.png";
|
||||
public static final String MODEL_SPAWNER_CLAW = PREFIX_MODEL + "spawnerClaw.png";
|
||||
public static final String MODEL_BREWERY = PREFIX_MODEL + "brewery.png";
|
||||
@@ -104,8 +103,10 @@ public final class LibResources {
|
||||
public static final String MODEL_CORPOREA_INDEX = PREFIX_MODEL + "corporeaIndex.png";
|
||||
public static final String MODEL_INVISIBLE_ARMOR = PREFIX_MODEL + "invisibleArmor.png";
|
||||
public static final String MODEL_PUMP = PREFIX_MODEL + "pump.png";
|
||||
|
||||
public static final String MODEL_CAPE = "/assets/botania/textures/model/cape.png";
|
||||
public static final String MODEL_MINI_ISLAND = PREFIX_MODEL + "miniIsland.png";
|
||||
public static final String MODEL_MINI_ISLAND_PODZOL = PREFIX_MODEL + "miniIslandPodzol.png";
|
||||
public static final String MODEL_MINI_ISLAND_MYCEL = PREFIX_MODEL + "miniIslandMycelium.png";
|
||||
public static final String MODEL_MINI_ISLAND_SNOW = PREFIX_MODEL + "miniIslandSnow.png";
|
||||
|
||||
public static final String MISC_PARTICLES = PREFIX_MISC + "particles.png";
|
||||
public static final String MISC_WISP_LARGE = PREFIX_MISC + "wispLarge.png";
|
||||
|
||||
@@ -31,7 +31,6 @@ import vazkii.botania.common.block.decor.IFloatingFlower;
|
||||
|
||||
public class RenderTileFloatingFlower extends TileEntitySpecialRenderer {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_MINI_ISLAND);
|
||||
private static final ModelMiniIsland model = new ModelMiniIsland();
|
||||
|
||||
@Override
|
||||
@@ -54,7 +53,7 @@ public class RenderTileFloatingFlower extends TileEntitySpecialRenderer {
|
||||
GL11.glRotatef(4F * (float) Math.sin(worldTime * 0.04F), 1F, 0F, 0F);
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(flower.getIslandType().getResource());
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.5F, 1.4F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
|
||||
@@ -107,7 +107,7 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
return ((TileSpecialFlower) world.getTileEntity(x, y, z)).onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
|
||||
return ((TileSpecialFlower) world.getTileEntity(x, y, z)).onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ) || super.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
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;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -32,9 +33,13 @@ import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.BlockModContainer;
|
||||
import vazkii.botania.common.block.decor.IFloatingFlower.IslandType;
|
||||
import vazkii.botania.common.block.tile.TileFloatingFlower;
|
||||
import vazkii.botania.common.block.tile.TileSpecialFlower;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.integration.coloredlights.ColoredLightHelper;
|
||||
import vazkii.botania.common.item.ItemGrassSeeds;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
@@ -120,6 +125,31 @@ public class BlockFloatingFlower extends BlockModContainer implements ILexiconab
|
||||
return Blocks.dirt.getIcon(par1, par2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if(stack != null) {
|
||||
TileFloatingFlower flower = (TileFloatingFlower) world.getTileEntity(x, y, z);
|
||||
IslandType type = null;
|
||||
if(stack.getItem() == Items.snowball)
|
||||
type = IslandType.SNOW;
|
||||
else if(stack.getItem() == ModItems.grassSeeds)
|
||||
type = ItemGrassSeeds.getIslandType(stack);
|
||||
|
||||
if(type != null && type != flower.getIslandType()) {
|
||||
if(!world.isRemote) {
|
||||
flower.setIslandType(type);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
||||
if(!player.capabilities.isCreativeMode)
|
||||
stack.stackSize--;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idMiniIsland;
|
||||
|
||||
@@ -10,10 +10,42 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.decor;
|
||||
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public interface IFloatingFlower {
|
||||
|
||||
public ItemStack getDisplayStack();
|
||||
|
||||
public IslandType getIslandType();
|
||||
|
||||
public void setIslandType(IslandType type);
|
||||
|
||||
public static enum IslandType {
|
||||
GRASS(LibResources.MODEL_MINI_ISLAND),
|
||||
PODZOL(LibResources.MODEL_MINI_ISLAND_PODZOL),
|
||||
MYCEL(LibResources.MODEL_MINI_ISLAND_MYCEL),
|
||||
SNOW(LibResources.MODEL_MINI_ISLAND_SNOW);
|
||||
|
||||
private IslandType(String s) {
|
||||
res = new ResourceLocation(s);
|
||||
}
|
||||
|
||||
private final ResourceLocation res;
|
||||
|
||||
public static IslandType ofType(String typeStr) {
|
||||
for(IslandType type : IslandType.class.getEnumConstants())
|
||||
if(type.toString().equals(typeStr))
|
||||
return type;
|
||||
|
||||
return GRASS;
|
||||
}
|
||||
|
||||
public ResourceLocation getResource() {
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,13 +11,16 @@
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.decor.IFloatingFlower;
|
||||
|
||||
public class TileFloatingFlower extends TileEntity implements IFloatingFlower {
|
||||
public class TileFloatingFlower extends TileMod implements IFloatingFlower {
|
||||
|
||||
public static final String TAG_ISLAND_TYPE = "islandType";
|
||||
public static ItemStack forcedStack = null;
|
||||
IslandType type = IslandType.GRASS;
|
||||
|
||||
@Override
|
||||
public ItemStack getDisplayStack() {
|
||||
@@ -35,4 +38,24 @@ public class TileFloatingFlower extends TileEntity implements IFloatingFlower {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IslandType getIslandType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIslandType(IslandType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
cmp.setString(TAG_ISLAND_TYPE, type.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
type = IslandType.ofType(cmp.getString(TAG_ISLAND_TYPE));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,11 +11,16 @@
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import vazkii.botania.common.block.decor.IFloatingFlower;
|
||||
import vazkii.botania.common.block.decor.IFloatingFlower.IslandType;
|
||||
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
|
||||
|
||||
public class TileFloatingSpecialFlower extends TileSpecialFlower implements IFloatingFlower {
|
||||
|
||||
public static final String TAG_ISLAND_TYPE = "islandType";
|
||||
IslandType type = IslandType.GRASS;
|
||||
|
||||
@Override
|
||||
public boolean isOnSpecialSoil() {
|
||||
return false;
|
||||
@@ -26,4 +31,26 @@ public class TileFloatingSpecialFlower extends TileSpecialFlower implements IFlo
|
||||
return ItemBlockSpecialFlower.ofType(subTileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IslandType getIslandType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIslandType(IslandType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
super.writeCustomNBT(cmp);
|
||||
cmp.setString(TAG_ISLAND_TYPE, type.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
super.readCustomNBT(cmp);
|
||||
type = IslandType.ofType(cmp.getString(TAG_ISLAND_TYPE));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.decor.IFloatingFlower.IslandType;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -40,6 +41,10 @@ public class ItemGrassSeeds extends ItemMod {
|
||||
|
||||
private static Map<Integer, List<BlockSwapper>> blockSwappers = new HashMap();
|
||||
|
||||
private static final IslandType[] ISLAND_TYPES = {
|
||||
IslandType.GRASS, IslandType.PODZOL, IslandType.MYCEL
|
||||
};
|
||||
|
||||
private static final int types = 3;
|
||||
IIcon[] icons;
|
||||
|
||||
@@ -202,5 +207,9 @@ public class ItemGrassSeeds extends ItemMod {
|
||||
list.remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static IslandType getIslandType(ItemStack stack) {
|
||||
return ISLAND_TYPES[Math.min(stack.getItemDamage(), ISLAND_TYPES.length - 1)];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user