mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Render package ported
This commit is contained in:
parent
aa015521bc
commit
99b7e0bf43
14 changed files with 370 additions and 337 deletions
|
@ -2,6 +2,7 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.state.IProperty;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.CompostRecipe;
|
||||||
|
@ -187,7 +188,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay {
|
||||||
public static CompostProperty COMPOST_PROP = new CompostProperty();
|
public static CompostProperty COMPOST_PROP = new CompostProperty();
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private static class CompostProperty implements IUnlistedProperty<Pair> {
|
private static class CompostProperty implements IProperty<Pair> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
|
@ -30,7 +30,7 @@ public enum TheColoredLampColors implements IStringSerializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TheColoredLampColors getColorFromDyeName(String color) {
|
public static TheColoredLampColors getColorFromDyeName(String color) {
|
||||||
if (color.substring(0, 3).equals("dye")) {
|
if (color.startsWith("dye")) {
|
||||||
String actualName = color.substring(3);
|
String actualName = color.substring(3);
|
||||||
for (int i = 0; i < values().length; i++) {
|
for (int i = 0; i < values().length; i++) {
|
||||||
String aName = values()[i].oreName;
|
String aName = values()[i].oreName;
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
|
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
|
||||||
|
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.Rarity;
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
public enum TheMiscBlocks implements IStringSerializable {
|
public enum TheMiscBlocks implements IStringSerializable {
|
||||||
|
|
||||||
QUARTZ_PILLAR("black_quartz_pillar", EnumRarity.RARE),
|
QUARTZ_PILLAR("black_quartz_pillar", Rarity.RARE),
|
||||||
QUARTZ_CHISELED("black_quartz_chiseled", EnumRarity.RARE),
|
QUARTZ_CHISELED("black_quartz_chiseled", Rarity.RARE),
|
||||||
QUARTZ("black_quartz", EnumRarity.RARE),
|
QUARTZ("black_quartz", Rarity.RARE),
|
||||||
ORE_QUARTZ("ore_black_quartz", EnumRarity.EPIC),
|
ORE_QUARTZ("ore_black_quartz", Rarity.EPIC),
|
||||||
WOOD_CASING("wood_casing", EnumRarity.COMMON),
|
WOOD_CASING("wood_casing", Rarity.COMMON),
|
||||||
CHARCOAL_BLOCK("charcoal", EnumRarity.COMMON),
|
CHARCOAL_BLOCK("charcoal", Rarity.COMMON),
|
||||||
ENDERPEARL_BLOCK("enderpearl", EnumRarity.RARE),
|
ENDERPEARL_BLOCK("enderpearl", Rarity.RARE),
|
||||||
LAVA_FACTORY_CASE("lava_factory_case", EnumRarity.UNCOMMON),
|
LAVA_FACTORY_CASE("lava_factory_case", Rarity.UNCOMMON),
|
||||||
ENDER_CASING("ender_casing", EnumRarity.EPIC),
|
ENDER_CASING("ender_casing", Rarity.EPIC),
|
||||||
IRON_CASING("iron_casing", EnumRarity.RARE);
|
IRON_CASING("iron_casing", Rarity.RARE);
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
public final EnumRarity rarity;
|
public final Rarity rarity;
|
||||||
|
|
||||||
TheMiscBlocks(String name, EnumRarity rarity) {
|
TheMiscBlocks(String name, Rarity rarity) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.rarity = rarity;
|
this.rarity = rarity;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,23 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
|
package de.ellpeck.actuallyadditions.mod.blocks.metalists;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.Rarity;
|
||||||
import net.minecraft.util.IStringSerializable;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
public enum TheWildPlants implements IStringSerializable {
|
public enum TheWildPlants implements IStringSerializable {
|
||||||
|
|
||||||
CANOLA("canola", EnumRarity.RARE, InitBlocks.blockCanola),
|
CANOLA("canola", Rarity.RARE, InitBlocks.blockCanola),
|
||||||
FLAX("flax", EnumRarity.RARE, InitBlocks.blockFlax),
|
FLAX("flax", Rarity.RARE, InitBlocks.blockFlax),
|
||||||
RICE("rice", EnumRarity.RARE, InitBlocks.blockRice),
|
RICE("rice", Rarity.RARE, InitBlocks.blockRice),
|
||||||
COFFEE("coffee", EnumRarity.RARE, InitBlocks.blockCoffee);
|
COFFEE("coffee", Rarity.RARE, InitBlocks.blockCoffee);
|
||||||
|
|
||||||
final String name;
|
final String name;
|
||||||
final EnumRarity rarity;
|
final Rarity rarity;
|
||||||
final Block normal;
|
final Block normal;
|
||||||
|
|
||||||
TheWildPlants(String name, EnumRarity rarity, Block normal) {
|
TheWildPlants(String name, Rarity rarity, Block normal) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.rarity = rarity;
|
this.rarity = rarity;
|
||||||
this.normal = Preconditions.checkNotNull(normal, "TheWildPlants was loaded before block init!");
|
this.normal = Preconditions.checkNotNull(normal, "TheWildPlants was loaded before block init!");
|
||||||
|
@ -29,7 +28,7 @@ public enum TheWildPlants implements IStringSerializable {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumRarity getRarity() {
|
public Rarity getRarity() {
|
||||||
return this.rarity;
|
return this.rarity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.BlockCompost;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.client.renderer.model.BakedQuad;
|
||||||
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.BlockCompost;
|
|
||||||
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.util.EnumFacing;
|
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
|
||||||
|
|
||||||
public class ActualCompostModel implements IBakedModel {
|
public class ActualCompostModel implements IBakedModel {
|
||||||
|
|
||||||
public static final Map<Pair<IBlockState, Float>, IBakedModel> MODELS = new HashMap<>();
|
public static final Map<Pair<BlockState, Float>, IBakedModel> MODELS = new HashMap<>();
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
|
||||||
if (state instanceof IExtendedBlockState) {
|
// if (state instanceof BlockState) {
|
||||||
Pair<IBlockState, Float> data = ((IExtendedBlockState) state).getValue(BlockCompost.COMPOST_PROP);
|
if (state != null) {
|
||||||
|
Pair<BlockState, Float> data = state.get(BlockCompost.COMPOST_PROP);
|
||||||
if (data == null || data.getRight() <= 0) return CompostModel.compostBase.getQuads(state, side, rand);
|
if (data == null || data.getRight() <= 0) return CompostModel.compostBase.getQuads(state, side, rand);
|
||||||
IBakedModel model = MODELS.get(data);
|
IBakedModel model = MODELS.get(data);
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
|
@ -32,6 +32,7 @@ public class ActualCompostModel implements IBakedModel {
|
||||||
}
|
}
|
||||||
return model.getQuads(state, side, rand);
|
return model.getQuads(state, side, rand);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CompostModel.compostBase.getQuads(state, side, rand);
|
return CompostModel.compostBase.getQuads(state, side, rand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +46,12 @@ public class ActualCompostModel implements IBakedModel {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No clue what this one is.
|
||||||
|
@Override
|
||||||
|
public boolean func_230044_c_() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBuiltInRenderer() {
|
public boolean isBuiltInRenderer() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -57,7 +64,6 @@ public class ActualCompostModel implements IBakedModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemOverrideList getOverrides() {
|
public ItemOverrideList getOverrides() {
|
||||||
return ItemOverrideList.NONE;
|
return ItemOverrideList.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +1,57 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import javax.vecmath.Vector3f;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraftforge.common.model.TRSRTransformation;
|
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
// todo: come back and fix this render as It's broken atm :cry:
|
||||||
public class CompostModel implements IBakedModel {
|
public class CompostModel implements IBakedModel {
|
||||||
public static IBakedModel compostBase;
|
public static IBakedModel compostBase;
|
||||||
private final IBakedModel display;
|
private final IBakedModel display;
|
||||||
private final ImmutableList<BakedQuad> general;
|
private final ImmutableList<BakedQuad> general;
|
||||||
private final ImmutableMap<EnumFacing, ImmutableList<BakedQuad>> faces;
|
private final ImmutableMap<Direction, ImmutableList<BakedQuad>> faces;
|
||||||
|
|
||||||
public CompostModel(IBlockState flowerState, float height) {
|
public CompostModel(BlockState flowerState, float height) {
|
||||||
this.display = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(flowerState);
|
this.display = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState(flowerState);
|
||||||
|
|
||||||
TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, -.218F, 0), null, new Vector3f(0.75F, height / 1.81F, 0.75F), null));
|
// TRSRTransformation transform = TRSRTransformation.blockCenterToCorner(new TRSRTransformation(new Vector3f(0, -.218F, 0), null, new Vector3f(0.75F, height / 1.81F, 0.75F), null));
|
||||||
|
|
||||||
ImmutableList.Builder<BakedQuad> builder;
|
ImmutableList.Builder<BakedQuad> builder;
|
||||||
EnumMap<EnumFacing, ImmutableList<BakedQuad>> faces = new EnumMap<>(EnumFacing.class);
|
EnumMap<Direction, ImmutableList<BakedQuad>> faces = new EnumMap<>(Direction.class);
|
||||||
|
|
||||||
for (EnumFacing face : EnumFacing.values()) {
|
for (Direction face : Direction.values()) {
|
||||||
builder = ImmutableList.builder();
|
builder = ImmutableList.builder();
|
||||||
if (!this.display.isBuiltInRenderer()) {
|
if (!this.display.isBuiltInRenderer()) {
|
||||||
for (BakedQuad quad : this.display.getQuads(flowerState, face, 0)) {
|
// for (BakedQuad quad : this.display.getQuads(flowerState, face, 0)) {
|
||||||
Transformer transformer = new Transformer(transform, quad.getFormat());
|
// Transformer transformer = new Transformer(transform, quad.getFormat());
|
||||||
quad.pipe(transformer);
|
// quad.pipe(transformer);
|
||||||
builder.add(transformer.build());
|
// builder.add(transformer.build());
|
||||||
}
|
// }
|
||||||
builder.addAll(compostBase.getQuads(null, face, 0));
|
builder.addAll(compostBase.getQuads(null, face, new Random()));
|
||||||
}
|
}
|
||||||
faces.put(face, builder.build());
|
faces.put(face, builder.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.display.isBuiltInRenderer()) {
|
if (!this.display.isBuiltInRenderer()) {
|
||||||
builder = ImmutableList.builder();
|
builder = ImmutableList.builder();
|
||||||
for (BakedQuad quad : this.display.getQuads(flowerState, null, 0)) {
|
// for (BakedQuad quad : this.display.getQuads(flowerState, null, 0)) {
|
||||||
Transformer transformer = new Transformer(transform, quad.getFormat());
|
// Transformer transformer = new Matrix4f(transform, quad.getFormat());
|
||||||
quad.pipe(transformer);
|
// quad.pipe(transformer);
|
||||||
builder.add(transformer.build());
|
// builder.add(transformer.build());
|
||||||
}
|
// }
|
||||||
builder.addAll(compostBase.getQuads(null, null, 0));
|
builder.addAll(compostBase.getQuads(null, null, new Random()));
|
||||||
this.general = builder.build();
|
this.general = builder.build();
|
||||||
} else this.general = ImmutableList.of();
|
} else this.general = ImmutableList.of();
|
||||||
|
|
||||||
|
@ -61,7 +59,7 @@ public class CompostModel implements IBakedModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
|
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
|
||||||
if (side == null) return this.general;
|
if (side == null) return this.general;
|
||||||
return this.faces.get(side);
|
return this.faces.get(side);
|
||||||
}
|
}
|
||||||
|
@ -76,6 +74,12 @@ public class CompostModel implements IBakedModel {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No idea what this does.. Something? I'm sure
|
||||||
|
@Override
|
||||||
|
public boolean func_230044_c_() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBuiltInRenderer() {
|
public boolean isBuiltInRenderer() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -88,7 +92,7 @@ public class CompostModel implements IBakedModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemOverrideList getOverrides() {
|
public ItemOverrideList getOverrides() {
|
||||||
return ItemOverrideList.NONE;
|
return ItemOverrideList.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemBattery;
|
import de.ellpeck.actuallyadditions.mod.items.ItemBattery;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBatteryBox;
|
||||||
|
@ -9,37 +8,41 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.Quaternion;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.Util;
|
||||||
import net.minecraftforge.energy.CapabilityEnergy;
|
import net.minecraftforge.energy.CapabilityEnergy;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
import java.text.NumberFormat;
|
||||||
public class RenderBatteryBox extends TileEntitySpecialRenderer<TileEntityBatteryBox> {
|
|
||||||
|
// todo: migrate to client package
|
||||||
|
public class RenderBatteryBox extends TileEntityRenderer<TileEntityBatteryBox> {
|
||||||
|
|
||||||
|
public RenderBatteryBox(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||||
|
super(rendererDispatcherIn);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityBatteryBox tile, double x, double y, double z, float par5, int par6, float f) {
|
public void render(TileEntityBatteryBox tile, float partialTicks, MatrixStack matrices, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||||
if (!(tile instanceof TileEntityBatteryBox)) { return; }
|
// BlockPos pos = tile.getPos();
|
||||||
|
|
||||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||||
if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemBattery) {
|
if (StackUtil.isValid(stack) && stack.getItem() instanceof ItemBattery) {
|
||||||
GlStateManager.pushMatrix();
|
matrices.push();
|
||||||
GlStateManager.translate((float) x + 0.5F, (float) y + 1F, (float) z + 0.5F);
|
// matrices.translate((float) pos.getX() + 0.5F, (float) pos.getY() + 1F, (float) pos.getZ() + 0.5F);
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
matrices.push();
|
||||||
|
|
||||||
GlStateManager.scale(0.0075F, 0.0075F, 0.0075F);
|
matrices.scale(0.0075F, 0.0075F, 0.0075F);
|
||||||
GlStateManager.rotate(180F, 1F, 0F, 0F);
|
matrices.rotate(new Quaternion(180F, 1F, 0F, 0F));
|
||||||
GlStateManager.translate(0F, 0F, -50F);
|
matrices.translate(0F, 0F, -50F);
|
||||||
|
|
||||||
if (stack.hasCapability(CapabilityEnergy.ENERGY, null)) {
|
stack.getCapability(CapabilityEnergy.ENERGY).ifPresent(cap -> {
|
||||||
IEnergyStorage cap = stack.getCapability(CapabilityEnergy.ENERGY, null);
|
|
||||||
NumberFormat format = NumberFormat.getInstance();
|
NumberFormat format = NumberFormat.getInstance();
|
||||||
FontRenderer font = Minecraft.getMinecraft().fontRenderer;
|
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||||
|
|
||||||
String s = format.format(cap.getEnergyStored()) + "/" + format.format(cap.getMaxEnergyStored());
|
String s = format.format(cap.getEnergyStored()) + "/" + format.format(cap.getMaxEnergyStored());
|
||||||
float lengthS = -font.getStringWidth(s) / 2F;
|
float lengthS = -font.getStringWidth(s) / 2F;
|
||||||
|
@ -47,29 +50,29 @@ public class RenderBatteryBox extends TileEntitySpecialRenderer<TileEntityBatter
|
||||||
float lengthS2 = -font.getStringWidth(s2) / 2F;
|
float lengthS2 = -font.getStringWidth(s2) / 2F;
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
font.drawString(s, lengthS, 10F, 0xFFFFFF, false);
|
font.drawString(s, lengthS, 10F, 0xFFFFFF);
|
||||||
font.drawString(s2, lengthS2, 20F, 0xFFFFFF, false);
|
font.drawString(s2, lengthS2, 20F, 0xFFFFFF);
|
||||||
|
|
||||||
GlStateManager.translate(-50F, 0F, 50F);
|
matrices.translate(-50F, 0F, 50F);
|
||||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
matrices.rotate(new Quaternion(90F, 0F, 1F, 0F));
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
matrices.pop();
|
||||||
|
|
||||||
double boop = Minecraft.getSystemTime() / 800D;
|
double boop = Util.milliTime() / 800D;
|
||||||
GlStateManager.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
matrices.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
||||||
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
matrices.rotate(new Quaternion((float) (boop * 40D % 360), 0, 1, 0));
|
||||||
|
|
||||||
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
|
float scale = stack.getItem() instanceof BlockItem ? 0.85F : 0.65F;
|
||||||
GlStateManager.scale(scale, scale, scale);
|
matrices.scale(scale, scale, scale);
|
||||||
try {
|
try {
|
||||||
AssetUtil.renderItemInWorld(stack);
|
AssetUtil.renderItemInWorld(stack);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a battery box! The item is " + stack.getItem().getRegistryName() + "!", e);
|
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a battery box! The item is " + stack.getItem().getRegistryName() + "!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +1,47 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDisplayStand;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.Quaternion;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraft.util.Util;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
// todo: migrate to client package
|
||||||
public class RenderDisplayStand extends TileEntitySpecialRenderer<TileEntityDisplayStand> {
|
public class RenderDisplayStand extends TileEntityRenderer<TileEntityDisplayStand> {
|
||||||
|
|
||||||
|
public RenderDisplayStand(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||||
|
super(rendererDispatcherIn);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityDisplayStand tile, double x, double y, double z, float par5, int par6, float f) {
|
public void render(TileEntityDisplayStand tile, float partialTicks, MatrixStack matrices, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||||
if (!(tile instanceof TileEntityDisplayStand)) { return; }
|
// BlockPos pos = tile.getPos();
|
||||||
|
|
||||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||||
if (StackUtil.isValid(stack)) {
|
if (StackUtil.isValid(stack)) {
|
||||||
GlStateManager.pushMatrix();
|
matrices.push();
|
||||||
GlStateManager.translate((float) x + 0.5F, (float) y + 1F, (float) z + 0.5F);
|
// matrices.translate((float) pos.getX() + 0.5F, (float) pos.getY() + 1F, (float) pos.getZ() + 0.5F);
|
||||||
|
|
||||||
double boop = Minecraft.getSystemTime() / 800D;
|
double boop = Util.nanoTime() / 800D;
|
||||||
GlStateManager.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
matrices.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
||||||
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
matrices.rotate(new Quaternion((float) (boop * 40D % 360), 0, 1, 0));
|
||||||
|
|
||||||
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
|
float scale = stack.getItem() instanceof BlockItem ? 0.85F : 0.65F;
|
||||||
GlStateManager.scale(scale, scale, scale);
|
matrices.scale(scale, scale, scale);
|
||||||
try {
|
try {
|
||||||
AssetUtil.renderItemInWorld(stack);
|
AssetUtil.renderItemInWorld(stack);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a display stand! The item is " + stack.getItem().getRegistryName() + "!", e);
|
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in a display stand! The item is " + stack.getItem().getRegistryName() + "!", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,58 +1,69 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEmpowerer;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEmpowerer;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.Quaternion;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
// todo: migrate to client package
|
||||||
public class RenderEmpowerer extends TileEntitySpecialRenderer<TileEntityEmpowerer> {
|
public class RenderEmpowerer extends TileEntityRenderer<TileEntityEmpowerer> {
|
||||||
|
public RenderEmpowerer(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||||
|
super(rendererDispatcherIn);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityEmpowerer tile, double x, double y, double z, float par5, int par6, float f) {
|
public void render(TileEntityEmpowerer tile, float partialTicks, MatrixStack matrices, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||||
if (!(tile instanceof TileEntityEmpowerer)) { return; }
|
// BlockPos pos = tile.getPos();
|
||||||
|
|
||||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||||
if (StackUtil.isValid(stack)) {
|
if (StackUtil.isValid(stack)) {
|
||||||
GlStateManager.pushMatrix();
|
matrices.push();
|
||||||
GlStateManager.translate((float) x + 0.5F, (float) y + 1F, (float) z + 0.5F);
|
// matrices.translate((float) pos.getX() + 0.5F, (float) pos.getY() + 1F, (float) pos.getZ() + 0.5F);
|
||||||
|
|
||||||
double boop = Minecraft.getSystemTime() / 800D;
|
double boop = Util.nanoTime() / 800D;
|
||||||
GlStateManager.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
matrices.translate(0D, Math.sin(boop % (2 * Math.PI)) * 0.065, 0D);
|
||||||
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
matrices.rotate(new Quaternion((float) (boop * 40D % 360), 0, 1, 0));
|
||||||
|
|
||||||
float scale = stack.getItem() instanceof ItemBlock ? 0.85F : 0.65F;
|
float scale = stack.getItem() instanceof BlockItem ? 0.85F : 0.65F;
|
||||||
GlStateManager.scale(scale, scale, scale);
|
matrices.scale(scale, scale, scale);
|
||||||
try {
|
try {
|
||||||
AssetUtil.renderItemInWorld(stack);
|
AssetUtil.renderItemInWorld(stack);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in an empowerer! The item is " + stack.getItem().getRegistryName() + ":" + stack.getMetadata() + "!", e);
|
ActuallyAdditions.LOGGER.error("Something went wrong trying to render an item in an empowerer! The item is {}!", stack.getItem().getRegistryName(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
int index = tile.recipeForRenderIndex;
|
int index = tile.recipeForRenderIndex;
|
||||||
if (index >= 0 && ActuallyAdditionsAPI.EMPOWERER_RECIPES.size() > index) {
|
if (index >= 0 && ActuallyAdditionsAPI.EMPOWERER_RECIPES.size() > index) {
|
||||||
EmpowererRecipe recipe = ActuallyAdditionsAPI.EMPOWERER_RECIPES.get(index);
|
EmpowererRecipe recipe = ActuallyAdditionsAPI.EMPOWERER_RECIPES.get(index);
|
||||||
if (recipe != null) {
|
if (recipe != null) {
|
||||||
for (int i = 0; i < EnumFacing.HORIZONTALS.length; i++) {
|
Direction.Plane.HORIZONTAL.iterator().forEachRemaining(e -> {
|
||||||
EnumFacing facing = EnumFacing.HORIZONTALS[i];
|
BlockPos offset = tile.getPos().offset(e, 3);
|
||||||
BlockPos offset = tile.getPos().offset(facing, 3);
|
|
||||||
|
|
||||||
AssetUtil.renderLaser(tile.getPos().getX() + 0.5, tile.getPos().getY() + 0.5, tile.getPos().getZ() + 0.5, offset.getX() + 0.5, offset.getY() + 0.95, offset.getZ() + 0.5, 80, 1F, 0.1F, recipe.getParticleColors());
|
AssetUtil.renderLaser(tile.getPos().getX() + 0.5, tile.getPos().getY() + 0.5, tile.getPos().getZ() + 0.5, offset.getX() + 0.5, offset.getY() + 0.95, offset.getZ() + 0.5, 80, 1F, 0.1F, recipe.getParticleColors());
|
||||||
}
|
});
|
||||||
|
|
||||||
|
// original code of the above if it doesn't work
|
||||||
|
// @since 1.15-port
|
||||||
|
// for (int i = 0; i < Direction.Plane.HORIZONTAL; i++) {
|
||||||
|
// EnumFacing facing = EnumFacing.HORIZONTALS[i];
|
||||||
|
// BlockPos offset = tile.getPos().offset(facing, 3);
|
||||||
|
//
|
||||||
|
// AssetUtil.renderLaser(tile.getPos().getX() + 0.5, tile.getPos().getY() + 0.5, tile.getPos().getZ() + 0.5, offset.getX() + 0.5, offset.getY() + 0.95, offset.getZ() + 0.5, 80, 1F, 0.1F, recipe.getParticleColors());
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
|
import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
|
||||||
import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
||||||
|
@ -12,72 +13,76 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import io.netty.util.internal.ConcurrentSet;
|
import io.netty.util.internal.ConcurrentSet;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.Quaternion;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
// todo: migrate to client package
|
||||||
public class RenderLaserRelay extends TileEntitySpecialRenderer<TileEntityLaserRelay> {
|
public class RenderLaserRelay extends TileEntityRenderer<TileEntityLaserRelay> {
|
||||||
|
|
||||||
private static final float[] COLOR = new float[] { 1F, 0F, 0F };
|
private static final float[] COLOR = new float[] { 1F, 0F, 0F };
|
||||||
private static final float[] COLOR_ITEM = new float[] { 0F, 124F / 255F, 16F / 255F };
|
private static final float[] COLOR_ITEM = new float[] { 0F, 124F / 255F, 16F / 255F };
|
||||||
private static final float[] COLOR_FLUIDS = new float[] { 0F, 97F / 255F, 198F / 255F };
|
private static final float[] COLOR_FLUIDS = new float[] { 0F, 97F / 255F, 198F / 255F };
|
||||||
private static final float[] COLOR_INFRARED = new float[] { 209F / 255F, 179F / 255F, 239F / 255F };
|
private static final float[] COLOR_INFRARED = new float[] { 209F / 255F, 179F / 255F, 239F / 255F };
|
||||||
|
|
||||||
|
public RenderLaserRelay(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||||
|
super(rendererDispatcherIn);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityLaserRelay tile, double x, double y, double z, float par5, int par6, float f) {
|
public void render(TileEntityLaserRelay tile, float partialTicks, MatrixStack matrices, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||||
if (tile instanceof TileEntityLaserRelay) {
|
TileEntityLaserRelay relay = tile;
|
||||||
TileEntityLaserRelay relay = tile;
|
boolean hasInvis = false;
|
||||||
boolean hasInvis = false;
|
|
||||||
|
|
||||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
// BlockPos pos = tile.getPos();
|
||||||
boolean hasGoggles = ItemEngineerGoggles.isWearing(player);
|
PlayerEntity player = Minecraft.getInstance().player;
|
||||||
|
boolean hasGoggles = ItemEngineerGoggles.isWearing(player);
|
||||||
|
|
||||||
ItemStack upgrade = relay.inv.getStackInSlot(0);
|
ItemStack upgrade = relay.inv.getStackInSlot(0);
|
||||||
if (StackUtil.isValid(upgrade)) {
|
if (StackUtil.isValid(upgrade)) {
|
||||||
if (upgrade.getItem() == InitItems.itemLaserUpgradeInvisibility) {
|
if (upgrade.getItem() == InitItems.itemLaserUpgradeInvisibility) {
|
||||||
hasInvis = true;
|
hasInvis = true;
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack hand = player.getHeldItemMainhand();
|
|
||||||
if (hasGoggles || StackUtil.isValid(hand) && (hand.getItem() == ConfigValues.itemCompassConfigurator || hand.getItem() instanceof ItemLaserWrench) || "themattabase".equals(player.getName())) {
|
|
||||||
GlStateManager.pushMatrix();
|
|
||||||
|
|
||||||
float yTrans = tile.getBlockMetadata() == 0 ? 0.2F : 0.8F;
|
|
||||||
GlStateManager.translate((float) x + 0.5F, (float) y + yTrans, (float) z + 0.5F);
|
|
||||||
GlStateManager.scale(0.2F, 0.2F, 0.2F);
|
|
||||||
|
|
||||||
double boop = Minecraft.getSystemTime() / 800D;
|
|
||||||
GlStateManager.rotate((float) (boop * 40D % 360), 0, 1, 0);
|
|
||||||
|
|
||||||
AssetUtil.renderItemInWorld(upgrade);
|
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConcurrentSet<IConnectionPair> connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(tile.getPos(), tile.getWorld());
|
ItemStack hand = player.getHeldItemMainhand();
|
||||||
if (connections != null && !connections.isEmpty()) {
|
if (hasGoggles || StackUtil.isValid(hand) && (hand.getItem() == ConfigValues.itemCompassConfigurator || hand.getItem() instanceof ItemLaserWrench) || "themattabase".equals(player.getName())) {
|
||||||
for (IConnectionPair pair : connections) {
|
matrices.push();
|
||||||
if (!pair.doesSuppressRender() && tile.getPos().equals(pair.getPositions()[0])) {
|
|
||||||
BlockPos first = tile.getPos();
|
|
||||||
BlockPos second = pair.getPositions()[1];
|
|
||||||
|
|
||||||
TileEntity secondTile = tile.getWorld().getTileEntity(second);
|
float yTrans = .2f; // tile.getBlockMetadata() == 0 ? 0.2F : 0.8F; old logic for meta data
|
||||||
if (secondTile instanceof TileEntityLaserRelay) {
|
// matrices.translate((float) pos.getX() + 0.5F, (float) pos.getY() + yTrans, (float) pos.getZ() + 0.5F);
|
||||||
ItemStack secondUpgrade = ((TileEntityLaserRelay) secondTile).inv.getStackInSlot(0);
|
matrices.scale(0.2F, 0.2F, 0.2F);
|
||||||
boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == InitItems.itemLaserUpgradeInvisibility;
|
|
||||||
|
|
||||||
if (hasGoggles || !hasInvis || !otherInvis) {
|
double boop = Util.nanoTime() / 800D;
|
||||||
float[] color = hasInvis && otherInvis ? COLOR_INFRARED : relay.type == LaserType.ITEM ? COLOR_ITEM : relay.type == LaserType.FLUID ? COLOR_FLUIDS : COLOR;
|
matrices.rotate(new Quaternion((float) (boop * 40D % 360), 0, 1, 0));
|
||||||
|
|
||||||
AssetUtil.renderLaser(first.getX() + 0.5, first.getY() + 0.5, first.getZ() + 0.5, second.getX() + 0.5, second.getY() + 0.5, second.getZ() + 0.5, 120, hasInvis && otherInvis ? 0.1F : 0.35F, 0.05, color);
|
AssetUtil.renderItemInWorld(upgrade);
|
||||||
}
|
|
||||||
|
matrices.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ConcurrentSet<IConnectionPair> connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(tile.getPos(), tile.getWorld());
|
||||||
|
if (connections != null && !connections.isEmpty()) {
|
||||||
|
for (IConnectionPair pair : connections) {
|
||||||
|
if (!pair.doesSuppressRender() && tile.getPos().equals(pair.getPositions()[0])) {
|
||||||
|
BlockPos first = tile.getPos();
|
||||||
|
BlockPos second = pair.getPositions()[1];
|
||||||
|
|
||||||
|
TileEntity secondTile = tile.getWorld().getTileEntity(second);
|
||||||
|
if (secondTile instanceof TileEntityLaserRelay) {
|
||||||
|
ItemStack secondUpgrade = ((TileEntityLaserRelay) secondTile).inv.getStackInSlot(0);
|
||||||
|
boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == InitItems.itemLaserUpgradeInvisibility;
|
||||||
|
|
||||||
|
if (hasGoggles || !hasInvis || !otherInvis) {
|
||||||
|
float[] color = hasInvis && otherInvis ? COLOR_INFRARED : relay.type == LaserType.ITEM ? COLOR_ITEM : relay.type == LaserType.FLUID ? COLOR_FLUIDS : COLOR;
|
||||||
|
|
||||||
|
AssetUtil.renderLaser(first.getX() + 0.5, first.getY() + 0.5, first.getZ() + 0.5, second.getX() + 0.5, second.getY() + 0.5, second.getZ() + 0.5, 120, hasInvis && otherInvis ? 0.1F : 0.35F, 0.05, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,63 +1,67 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.Quaternion;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||||
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
// todo: migrate to client package
|
||||||
public class RenderReconstructorLens extends TileEntitySpecialRenderer<TileEntityAtomicReconstructor> {
|
public class RenderReconstructorLens extends TileEntityRenderer<TileEntityAtomicReconstructor> {
|
||||||
|
|
||||||
|
public RenderReconstructorLens(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||||
|
super(rendererDispatcherIn);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityAtomicReconstructor tile, double x, double y, double z, float par5, int par6, float f) {
|
public void render(TileEntityAtomicReconstructor tile, float partialTicks, MatrixStack matrices, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||||
if (tile == null) return;
|
|
||||||
|
|
||||||
ItemStack stack = tile.inv.getStackInSlot(0);
|
ItemStack stack = tile.inv.getStackInSlot(0);
|
||||||
|
|
||||||
if (StackUtil.isValid(stack) && stack.getItem() instanceof ILensItem) {
|
if (StackUtil.isValid(stack) && stack.getItem() instanceof ILensItem) {
|
||||||
GlStateManager.pushMatrix();
|
matrices.push();
|
||||||
GlStateManager.translate((float) x + 0.5F, (float) y - 0.5F, (float) z + 0.5F);
|
// matrices.translate((float) pos.getX() + 0.5F, (float) pos.getY() - 0.5F, (float) pos.getZ() + 0.5F);
|
||||||
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
matrices.rotate(new Quaternion(180F, 0.0F, 0.0F, 1.0F));
|
||||||
|
|
||||||
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
BlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||||
int meta = state.getBlock().getMetaFromState(state);
|
// int meta = state.getBlock().getMetaFromState(state);
|
||||||
|
int meta = 0; // todo: fix this logic, I'm assuming it's facing meta but I don't know
|
||||||
if (meta == 0) {
|
if (meta == 0) {
|
||||||
GlStateManager.translate(0F, -0.5F, 0F);
|
matrices.translate(0F, -0.5F, 0F);
|
||||||
GlStateManager.rotate(90F, 1F, 0F, 0F);
|
matrices.rotate(new Quaternion(90F, 1F, 0F, 0F));
|
||||||
}
|
}
|
||||||
if (meta == 1) {
|
if (meta == 1) {
|
||||||
GlStateManager.translate(0F, -1.5F - 0.5F / 16F, 0F);
|
matrices.translate(0F, -1.5F - 0.5F / 16F, 0F);
|
||||||
GlStateManager.rotate(90F, 1F, 0F, 0F);
|
matrices.rotate(new Quaternion(90F, 1F, 0F, 0F));
|
||||||
}
|
}
|
||||||
if (meta == 2) {
|
if (meta == 2) {
|
||||||
GlStateManager.translate(0F, -1F, 0F);
|
matrices.translate(0F, -1F, 0F);
|
||||||
GlStateManager.translate(0F, 0F, -0.5F);
|
matrices.translate(0F, 0F, -0.5F);
|
||||||
}
|
}
|
||||||
if (meta == 3) {
|
if (meta == 3) {
|
||||||
GlStateManager.translate(0F, -1F, 0F);
|
matrices.translate(0F, -1F, 0F);
|
||||||
GlStateManager.translate(0F, 0F, 0.5F + 0.5F / 16F);
|
matrices.translate(0F, 0F, 0.5F + 0.5F / 16F);
|
||||||
}
|
}
|
||||||
if (meta == 4) {
|
if (meta == 4) {
|
||||||
GlStateManager.translate(0F, -1F, 0F);
|
matrices.translate(0F, -1F, 0F);
|
||||||
GlStateManager.translate(0.5F + 0.5F / 16F, 0F, 0F);
|
matrices.translate(0.5F + 0.5F / 16F, 0F, 0F);
|
||||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
matrices.rotate(new Quaternion(90F, 0F, 1F, 0F));
|
||||||
}
|
}
|
||||||
if (meta == 5) {
|
if (meta == 5) {
|
||||||
GlStateManager.translate(0F, -1F, 0F);
|
matrices.translate(0F, -1F, 0F);
|
||||||
GlStateManager.translate(-0.5F, 0F, 0F);
|
matrices.translate(-0.5F, 0F, 0F);
|
||||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
matrices.rotate(new Quaternion(90F, 0F, 1F, 0F));
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.scale(0.5F, 0.5F, 0.5F);
|
matrices.scale(0.5F, 0.5F, 0.5F);
|
||||||
AssetUtil.renderItemInWorld(stack);
|
AssetUtil.renderItemInWorld(stack);
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
matrices.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
import java.util.Locale;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.ISmileyCloudEasterEgg;
|
import de.ellpeck.actuallyadditions.mod.misc.cloud.ISmileyCloudEasterEgg;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.cloud.SmileyCloudEasterEggs;
|
import de.ellpeck.actuallyadditions.mod.misc.cloud.SmileyCloudEasterEggs;
|
||||||
|
@ -9,82 +8,87 @@ import de.ellpeck.actuallyadditions.mod.misc.special.RenderSpecial;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
|
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.block.BlockHorizontal;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.HorizontalBlock;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.Quaternion;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
import java.util.Locale;
|
||||||
public class RenderSmileyCloud extends TileEntitySpecialRenderer<TileEntitySmileyCloud> {
|
|
||||||
|
// todo: migrate to client package
|
||||||
|
public class RenderSmileyCloud extends TileEntityRenderer<TileEntitySmileyCloud> {
|
||||||
|
|
||||||
|
public RenderSmileyCloud(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||||
|
super(rendererDispatcherIn);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntitySmileyCloud theCloud, double x, double y, double z, float par5, int partial, float f) {
|
public void render(TileEntitySmileyCloud theCloud, float partialTicks, MatrixStack matrices, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||||
if (theCloud instanceof TileEntitySmileyCloud) {
|
matrices.push();
|
||||||
|
// matrices.translate((float) x + 0.5F, (float) y - 0.5F, (float) z + 0.5F);
|
||||||
|
matrices.rotate(new Quaternion(180F, 0.0F, 0.0F, 1.0F));
|
||||||
|
matrices.translate(0.0F, -2F, 0.0F);
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
if (theCloud.name != null && !theCloud.name.isEmpty()) {
|
||||||
GlStateManager.translate((float) x + 0.5F, (float) y - 0.5F, (float) z + 0.5F);
|
boolean renderedEaster = false;
|
||||||
GlStateManager.rotate(180F, 0.0F, 0.0F, 1.0F);
|
|
||||||
GlStateManager.translate(0.0F, -2F, 0.0F);
|
|
||||||
|
|
||||||
if (theCloud.name != null && !theCloud.name.isEmpty()) {
|
easterEggs: for (ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.CLOUD_STUFF) {
|
||||||
boolean renderedEaster = false;
|
for (String triggerName : cloud.getTriggerNames()) {
|
||||||
|
if (triggerName != null && theCloud.name != null) {
|
||||||
|
if (triggerName.equalsIgnoreCase(theCloud.name)) {
|
||||||
|
matrices.push();
|
||||||
|
|
||||||
easterEggs: for (ISmileyCloudEasterEgg cloud : SmileyCloudEasterEggs.CLOUD_STUFF) {
|
BlockState state = theCloud.getWorld().getBlockState(theCloud.getPos());
|
||||||
for (String triggerName : cloud.getTriggerNames()) {
|
if (state.getBlock() == InitBlocks.blockSmileyCloud) {
|
||||||
if (triggerName != null && theCloud.name != null) {
|
switch (state.get(HorizontalBlock.HORIZONTAL_FACING)) {
|
||||||
if (triggerName.equalsIgnoreCase(theCloud.name)) {
|
|
||||||
GlStateManager.pushMatrix();
|
|
||||||
|
|
||||||
IBlockState state = theCloud.getWorld().getBlockState(theCloud.getPos());
|
|
||||||
if (state.getBlock() == InitBlocks.blockSmileyCloud) {
|
|
||||||
switch (state.getValue(BlockHorizontal.FACING)) {
|
|
||||||
case NORTH:
|
case NORTH:
|
||||||
GlStateManager.rotate(180, 0, 1, 0);
|
matrices.rotate(new Quaternion(180, 0, 1, 0));
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
GlStateManager.rotate(270, 0, 1, 0);
|
matrices.rotate(new Quaternion(270, 0, 1, 0));
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
GlStateManager.rotate(90, 0, 1, 0);
|
matrices.rotate(new Quaternion(90, 0, 1, 0));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cloud.renderExtra(0.0625F);
|
|
||||||
GlStateManager.popMatrix();
|
|
||||||
|
|
||||||
renderedEaster = true;
|
|
||||||
break easterEggs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cloud.renderExtra(0.0625F);
|
||||||
|
matrices.pop();
|
||||||
|
|
||||||
|
renderedEaster = true;
|
||||||
|
break easterEggs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String nameLower = theCloud.name.toLowerCase(Locale.ROOT);
|
String nameLower = theCloud.name.toLowerCase(Locale.ROOT);
|
||||||
if (SpecialRenderInit.SPECIAL_LIST.containsKey(nameLower)) {
|
if (SpecialRenderInit.SPECIAL_LIST.containsKey(nameLower)) {
|
||||||
RenderSpecial render = SpecialRenderInit.SPECIAL_LIST.get(nameLower);
|
RenderSpecial render = SpecialRenderInit.SPECIAL_LIST.get(nameLower);
|
||||||
if (render != null) {
|
if (render != null) {
|
||||||
GlStateManager.pushMatrix();
|
matrices.push();
|
||||||
GlStateManager.translate(0F, renderedEaster ? 0.05F : 0.25F, 0F);
|
matrices.translate(0F, renderedEaster ? 0.05F : 0.25F, 0F);
|
||||||
GlStateManager.rotate(180F, 1.0F, 0.0F, 1.0F);
|
matrices.rotate(new Quaternion(180F, 1.0F, 0.0F, 1.0F));
|
||||||
GlStateManager.scale(0.75F, 0.75F, 0.75F);
|
matrices.scale(0.75F, 0.75F, 0.75F);
|
||||||
render.render();
|
render.render();
|
||||||
GlStateManager.popMatrix();
|
matrices.pop();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GlStateManager.popMatrix();
|
}
|
||||||
|
matrices.pop();
|
||||||
|
|
||||||
Minecraft mc = Minecraft.getMinecraft();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
if (theCloud.name != null && !theCloud.name.isEmpty() && !mc.gameSettings.hideGUI) {
|
if (theCloud.name != null && !theCloud.name.isEmpty() && !mc.gameSettings.hideGUI) {
|
||||||
if (mc.player.getDistanceSq(theCloud.getPos()) <= 36) {
|
BlockPos pos = theCloud.getPos();
|
||||||
AssetUtil.renderNameTag(theCloud.name, x + 0.5F, y + 1.5F, z + 0.5F);
|
if (mc.player.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) <= 36) {
|
||||||
}
|
AssetUtil.renderNameTag(theCloud.name, pos.getX() + 0.5F, pos.getY() + 1.5F, pos.getZ() + 0.5F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +1,44 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
import javax.vecmath.Matrix3f;
|
|
||||||
import javax.vecmath.Matrix4f;
|
|
||||||
import javax.vecmath.Vector3f;
|
|
||||||
import javax.vecmath.Vector4f;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
//public class Transformer extends VertexTransformer {
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
//
|
||||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
// protected final Matrix4f transformation;
|
||||||
import net.minecraftforge.client.model.pipeline.VertexTransformer;
|
// protected final Matrix3f normalTransformation;
|
||||||
import net.minecraftforge.common.model.TRSRTransformation;
|
//
|
||||||
|
// public Transformer(TRSRTransformation transformation, VertexFormat format) {
|
||||||
public class Transformer extends VertexTransformer {
|
// super(new UnpackedBakedQuad.Builder(format));
|
||||||
|
// // position transform
|
||||||
protected final Matrix4f transformation;
|
// this.transformation = transformation.getMatrix();
|
||||||
protected final Matrix3f normalTransformation;
|
// // normal transform
|
||||||
|
// this.normalTransformation = new Matrix3f();
|
||||||
public Transformer(TRSRTransformation transformation, VertexFormat format) {
|
// this.transformation.getRotationScale(this.normalTransformation);
|
||||||
super(new UnpackedBakedQuad.Builder(format));
|
// this.normalTransformation.invert();
|
||||||
// position transform
|
// this.normalTransformation.transpose();
|
||||||
this.transformation = transformation.getMatrix();
|
// }
|
||||||
// normal transform
|
//
|
||||||
this.normalTransformation = new Matrix3f();
|
// @Override
|
||||||
this.transformation.getRotationScale(this.normalTransformation);
|
// public void put(int element, float... data) {
|
||||||
this.normalTransformation.invert();
|
// VertexFormatElement.EnumUsage usage = this.parent.getVertexFormat().getElement(element).getUsage();
|
||||||
this.normalTransformation.transpose();
|
//
|
||||||
}
|
// // transform normals and position
|
||||||
|
// if (usage == VertexFormatElement.EnumUsage.POSITION && data.length >= 3) {
|
||||||
@Override
|
// Vector4f vec = new Vector4f(data);
|
||||||
public void put(int element, float... data) {
|
// vec.setW(1.0f);
|
||||||
VertexFormatElement.EnumUsage usage = this.parent.getVertexFormat().getElement(element).getUsage();
|
// this.transformation.transform(vec);
|
||||||
|
// data = new float[4];
|
||||||
// transform normals and position
|
// vec.get(data);
|
||||||
if (usage == VertexFormatElement.EnumUsage.POSITION && data.length >= 3) {
|
// } else if (usage == VertexFormatElement.EnumUsage.NORMAL && data.length >= 3) {
|
||||||
Vector4f vec = new Vector4f(data);
|
// Vector3f vec = new Vector3f(data);
|
||||||
vec.setW(1.0f);
|
// this.normalTransformation.transform(vec);
|
||||||
this.transformation.transform(vec);
|
// vec.normalize();
|
||||||
data = new float[4];
|
// data = new float[4];
|
||||||
vec.get(data);
|
// vec.get(data);
|
||||||
} else if (usage == VertexFormatElement.EnumUsage.NORMAL && data.length >= 3) {
|
// }
|
||||||
Vector3f vec = new Vector3f(data);
|
// super.put(element, data);
|
||||||
this.normalTransformation.transform(vec);
|
// }
|
||||||
vec.normalize();
|
//
|
||||||
data = new float[4];
|
// public UnpackedBakedQuad build() {
|
||||||
vec.get(data);
|
// return ((UnpackedBakedQuad.Builder) this.parent).build();
|
||||||
}
|
// }
|
||||||
super.put(element, data);
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
public UnpackedBakedQuad build() {
|
|
||||||
return ((UnpackedBakedQuad.Builder) this.parent).build();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -11,6 +11,7 @@ import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import io.netty.util.internal.ConcurrentSet;
|
import io.netty.util.internal.ConcurrentSet;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
@ -34,7 +35,7 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles {
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isWearing(EntityPlayer player) {
|
public static boolean isWearing(PlayerEntity player) {
|
||||||
ItemStack face = player.inventory.armorInventory.get(3);
|
ItemStack face = player.inventory.armorInventory.get(3);
|
||||||
return StackUtil.isValid(face) && face.getItem() instanceof IGoggles;
|
return StackUtil.isValid(face) && face.getItem() instanceof IGoggles;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue