1.14.3: Fixed issue #35, issue #36, #37. 1.12: Treated Wood Side Table work in progress. 1.12: Release version prepared.

This commit is contained in:
stfwi 2019-07-06 15:28:16 +02:00
parent 8b99f38f17
commit d880b90a48
17 changed files with 535 additions and 260 deletions

View file

@ -8,7 +8,6 @@
*/
package wile.engineersdecor;
import net.minecraft.item.crafting.IRecipe;
import wile.engineersdecor.detail.*;
import wile.engineersdecor.blocks.*;
import wile.engineersdecor.items.*;
@ -21,6 +20,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.network.IGuiHandler;
@ -78,6 +78,7 @@ public class ModEngineersDecor
default void init(final FMLInitializationEvent e) {}
default void postInit(final FMLPostInitializationEvent e) {}
default World getWorlClientSide() { return null; }
default EntityPlayer getPlayerClientSide() { return null; }
}
//--------------------------------------------------------------------------------------------------------------------

View file

@ -13,6 +13,7 @@
*/
package wile.engineersdecor.blocks;
import net.minecraftforge.fml.common.Mod;
import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.detail.ModAuxiliaries;
import net.minecraft.block.SoundType;
@ -30,6 +31,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.entity.Entity;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
@ -58,9 +60,15 @@ public class BlockDecor extends Block
public static final long CFG_ANALOG = 0x0000000000040000L; // Denotes if a component has analog behaviour
public static final long CFG_HARD_IE_DEPENDENT = 0x8000000000000000L; // Defines that this block abolutely needs IE to be installed.
protected final AxisAlignedBB aabb;
protected final AxisAlignedBB[] aabb;
public BlockDecor(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound)
{ this(registryName, config, material, hardness, resistance, sound, (new AxisAlignedBB[]{FULL_BLOCK_AABB})); }
public BlockDecor(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound, @Nullable AxisAlignedBB boundingbox)
{ this(registryName, config, material, hardness, resistance, sound, (boundingbox==null) ? (new AxisAlignedBB[]{FULL_BLOCK_AABB}) : (new AxisAlignedBB[]{boundingbox})); }
public BlockDecor(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound, @Nonnull AxisAlignedBB[] boundingboxes)
{
super((material!=null) ? (material) : (Material.IRON));
setCreativeTab(ModEngineersDecor.CREATIVE_TAB_ENGINEERSDECOR);
@ -74,12 +82,9 @@ public class BlockDecor extends Block
// @todo double check that instance variable
// not sure here ... if((config & CFG_TRANSLUCENT) != 0) this.translucent = true;
this.config = config;
this.aabb = (boundingbox==null) ? (FULL_BLOCK_AABB) : (boundingbox);
this.aabb = boundingboxes;
}
public BlockDecor(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound)
{ this(registryName, config, material, hardness, resistance, sound, null); }
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag)
@ -166,12 +171,19 @@ public class BlockDecor extends Block
@Override
@SuppressWarnings("deprecation")
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{ return aabb; }
{ return aabb[0]; }
@SideOnly(Side.CLIENT)
@SuppressWarnings("deprecation")
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos)
{ return state.getBoundingBox(worldIn, pos).offset(pos); }
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos)
{ return state.getBoundingBox(world, pos).offset(pos); }
@SuppressWarnings("deprecation")
public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean isActualState)
{
addCollisionBoxToList(pos, entityBox, collidingBoxes, getBoundingBox(state, world, pos));
for(int i=1; i<aabb.length; ++i) addCollisionBoxToList(pos, entityBox, collidingBoxes, aabb[i]);
}
@Override
public boolean hasTileEntity(IBlockState state)

View file

@ -137,6 +137,13 @@ public class ModBlocks
ModAuxiliaries.getPixeledAABB(4.1,0,4.1, 11.8,8.8,11.8)
);
public static final BlockDecor TREATED_WOOD_SIDE_TABLE = new BlockDecor(
"treated_wood_side_table",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT,
Material.WOOD, 1.0f, 15f, SoundType.WOOD,
ModAuxiliaries.getPixeledAABB(2,0,2, 14,15.9,14)
);
public static final BlockDecorCraftingTable TREATED_WOOD_CRAFTING_TABLE = new BlockDecorCraftingTable(
"treated_wood_crafting_table",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT|BlockDecor.CFG_OPPOSITE_PLACEMENT,
@ -417,6 +424,7 @@ public class ModBlocks
THICK_STEEL_POLE_HEAD,
STEEL_DOUBLE_T_SUPPORT,
SIGN_HOTWIRE, SIGN_DANGER, SIGN_DEFENSE, SIGN_FACTORY_AREA, SIGN_MODLOGO,
TREATED_WOOD_SIDE_TABLE,
HALFSLAB_REBARCONCRETE, HALFSLAB_CONCRETE, HALFSLAB_TREATEDWOOD,
HALFSLAB_SHEETMETALIRON, HALFSLAB_SHEETMETALSTEEL, HALFSLAB_SHEETMETALCOPPER,
HALFSLAB_SHEETMETALGOLD, HALFSLAB_SHEETMETALALUMINIUM,

View file

@ -8,8 +8,9 @@
*/
package wile.engineersdecor.detail;
import net.minecraft.world.World;
import wile.engineersdecor.ModEngineersDecor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraft.client.Minecraft;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
@ -23,4 +24,9 @@ public class ClientProxy implements ModEngineersDecor.IProxy
@Override
public World getWorlClientSide()
{ return Minecraft.getMinecraft().world; }
@Override
public EntityPlayer getPlayerClientSide()
{ return Minecraft.getMinecraft().player; }
}