mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Preliminary work for the luminizer expansion. To be continued.
This commit is contained in:
1 parent
50ad1301d7
commit
1ea189c105
10 files changed
+43
-14
No files matched your search
@@ -14,7 +14,9 @@ import java.util.Locale;
|
||||
|
||||
public enum LuminizerVariant implements IStringSerializable {
|
||||
DEFAULT,
|
||||
DETECTOR;
|
||||
DETECTOR,
|
||||
FORK,
|
||||
TOGGLE;
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
|
||||
@@ -49,6 +49,8 @@ public class MiscellaneousIcons {
|
||||
alfPortalTex,
|
||||
lightRelayWorldIcon,
|
||||
lightRelayWorldIconRed,
|
||||
lightRelayWorldIconGreen,
|
||||
lightRelayWorldIconPurple,
|
||||
alchemyCatalystOverlay,
|
||||
conjurationCatalystOverlay,
|
||||
enchanterOverlay,
|
||||
@@ -115,6 +117,8 @@ public class MiscellaneousIcons {
|
||||
alfPortalTex = IconHelper.forName(evt.getMap(), "alfheimPortalInside", "blocks");
|
||||
lightRelayWorldIcon = IconHelper.forName(evt.getMap(), "lightRelay1", "blocks");
|
||||
lightRelayWorldIconRed = IconHelper.forName(evt.getMap(), "lightRelay3", "blocks");
|
||||
lightRelayWorldIconGreen = IconHelper.forName(evt.getMap(), "lightRelay5", "blocks");
|
||||
lightRelayWorldIconPurple = IconHelper.forName(evt.getMap(), "lightRelay7", "blocks");
|
||||
alchemyCatalystOverlay = IconHelper.forName(evt.getMap(), "alchemyCatalyst3", "blocks");
|
||||
conjurationCatalystOverlay = IconHelper.forName(evt.getMap(), "conjurationCatalyst3", "blocks");
|
||||
enchanterOverlay = IconHelper.forName(evt.getMap(), "enchanterOverlay", "blocks");
|
||||
|
||||
@@ -10,6 +10,13 @@
|
||||
*/
|
||||
package vazkii.botania.client.render.tile;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
@@ -17,7 +24,6 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
import vazkii.botania.api.state.enums.LuminizerVariant;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
@@ -26,21 +32,24 @@ import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileLightRelay;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class RenderTileLightRelay extends TileEntitySpecialRenderer<TileLightRelay> {
|
||||
|
||||
private static Map<LuminizerVariant, TextureAtlasSprite> sprites = new HashMap();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(@Nonnull TileLightRelay tile, double x, double y, double z, float pticks, int digProgress) {
|
||||
if(!tile.getWorld().isBlockLoaded(tile.getPos(), false)
|
||||
|| tile.getWorld().getBlockState(tile.getPos()).getBlock() != ModBlocks.lightRelay)
|
||||
if(!tile.getWorld().isBlockLoaded(tile.getPos(), false) || tile.getWorld().getBlockState(tile.getPos()).getBlock() != ModBlocks.lightRelay)
|
||||
return;
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
TextureAtlasSprite iicon = tile.getWorld().getBlockState(tile.getPos())
|
||||
.getValue(BotaniaStateProps.LUMINIZER_VARIANT) == LuminizerVariant.DEFAULT
|
||||
? MiscellaneousIcons.INSTANCE.lightRelayWorldIcon
|
||||
: MiscellaneousIcons.INSTANCE.lightRelayWorldIconRed;
|
||||
if(sprites.isEmpty()) {
|
||||
sprites.put(LuminizerVariant.DEFAULT, MiscellaneousIcons.INSTANCE.lightRelayWorldIcon);
|
||||
sprites.put(LuminizerVariant.DETECTOR, MiscellaneousIcons.INSTANCE.lightRelayWorldIconRed);
|
||||
sprites.put(LuminizerVariant.FORK, MiscellaneousIcons.INSTANCE.lightRelayWorldIconGreen);
|
||||
sprites.put(LuminizerVariant.TOGGLE, MiscellaneousIcons.INSTANCE.lightRelayWorldIconPurple);
|
||||
}
|
||||
|
||||
TextureAtlasSprite iicon = sprites.get(tile.getWorld().getBlockState(tile.getPos()).getValue(BotaniaStateProps.LUMINIZER_VARIANT));
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(x + 0.5, y + 0.3, z + 0.5);
|
||||
|
||||
@@ -70,7 +70,7 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
int meta = state.getValue(BotaniaStateProps.LUMINIZER_VARIANT) == LuminizerVariant.DETECTOR ? 1 : 0;
|
||||
int meta = state.getValue(BotaniaStateProps.LUMINIZER_VARIANT).ordinal();
|
||||
if (state.getValue(BotaniaStateProps.POWERED)) {
|
||||
meta |= 8;
|
||||
} else {
|
||||
@@ -84,7 +84,7 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
boolean powered = (meta & 8) != 0;
|
||||
meta &= -9;
|
||||
return getDefaultState().withProperty(BotaniaStateProps.POWERED, powered).withProperty(BotaniaStateProps.LUMINIZER_VARIANT, meta == 1 ? LuminizerVariant.DETECTOR : LuminizerVariant.DEFAULT);
|
||||
return getDefaultState().withProperty(BotaniaStateProps.POWERED, powered).withProperty(BotaniaStateProps.LUMINIZER_VARIANT, LuminizerVariant.class.getEnumConstants()[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,13 +95,13 @@ public class BlockLightRelay extends BlockMod implements IWandable, ILexiconable
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for(int i = 0; i < 2; i++)
|
||||
for(int i = 0; i < 4; i++)
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return state.getValue(BotaniaStateProps.LUMINIZER_VARIANT) == LuminizerVariant.DEFAULT ? 0 : 1;
|
||||
return state.getValue(BotaniaStateProps.LUMINIZER_VARIANT).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user