Panes, and fixes so no crashes in debug world

This commit is contained in:
Vincent Lee committed 2015-12-23 16:03:07 -06:00
1 parent 0887191a64
commit cfaeecc41a
19 files changed
+160 -23

No files matched your search

+3 -3
View File
@@ -14,13 +14,14 @@ Anyways, vanilla removed it from their method so we follow suit.
* Most things left untouched to make patches from upstream easier
* Most uses of chunkcoordinates directly convert blockpos (THANK YOU VAZKII FOR USING THEM). Remove creation of extra instances
since BlockPos'es are immutable and thus can be reused everywhere.
* Some really needed fields in EntityItem are private now. Reflection time :(. If this is a
* Some really needed fields in EntityItem are private now. Reflection time :(
* Alfglass now just uses the vanilla random model selection system to choose a pattern. Some of your builds may look different.
Unless someone figures out a way to use the old one
* The alt textures will probably be a resource pack now to decrease complexity...
sorry :/ The systems needed to dynamically switch out the textures like that is not worth just throwing them into a resource pack
* Slabs are kinda janky if you look at them - Mojang made some extremely silly assumptions and we're going to have to go with them
* Quartz stair textures may be assigned incorrectly - resource pack authors check me
* Glass pane inner faces are not getting culled
-- Todo --
* JSON models for everything (tedious/med-hard)
@@ -28,5 +29,4 @@ sorry :/ The systems needed to dynamically switch out the textures like that is
* For rendering arbitrary icons (that DO NOT HAVE AN ITEM) in a 3D style (manaResource icons, etc.)
- Sub to texture stitch and bake our own model there to use?
- This remains the largest portion of what is left
- Where is the method to render an arbitrary baked model?
* ItemBlocks seem to merge subtypes (shift clicking storage blocks onto each other)
- Where is the method to render an arbitrary baked model?
@@ -291,7 +291,9 @@ public final class ModelHandler {
}
private static void registerPanes() {
registerItemModel(ModFluffBlocks.alfglassPane);
registerItemModel(ModFluffBlocks.bifrostPane);
registerItemModel(ModFluffBlocks.managlassPane);
}
private static void registerPylons() {
@@ -76,7 +76,7 @@ public class RenderTileLightRelay extends TileEntitySpecialRenderer {
float f6 = 0.25F;
p_77026_1_.getWorldRenderer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
p_77026_1_.getWorldRenderer().putNormal(0.0F, 1.0F, 0.0F);
//p_77026_1_.getWorldRenderer().putNormal(0.0F, 1.0F, 0.0F);
//p_77026_1_.getWorldRenderer().setBrightness(240);
p_77026_1_.getWorldRenderer().pos(0.0F - f5, 0.0F - f6, 0.0D).tex(f, f3).endVertex();
p_77026_1_.getWorldRenderer().pos(f4 - f5, 0.0F - f6, 0.0D).tex(f1, f3).endVertex();
@@ -12,7 +12,11 @@ package vazkii.botania.common.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRailBase;
import net.minecraft.block.BlockRailPowered;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
@@ -34,6 +38,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockGhostRail extends BlockRailBase implements ILexiconable {
public static final PropertyEnum<EnumRailDirection> SHAPE = BlockRailPowered.SHAPE;
private static final String TAG_FLOAT_TICKS = "Botania_FloatTicks";
public BlockGhostRail() {
@@ -41,6 +46,22 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable {
setCreativeTab(BotaniaCreativeTab.INSTANCE);
MinecraftForge.EVENT_BUS.register(this);
setUnlocalizedName(LibBlockNames.GHOST_RAIL);
setDefaultState(blockState.getBaseState().withProperty(SHAPE, EnumRailDirection.NORTH_SOUTH));
}
@Override
public BlockState createBlockState() {
return new BlockState(this, SHAPE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(SHAPE).getMetadata();
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(SHAPE, EnumRailDirection.byMetadata(meta));
}
@Override
@@ -87,7 +108,7 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable {
}
@Override
public IProperty getShapeProperty() {
return null; // todo 1.8 ??
public IProperty<EnumRailDirection> getShapeProperty() {
return BlockRailPowered.SHAPE;
}
}
@@ -212,7 +212,7 @@ public abstract class BlockModDoubleFlower extends BlockBush implements IGrowabl
@Override
public void randomDisplayTick(World par1World, BlockPos pos, IBlockState state, Random par5Random) {
int hex = ((EnumDyeColor) state.getValue(BotaniaStateProps.COLOR)).getMapColor().colorValue;
int hex = ((EnumDyeColor) state.getValue(second ? BotaniaStateProps.DOUBLEFLOWER_VARIANT_2 : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1)).getMapColor().colorValue;
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
int b = (hex & 0xFF);
@@ -31,6 +31,6 @@ public class BlockModDoubleFlower1 extends BlockModDoubleFlower {
public IBlockState getStateFromMeta(int meta) {
BlockDoublePlant.EnumBlockHalf half = (meta & 8) > 0 ? BlockDoublePlant.EnumBlockHalf.UPPER : BlockDoublePlant.EnumBlockHalf.LOWER;
meta &= -9;
return getDefaultState().withProperty(HALF, half).withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_2, EnumDyeColor.byMetadata(meta));
return getDefaultState().withProperty(HALF, half).withProperty(BotaniaStateProps.DOUBLEFLOWER_VARIANT_1, EnumDyeColor.byMetadata(meta));
}
}
@@ -69,6 +69,6 @@ public class BlockBuriedPetals extends BlockModFlower {
@Override
public int getRenderType() {
return 0;
return -1;
}
}
@@ -10,6 +10,7 @@
*/
package vazkii.botania.common.block.decor.panes;
import net.minecraft.util.EnumWorldBlockLayer;
import vazkii.botania.common.block.ModBlocks;
public class BlockAlfglassPane extends BlockModPane {
@@ -18,4 +19,8 @@ public class BlockAlfglassPane extends BlockModPane {
super(ModBlocks.elfGlass);
}
@Override
public EnumWorldBlockLayer getBlockLayer() {
return EnumWorldBlockLayer.TRANSLUCENT;
}
}
@@ -10,6 +10,7 @@
*/
package vazkii.botania.common.block.decor.panes;
import net.minecraft.util.EnumWorldBlockLayer;
import vazkii.botania.common.block.ModBlocks;
public class BlockBifrostPane extends BlockModPane {
@@ -18,4 +19,8 @@ public class BlockBifrostPane extends BlockModPane {
super(ModBlocks.bifrostPerm);
}
@Override
public EnumWorldBlockLayer getBlockLayer() {
return EnumWorldBlockLayer.TRANSLUCENT;
}
}
@@ -10,6 +10,7 @@
*/
package vazkii.botania.common.block.decor.panes;
import net.minecraft.util.EnumWorldBlockLayer;
import vazkii.botania.common.block.ModBlocks;
public class BlockManaglassPane extends BlockModPane {
@@ -18,4 +19,9 @@ public class BlockManaglassPane extends BlockModPane {
super(ModBlocks.manaGlass);
}
@Override
public EnumWorldBlockLayer getBlockLayer() {
return EnumWorldBlockLayer.TRANSLUCENT;
}
}
@@ -49,11 +49,6 @@ public class BlockModPane extends BlockPane {
return false;
}
@Override
public int getRenderType() {
return 18;
}
@Override
public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir) {
Block block = world.getBlockState(pos).getBlock();
@@ -52,12 +52,12 @@ public class BlockBellows extends BlockModContainer implements ILexiconable {
@Override
public int getMetaFromState(IBlockState state) {
return ((EnumFacing) state.getValue(BotaniaStateProps.CARDINALS)).getHorizontalIndex();
return ((EnumFacing) state.getValue(BotaniaStateProps.CARDINALS)).getIndex();
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.getHorizontal(meta));
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.getFront(meta));
}
@Override
@@ -41,7 +41,7 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver, ITickable
private static final Field spawnDelay = ReflectionHelper.findField(MobSpawnerBaseLogic.class, LibObfuscation.SPAWN_DELAY);
private static final Field mobRotation = ReflectionHelper.findField(MobSpawnerBaseLogic.class, LibObfuscation.MOB_ROTATION);
private static final Field prevMobRotation = ReflectionHelper.findField(MobSpawnerBaseLogic.class, LibObfuscation.PREV_MOB_ROTATION);
private static final Method spawnNewEntity = ReflectionHelper.findMethod(MobSpawnerBaseLogic.class, null, LibObfuscation.SPAWN_NEW_ENTITY);
private static final Method spawnNewEntity = ReflectionHelper.findMethod(MobSpawnerBaseLogic.class, null, LibObfuscation.SPAWN_NEW_ENTITY, Entity.class, boolean.class);
private static final Method getEntityNameToSpawn = ReflectionHelper.findMethod(MobSpawnerBaseLogic.class, null, LibObfuscation.GET_ENTITY_TO_SPAWN);
@Override
@@ -116,8 +116,9 @@ public class TileBellows extends TileMod implements ITickable {
}
public TileEntity getLinkedTile() {
EnumFacing side = ((EnumFacing) worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.CARDINALS));
return worldObj.getTileEntity(getPos().offset(side));
return null;
// EnumFacing side = ((EnumFacing) worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.CARDINALS));
// return worldObj.getTileEntity(getPos().offset(side));
}
@Override
@@ -15,6 +15,7 @@ import net.minecraft.util.ITickable;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.common.Loader;
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.common.block.tile.TileMod;
import cofh.api.energy.IEnergyConnection;
@@ -47,9 +48,8 @@ public class TileRFGenerator extends TileMod implements IManaReceiver, IEnergyCo
}
@Override
@Optional.Method(modid = "CoFHAPI|energy")
public void update() {
if(!worldObj.isRemote) {
if(!worldObj.isRemote && Loader.isModLoaded("CoFHAPI|energy")) {
if(deadCache)
reCache();
@@ -0,0 +1,34 @@
{
"forge_marker": 1,
"defaults": {
"textures": {
"edge": "botania:blocks/bifrostPermPane",
"pane": "botania:blocks/bifrost"
}
},
"variants": {
"east=false,north=false,south=false,west=false": { "model": "minecraft:pane_nsew" },
"east=false,north=true,south=false,west=false": { "model": "minecraft:pane_n" },
"east=true,north=false,south=false,west=false": { "model": "minecraft:pane_n", "y": 90 },
"east=false,north=false,south=true,west=false": { "model": "minecraft:pane_n", "y": 180 },
"east=false,north=false,south=false,west=true": { "model": "minecraft:pane_n", "y": 270 },
"east=true,north=true,south=false,west=false": { "model": "minecraft:pane_ne" },
"east=true,north=false,south=true,west=false": { "model": "minecraft:pane_ne", "y": 90 },
"east=false,north=false,south=true,west=true": { "model": "minecraft:pane_ne", "y": 180 },
"east=false,north=true,south=false,west=true": { "model": "minecraft:pane_ne", "y": 270 },
"east=false,north=true,south=true,west=false": { "model": "minecraft:pane_ns" },
"east=true,north=false,south=false,west=true": { "model": "minecraft:pane_ns", "y": 90 },
"east=true,north=true,south=true,west=false": { "model": "minecraft:pane_nse" },
"east=true,north=false,south=true,west=true": { "model": "minecraft:pane_nse", "y": 90 },
"east=false,north=true,south=true,west=true": { "model": "minecraft:pane_nse", "y": 180 },
"east=true,north=true,south=false,west=true": { "model": "minecraft:pane_nse", "y": 270 },
"east=true,north=true,south=true,west=true": { "model": "minecraft:pane_nsew" },
"inventory": [{
"transform": "forge:default-item",
"model": "builtin/generated",
"textures": {
"layer0": "botania:blocks/bifrost"
}
}]
}
}
@@ -0,0 +1,34 @@
{
"forge_marker": 1,
"defaults": {
"textures": {
"edge": "botania:blocks/elfGlassPane",
"pane": "botania:blocks/elfGlass"
}
},
"variants": {
"east=false,north=false,south=false,west=false": { "model": "minecraft:pane_nsew" },
"east=false,north=true,south=false,west=false": { "model": "minecraft:pane_n" },
"east=true,north=false,south=false,west=false": { "model": "minecraft:pane_n", "y": 90 },
"east=false,north=false,south=true,west=false": { "model": "minecraft:pane_n", "y": 180 },
"east=false,north=false,south=false,west=true": { "model": "minecraft:pane_n", "y": 270 },
"east=true,north=true,south=false,west=false": { "model": "minecraft:pane_ne" },
"east=true,north=false,south=true,west=false": { "model": "minecraft:pane_ne", "y": 90 },
"east=false,north=false,south=true,west=true": { "model": "minecraft:pane_ne", "y": 180 },
"east=false,north=true,south=false,west=true": { "model": "minecraft:pane_ne", "y": 270 },
"east=false,north=true,south=true,west=false": { "model": "minecraft:pane_ns" },
"east=true,north=false,south=false,west=true": { "model": "minecraft:pane_ns", "y": 90 },
"east=true,north=true,south=true,west=false": { "model": "minecraft:pane_nse" },
"east=true,north=false,south=true,west=true": { "model": "minecraft:pane_nse", "y": 90 },
"east=false,north=true,south=true,west=true": { "model": "minecraft:pane_nse", "y": 180 },
"east=true,north=true,south=false,west=true": { "model": "minecraft:pane_nse", "y": 270 },
"east=true,north=true,south=true,west=true": { "model": "minecraft:pane_nsew" },
"inventory": [{
"transform": "forge:default-item",
"model": "builtin/generated",
"textures": {
"layer0": "botania:blocks/elfGlass"
}
}]
}
}
@@ -0,0 +1,34 @@
{
"forge_marker": 1,
"defaults": {
"textures": {
"edge": "botania:blocks/manaGlassPane",
"pane": "botania:blocks/manaGlass"
}
},
"variants": {
"east=false,north=false,south=false,west=false": { "model": "minecraft:pane_nsew" },
"east=false,north=true,south=false,west=false": { "model": "minecraft:pane_n" },
"east=true,north=false,south=false,west=false": { "model": "minecraft:pane_n", "y": 90 },
"east=false,north=false,south=true,west=false": { "model": "minecraft:pane_n", "y": 180 },
"east=false,north=false,south=false,west=true": { "model": "minecraft:pane_n", "y": 270 },
"east=true,north=true,south=false,west=false": { "model": "minecraft:pane_ne" },
"east=true,north=false,south=true,west=false": { "model": "minecraft:pane_ne", "y": 90 },
"east=false,north=false,south=true,west=true": { "model": "minecraft:pane_ne", "y": 180 },
"east=false,north=true,south=false,west=true": { "model": "minecraft:pane_ne", "y": 270 },
"east=false,north=true,south=true,west=false": { "model": "minecraft:pane_ns" },
"east=true,north=false,south=false,west=true": { "model": "minecraft:pane_ns", "y": 90 },
"east=true,north=true,south=true,west=false": { "model": "minecraft:pane_nse" },
"east=true,north=false,south=true,west=true": { "model": "minecraft:pane_nse", "y": 90 },
"east=false,north=true,south=true,west=true": { "model": "minecraft:pane_nse", "y": 180 },
"east=true,north=true,south=false,west=true": { "model": "minecraft:pane_nse", "y": 270 },
"east=true,north=true,south=true,west=true": { "model": "minecraft:pane_nsew" },
"inventory": [{
"transform": "forge:default-item",
"model": "builtin/generated",
"textures": {
"layer0": "botania:blocks/manaGlass"
}
}]
}
}
@@ -17,7 +17,7 @@
"facing=south,half=bottom,shape=outer_right": { "model": "minecraft:outer_stairs", "y": 90, "uvlock": true },
"facing=north,half=bottom,shape=outer_right": { "model": "minecraft:outer_stairs", "y": 270, "uvlock": true },
"facing=east,half=bottom,shape=outer_left": { "model": "minecraft:outer_stairs", "y": 270, "uvlock": true },
"facing=west,half=bottom,shape=outer_left": { "model": "mdinecraft:outer_stairs", "y": 90, "uvlock": true },
"facing=west,half=bottom,shape=outer_left": { "model": "minecraft:outer_stairs", "y": 90, "uvlock": true },
"facing=south,half=bottom,shape=outer_left": { "model": "minecraft:outer_stairs" },
"facing=north,half=bottom,shape=outer_left": { "model": "minecraft:outer_stairs", "y": 180, "uvlock": true },
"facing=east,half=bottom,shape=inner_right": { "model": "minecraft:inner_stairs" },