Added steel framed glass window, treated pole supports, mod config options. Fixed minor model issues.

This commit is contained in:
stfwi 2019-03-31 17:40:04 +02:00
parent 8301658889
commit bc90f4779b
37 changed files with 1184 additions and 146 deletions

View file

@ -11,17 +11,16 @@ package wile.engineersdecor;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.fml.common.network.IGuiHandler;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import wile.engineersdecor.blocks.BlockDecorCraftingTable;
import wile.engineersdecor.blocks.BlockDecorFurnace;
import wile.engineersdecor.blocks.BlockDecorLadder;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import wile.engineersdecor.blocks.*;
import wile.engineersdecor.detail.ModConfig;
import wile.engineersdecor.blocks.ModBlocks;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
@ -93,6 +92,7 @@ public class ModEngineersDecor
{
proxy.init(event);
NetworkRegistry.INSTANCE.registerGuiHandler(this, new ModEngineersDecor.GuiHandler());
EntityRegistry.registerModEntity(new ResourceLocation(ModEngineersDecor.MODID, "chair_entity"), BlockDecorChair.EntityChair.class,"DecorChair",0,this,80,1,false);
}
@Mod.EventHandler

View file

@ -46,13 +46,16 @@ public class BlockDecor extends Block
public static final long CFG_HORIZIONTAL = 0x0000000000000002L; // horizontal block, affects bounding box calculation at construction time and placement
public static final long CFG_LOOK_PLACEMENT = 0x0000000000000004L; // placed in direction the player is looking when placing.
public static final long CFG_FACING_PLACEMENT = 0x0000000000000008L; // placed on the facing the player has clicked.
public static final long CFG_OPPOSITE_PLACEMENT = 0x0000000000000020L; // placed placed in the opposite direction of the face the player clicked.
public static final long CFG_OPPOSITE_PLACEMENT = 0x0000000000000010L; // placed placed in the opposite direction of the face the player clicked.
public static final long CFG_FLIP_PLACEMENT_IF_SAME = 0x0000000000000020L; // placement direction flipped if an instance of the same class was clicked
public static final long CFG_TRANSLUCENT = 0x0000000000000040L; // indicates a block/pane is glass like (transparent, etc)
public static final long CFG_LIGHT_VALUE_MASK = 0x0000000000000f00L; // fixed value for getLightValue()
public static final long CFG_LIGHT_VALUE_SHIFT = 8L;
public static final long CFG_LAB_FURNACE_CRUDE = 0x0000000000010000L; // For DecorFurnace, denotes that it is a crude furnace.
public BlockDecor(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound)
protected final AxisAlignedBB aabb;
public BlockDecor(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound, @Nullable AxisAlignedBB boundingbox)
{
super((material!=null) ? (material) : (Material.IRON));
setCreativeTab(ModEngineersDecor.CREATIVE_TAB_ENGINEERSDECOR);
@ -64,13 +67,11 @@ public class BlockDecor extends Block
setSoundType((sound==null) ? SoundType.STONE : sound);
setLightOpacity(0);
this.config = config;
this.aabb = (boundingbox==null) ? (FULL_BLOCK_AABB) : (boundingbox);
}
@Override
@Nullable
@SuppressWarnings("deprecation")
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos)
{ return getBoundingBox(state, world, pos); }
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)
@ -144,6 +145,17 @@ public class BlockDecor extends Block
public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
{ return state; }
@Override
@Nullable
@SuppressWarnings("deprecation")
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos)
{ return getBoundingBox(state, world, pos); }
@Override
@SuppressWarnings("deprecation")
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
{ return aabb; }
@Override
public boolean hasTileEntity(IBlockState state)
{ return false; }

View file

@ -10,17 +10,143 @@ package wile.engineersdecor.blocks;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import wile.engineersdecor.ModEngineersDecor;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Random;
public class BlockDecorChair extends BlockDecorDirected
{
public BlockDecorChair(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound, @Nonnull AxisAlignedBB unrotatedAABB)
private static boolean sitting_enabled = true;
private static double sitting_probability = 0.1;
private static double standup_probability = 0.01;
public static void on_config(boolean without_sitting, boolean without_mob_sitting, double sitting_probability_percent, double standup_probability_percent)
{
super(registryName, config, material, hardness, resistance, sound, unrotatedAABB);
setLightOpacity(0);
sitting_enabled = (!without_sitting);
sitting_probability = (without_sitting||without_mob_sitting) ? 0.0 : MathHelper.clamp(sitting_probability_percent/100, 0, 0.9);
standup_probability = (without_sitting||without_mob_sitting) ? 1.0 : MathHelper.clamp(standup_probability_percent/100, 1e-6, 1e-2);
ModEngineersDecor.logger.info("Config chairs: " + sitting_enabled + ", sit: " + sitting_probability, ", stand up: " + standup_probability);
}
public BlockDecorChair(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound, @Nonnull AxisAlignedBB unrotatedAABB)
{ super(registryName, config, material, hardness, resistance, sound, unrotatedAABB); setLightOpacity(0); setTickRandomly(true); }
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{ if(sitting_enabled && (!world.isRemote)) { EntityChair.sit(world, player, pos); } return true; }
@Override
public void onEntityCollision(World world, BlockPos pos, IBlockState state, Entity entity)
{ if(sitting_enabled && (Math.random() < sitting_probability) && (entity instanceof EntityMob)) EntityChair.sit(world, (EntityLivingBase)entity, pos); }
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand)
{
if((!sitting_enabled) || (sitting_probability < 1e-6)) return;
final List<EntityLivingBase> entities = world.getEntitiesWithinAABB(EntityMob.class, new AxisAlignedBB(pos).grow(2,1,2).expand(0,1,0));
if(entities.isEmpty()) return;
int index = rand.nextInt(entities.size());
if((index < 0) || (index >= entities.size())) return;
EntityChair.sit(world, entities.get(index), pos);
}
//--------------------------------------------------------------------------------------------------------------------
// Riding entity for sitting
//--------------------------------------------------------------------------------------------------------------------
public static class EntityChair extends Entity
{
public final double x_offset = 0.5d;
public final double y_offset = 0.4d;
public final double z_offset = 0.5d;
private int t_tick = 0;
private int t_sit = 0;
public BlockPos chair_pos = new BlockPos(0,0,0);
public EntityChair(World world)
{ super(world); preventEntitySpawning=true; noClip=true; setSize(2e-3f, 2e-3f); }
public EntityChair(World world, BlockPos pos)
{
this(world);
setPosition(pos.getX()+x_offset,pos.getY()+y_offset,pos.getZ()+z_offset);
chair_pos = pos;
t_sit = 5;
}
public static boolean accepts_mob(EntityLivingBase entity)
{
if(!(entity instanceof net.minecraft.entity.monster.EntityMob)) return false;
if((entity.height > 2.5) || (entity.width > 2.0)) return false;
if(entity instanceof net.minecraft.entity.monster.EntityZombie) return true;
if(entity instanceof net.minecraft.entity.monster.EntityZombieVillager) return true;
if(entity instanceof net.minecraft.entity.monster.EntityPigZombie) return true;
if(entity instanceof net.minecraft.entity.monster.EntityHusk) return true;
if(entity instanceof net.minecraft.entity.monster.EntityStray) return true;
if(entity instanceof net.minecraft.entity.monster.EntitySkeleton) return true;
if(entity instanceof net.minecraft.entity.monster.EntityWitherSkeleton) return true;
return false;
}
public static void sit(World world, EntityLivingBase sitter, BlockPos pos)
{
if(!sitting_enabled) return;
if((world==null) || (world.isRemote) || (sitter==null) || (pos==null)) return;
if((!(sitter instanceof EntityPlayer)) && (!accepts_mob(sitter))) return;
if(!world.getEntitiesWithinAABB(EntityChair.class, new AxisAlignedBB(pos)).isEmpty()) return;
if(sitter.isBeingRidden() || (sitter.isDead) || (sitter.isRiding())) return;
if((!world.isAirBlock(pos.up())) || (!world.isAirBlock(pos.up(2)))) return;
EntityChair chair = new EntityChair(world, pos);
if(world.spawnEntity(chair)) sitter.startRiding(chair);
}
@Override
protected void entityInit()
{}
@Override
protected void writeEntityToNBT(NBTTagCompound compound)
{}
@Override
protected void readEntityFromNBT(NBTTagCompound compound)
{}
@Override
public double getMountedYOffset()
{ return 0.0; }
@Override
public void onUpdate()
{
if((world.isRemote) || (--t_tick > 0)) return;
t_tick = 20;
if(--t_sit > 0) return;
Entity sitter = getPassengers().isEmpty() ? null : getPassengers().get(0);
if((sitter==null) || (sitter.isDead)) { setDead(); return; }
boolean abort = !sitting_enabled;
final IBlockState state = world.getBlockState(chair_pos);
if((state==null) || (!(state.getBlock() instanceof BlockDecorChair))) abort = true;
if(!world.isAirBlock(chair_pos.up())) abort = true;
if((!(sitter instanceof EntityPlayer)) && (Math.random() < standup_probability)) abort = true;
if(abort) {
for(Entity e:getPassengers()) e.dismountRidingEntity();
setDead();
}
}
}
}

View file

@ -1,10 +1,11 @@
/*
* @file BlockDecorFull.java
* @file BlockDecorCraftingTable.java
* @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT)
*
* Full block characteristics class.
* Mod crafting table, different style, UI and fetature set
* than vanilla crafting table.
*/
package wile.engineersdecor.blocks;

View file

@ -222,7 +222,7 @@ public class BlockDecorFurnace extends BlockDecorDirected
{ final int tc=te.getField(2), T=te.getField(3); return ((T>0) && (tc>0)) ? (tc * pixels / T) : (0); }
private int flame_px(int pixels)
{ int ibt = te.getField(1); return ((te.getField(0) * pixels) / ((ibt>0) ? (ibt) : (te.proc_speed_interval_))); }
{ int ibt = te.getField(1); return ((te.getField(0) * pixels) / ((ibt>0) ? (ibt) : (BTileEntity.proc_speed_interval_))); }
}
//--------------------------------------------------------------------------------------------------------------------
@ -455,22 +455,31 @@ public class BlockDecorFurnace extends BlockDecorDirected
private final IItemHandler sided_itemhandler_down_ = new SidedInvWrapper(this, EnumFacing.DOWN);
private final IItemHandler sided_itemhandler_sides_ = new SidedInvWrapper(this, EnumFacing.WEST);
private static int proc_speed_interval_ = DEFAULT_SPEED_INTERVAL;
private static double proc_fuel_efficiency_ = 1.0;
private int tick_timer_;
private int fifo_timer_;
private int burntime_left_;
private int fuel_burntime_;
private int proc_time_elapsed_;
private int proc_time_needed_;
private int proc_speed_interval_;
private NonNullList<ItemStack> stacks_;
public static void on_config(int speed_percent, int fuel_efficiency_percent)
{
double ratio = (100.0 / MathHelper.clamp(speed_percent, 10, 500)) ;
proc_speed_interval_ = MathHelper.clamp((int)(ratio * VANILLA_FURNACE_SPEED_INTERVAL), 20, 400);
proc_fuel_efficiency_ = ((double) MathHelper.clamp(fuel_efficiency_percent, 10, 500)) / 100;
ModEngineersDecor.logger.info("Config lab furnace interval:" + proc_speed_interval_ + ", efficiency:" + proc_fuel_efficiency_);
}
public BTileEntity()
{ reset(); }
public void reset()
{
stacks_ = NonNullList.<ItemStack>withSize(NUM_OF_SLOTS, ItemStack.EMPTY);
proc_speed_interval_ = DEFAULT_SPEED_INTERVAL;
proc_time_elapsed_ = 0;
proc_time_needed_ = 0;
burntime_left_ = 0;
@ -658,8 +667,8 @@ public class BlockDecorFurnace extends BlockDecorDirected
ItemStack fuel = stacks_.get(SMELTING_FUEL_SLOT_NO);
if(isBurning() || (!fuel.isEmpty()) && (!(stacks_.get(SMELTING_INPUT_SLOT_NO)).isEmpty())) {
if(!isBurning() && canSmelt()) {
burntime_left_ = getItemBurnTime(fuel);
fuel_burntime_ = ((burntime_left_ * proc_speed_interval_) / VANILLA_FURNACE_SPEED_INTERVAL);
burntime_left_ = (int)MathHelper.clamp((proc_fuel_efficiency_ * getItemBurnTime(fuel)), 0, MAX_BURNTIME);
fuel_burntime_ = (burntime_left_ * proc_speed_interval_) / VANILLA_FURNACE_SPEED_INTERVAL;
if(isBurning()) {
dirty = true;
if(!fuel.isEmpty()) {

View file

@ -1,10 +1,10 @@
/*
* @file BlockDecorFull.java
* @file BlockDecorGlassBlock.java
* @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT)
*
* Full block characteristics class.
* Full block-size glass blocks.
*/
package wile.engineersdecor.blocks;

View file

@ -44,7 +44,11 @@ public class BlockDecorLadder extends BlockLadder
protected static final AxisAlignedBB EDLADDER_EAST_AABB = ModAuxiliaries.getRotatedAABB(EDLADDER_SOUTH_AABB, EnumFacing.EAST, false);
protected static final AxisAlignedBB EDLADDER_WEST_AABB = ModAuxiliaries.getRotatedAABB(EDLADDER_SOUTH_AABB, EnumFacing.WEST, false);
protected static final AxisAlignedBB EDLADDER_NORTH_AABB = ModAuxiliaries.getRotatedAABB(EDLADDER_SOUTH_AABB, EnumFacing.NORTH, false);
protected static final double ladder_speed = 0.7;
protected static boolean with_ladder_speed_boost = true;
public static final void on_config(boolean without_ladder_speed_boost)
{ with_ladder_speed_boost = !without_ladder_speed_boost; }
public BlockDecorLadder(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound)
{
@ -113,15 +117,16 @@ public class BlockDecorLadder extends BlockLadder
// Player update event, forwarded from the main mod instance.
public static void onPlayerUpdateEvent(final EntityPlayer player)
{
if(!with_ladder_speed_boost) return;
if(!player.isOnLadder() || (player.isSneaking()) || (player.isSpectator())) return;
if((Math.abs(player.motionY) < 0.1) || (Math.abs(player.motionY) > 0.7) || ((player.getLookVec().y > 0) != (player.motionY > 0))) return;
if((Math.abs(player.motionY) < 0.1) || (Math.abs(player.motionY) > ladder_speed) || ((player.getLookVec().y > 0) != (player.motionY > 0))) return;
if(Math.abs(player.getLookVec().y) < 0.9) return;
final BlockPos pos = new BlockPos(player.posX, player.posY, player.posZ);
if(!(player.world.getBlockState(pos).getBlock() instanceof BlockDecorLadder)) return;
player.fallDistance = 0;
player.motionY = (player.motionY < -0.25) ? (-0.7) : ((player.motionY > 0.25) ? (0.7) : (player.motionY));
player.motionX = MathHelper.clamp(player.motionX, -0.15, 0.15);
player.motionZ = MathHelper.clamp(player.motionX, -0.15, 0.15);
player.motionY = (player.motionY < -0.25) ? (-ladder_speed) : ((player.motionY > 0.25) ? (ladder_speed) : (player.motionY));
player.motionX = MathHelper.clamp(player.motionX, -0.05, 0.05);
player.motionZ = MathHelper.clamp(player.motionZ, -0.05, 0.05);
player.move(MoverType.PLAYER, player.motionX, player.motionY, player.motionZ);
}
}

View file

@ -0,0 +1,40 @@
/*
* @file BlockDecorStraightPole.java
* @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT)
*
* Smaller (cutout) block with a defined facing.
*/
package wile.engineersdecor.blocks;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.World;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class BlockDecorStraightPole extends BlockDecorDirected
{
public BlockDecorStraightPole(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound, @Nonnull AxisAlignedBB unrotatedAABB)
{ super(registryName, config, material, hardness, resistance, sound, unrotatedAABB); }
@Override
@SuppressWarnings("deprecation")
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
IBlockState state = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer);
if((config & CFG_FLIP_PLACEMENT_IF_SAME) != 0) {
if(world.getBlockState(pos.offset(facing.getOpposite())).getBlock() instanceof BlockDecorStraightPole) {
state = state.withProperty(FACING, state.getValue(FACING).getOpposite());
}
}
return state;
}
}

View file

@ -66,7 +66,7 @@ public class BlockDecorWall extends BlockDecor
new AxisAlignedBB(d_0, d_0, d_0, d_1, d_1, d_b),
new AxisAlignedBB(d_0, d_0, d_0, d_1, d_1, d_1)
};
private static final double clip_height = 1.5d;
private static final double clip_height = 1.8d;
protected static final AxisAlignedBB[] CLIP_AABB_BY_INDEX = new AxisAlignedBB[] { AABB_BY_INDEX[0].setMaxY(clip_height), AABB_BY_INDEX[1].setMaxY(clip_height), AABB_BY_INDEX[2].setMaxY(clip_height), AABB_BY_INDEX[3].setMaxY(clip_height), AABB_BY_INDEX[4].setMaxY(clip_height), AABB_BY_INDEX[5].setMaxY(clip_height), AABB_BY_INDEX[6].setMaxY(clip_height), AABB_BY_INDEX[7].setMaxY(clip_height), AABB_BY_INDEX[8].setMaxY(clip_height), AABB_BY_INDEX[9].setMaxY(clip_height), AABB_BY_INDEX[10].setMaxY(clip_height), AABB_BY_INDEX[11].setMaxY(clip_height), AABB_BY_INDEX[12].setMaxY(clip_height), AABB_BY_INDEX[13].setMaxY(clip_height), AABB_BY_INDEX[14].setMaxY(clip_height), AABB_BY_INDEX[15].setMaxY(clip_height) };
public BlockDecorWall(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound)

View file

@ -0,0 +1,59 @@
/*
* @file BlockDecorWindow.java
* @author Stefan Wilhelm (wile)
* @copyright (C) 2019 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT)
*
* Mod windows.
*/
package wile.engineersdecor.blocks;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class BlockDecorWindow extends BlockDecorDirected
{
public BlockDecorWindow(@Nonnull String registryName, long config, @Nullable Material material, float hardness, float resistance, @Nullable SoundType sound, @Nonnull AxisAlignedBB unrotatedAABB)
{ super(registryName, config, material, hardness, resistance, sound, unrotatedAABB); }
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getRenderLayer()
{ return BlockRenderLayer.TRANSLUCENT; }
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
{ return true; }
@Override
public boolean isFullCube(IBlockState state)
{ return false; }
@Override
public boolean isNormalCube(IBlockState state)
{ return false; }
@Override
public boolean isOpaqueCube(IBlockState state)
{ return false; }
@Override
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
{ return false; }
@Override
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer)
{ return (layer==BlockRenderLayer.TRANSLUCENT) || (layer==BlockRenderLayer.CUTOUT); }
}

View file

@ -12,18 +12,18 @@
*/
package wile.engineersdecor.blocks;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.detail.ModAuxiliaries;
import wile.engineersdecor.detail.ModConfig;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.ResourceLocation;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -57,17 +57,32 @@ public class ModBlocks
public static final BlockDecorGlassBlock PANZERGLASS_BLOCK = new BlockDecorGlassBlock("panzerglass_block", 0, Material.GLASS, 0.8f, 2000f, SoundType.GLASS);
public static final BlockDecorDirected TREATED_WOOD_POLE = new BlockDecorDirected(
public static final BlockDecorStraightPole TREATED_WOOD_POLE = new BlockDecorStraightPole(
"treated_wood_pole",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT,
Material.WOOD, 1.0f, 15f, SoundType.WOOD,
ModAuxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16)
);
public static final BlockDecorStraightPole TREATED_WOOD_POLE_HEAD = new BlockDecorStraightPole(
"treated_wood_pole_head",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME,
Material.WOOD, 1.0f, 15f, SoundType.WOOD,
ModAuxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16)
);
public static final BlockDecorStraightPole TREATED_WOOD_POLE_SUPPORT = new BlockDecorStraightPole(
"treated_wood_pole_support",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_FACING_PLACEMENT|BlockDecor.CFG_FLIP_PLACEMENT_IF_SAME,
Material.WOOD, 1.0f, 15f, SoundType.WOOD,
ModAuxiliaries.getPixeledAABB(5.8,5.8,0, 10.2,10.2,16)
);
public static final BlockDecor TREATED_WOOD_TABLE = new BlockDecor(
"treated_wood_table",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT,
Material.WOOD, 1.0f, 15f, SoundType.WOOD
Material.WOOD, 1.0f, 15f, SoundType.WOOD,
ModAuxiliaries.getPixeledAABB(1,0,1, 15,15.9,15)
);
public static final BlockDecorChair TREATED_WOOD_STOOL = new BlockDecorChair(
@ -81,7 +96,7 @@ public class ModBlocks
"treated_wood_crafting_table",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT,
Material.WOOD, 1.0f, 15f, SoundType.WOOD,
ModAuxiliaries.getPixeledAABB(0.0,0,0, 16,15.9,16)
ModAuxiliaries.getPixeledAABB(1,0,1, 15,15.9,15)
);
public static final BlockDecorDirected INSET_LIGHT_IRON = new BlockDecorDirected(
@ -98,13 +113,20 @@ public class ModBlocks
ModAuxiliaries.getPixeledAABB(0.5,15,10.5, 15.5,16,16)
);
public static final BlockDecorDirected TREATED_WOOD_WINDOW = new BlockDecorDirected(
public static final BlockDecorWindow TREATED_WOOD_WINDOW = new BlockDecorWindow(
"treated_wood_window",
BlockDecor.CFG_TRANSLUCENT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT,
BlockDecor.CFG_TRANSLUCENT|BlockDecor.CFG_LOOK_PLACEMENT,
Material.WOOD, 0.5f, 15f, SoundType.GLASS,
ModAuxiliaries.getPixeledAABB(0,0,7, 16,16,9)
);
public static final BlockDecorWindow STEEL_FRAMED_WINDOW = new BlockDecorWindow(
"steel_framed_window",
BlockDecor.CFG_TRANSLUCENT|BlockDecor.CFG_LOOK_PLACEMENT,
Material.IRON, 0.5f, 30f, SoundType.GLASS,
ModAuxiliaries.getPixeledAABB(0,0,7.5, 16,16,8.5)
);
public static final BlockDecorFurnace SMALL_LAB_FURNACE = new BlockDecorFurnace(
"small_lab_furnace",
BlockDecor.CFG_CUTOUT|BlockDecor.CFG_HORIZIONTAL|BlockDecor.CFG_LOOK_PLACEMENT,
@ -140,6 +162,9 @@ public class ModBlocks
TREATED_WOOD_WINDOWSILL,
INSET_LIGHT_IRON,
SMALL_LAB_FURNACE,
STEEL_FRAMED_WINDOW,
TREATED_WOOD_POLE_SUPPORT,
TREATED_WOOD_POLE_HEAD
};
private static final Block devBlocks[] = {
@ -174,6 +199,7 @@ public class ModBlocks
if(num_registrations_skipped > 0) {
ModEngineersDecor.logger.info("Skipped registration of " + num_registrations_skipped + " blocks due to no-register-opt-out config.");
}
// TEs
GameRegistry.registerTileEntity(BlockDecorCraftingTable.BTileEntity.class, new ResourceLocation(ModEngineersDecor.MODID, "te_crafting_table"));
GameRegistry.registerTileEntity(BlockDecorFurnace.BTileEntity.class, new ResourceLocation(ModEngineersDecor.MODID, "te_small_lab_furnace"));

View file

@ -94,6 +94,19 @@ public class ModConfig
@Config.Name("Without ladders")
@Config.RequiresMcRestart
public boolean without_ladders = false;
@Config.Comment({"Disable possibility to sit on stools and chairs."})
@Config.Name("Without chair sitting")
public boolean without_chair_sitting = false;
@Config.Comment({"Disable that mobs will sit on chairs and stools."})
@Config.Name("Without chair mob sitting")
public boolean without_mob_chair_sitting = false;
@Config.Comment({"Disable the speed boost of ladders in this mod."})
@Config.Name("Without ladder speed boost")
public boolean without_ladder_speed_boost = false;
}
@Config.Comment({
@ -127,10 +140,47 @@ public class ModConfig
{
@Config.Comment({
"Smelts ores to nuggets that are normally smelted to ingots, " +
"if detectable in the Forge ore dict. Prefers IE recipe results."
"if detectable in the Forge ore dict. Prefers IE recipe results. " +
"The value can be changed on-the-fly for testing or age progression."
})
@Config.Name("Furnace: Nugget smelting")
public boolean furnace_smelts_nuggets = false;
@Config.Comment({
"Defines, in percent, how fast the lab furnace smelts compared to " +
"a vanilla furnace. 100% means vanilla furnace speed, 150% means the " +
"lab furnace is faster. The value can be changed on-the-fly for tuning."
})
@Config.Name("Furnace: Smelting speed %")
@Config.RangeInt(min=50, max=500)
public int furnace_smelting_speed_percent = 130;
@Config.Comment({
"Defines, in percent, how fuel efficient the lab furnace is, compared " +
"to a vanilla furnace. 100% means vanilla furnace consumiton, 200% means " +
"the lab furnace needs about half the fuel of a vanilla furnace, " +
"The value can be changed on-the-fly for tuning."
})
@Config.Name("Furnace: Fuel efficiency %")
@Config.RangeInt(min=50, max=250)
public int furnace_fuel_efficiency_percent = 100;
@Config.Comment({
"Defines, in percent, how high the probability is that a mob sits on a chair " +
"when colliding with it. Can be changed on-the-fly for tuning."
})
@Config.Name("Chairs: Sitting chance %")
@Config.RangeDouble(min=0.0, max=80)
public double chair_mob_sitting_probability_percent = 10;
@Config.Comment({
"Defines, in percent, probable it is that a mob leaves a chair when sitting " +
"on it. The 'dice is rolled' about every 20 ticks. There is also a minimum " +
"Sitting time of about 3s. The config value can be changed on-the-fly for tuning."
})
@Config.Name("Chairs: Stand up chance %")
@Config.RangeDouble(min=0.001, max=10)
public double chair_mob_standup_probability_percent = 1;
}
@SuppressWarnings("unused")
@ -184,8 +234,11 @@ public class ModConfig
public static final void apply()
{
BlockDecorFurnace.BTileEntity.on_config(tweaks.furnace_smelting_speed_percent, tweaks.furnace_fuel_efficiency_percent);
ModRecipes.furnaceRecipeOverrideReset();
if(tweaks.furnace_smelts_nuggets) ModRecipes.furnaceRecipeOverrideSmeltsOresToNuggets();
BlockDecorChair.on_config(optout.without_chair_sitting, optout.without_mob_chair_sitting, tweaks.chair_mob_sitting_probability_percent, tweaks.chair_mob_standup_probability_percent);
BlockDecorLadder.on_config(optout.without_ladder_speed_boost);
}
}

View file

@ -1,10 +1,10 @@
/*
* @file ModAuxiliaries.java
* @file ModRecipes.java
* @author Stefan Wilhelm (wile)
* @copyright (C) 2018 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT)
*
* General commonly used functionality.
* General handling auxiliaries for mod recipes.
*/
package wile.engineersdecor.detail;