Texture variations for walls.

This commit is contained in:
stfwi 2019-04-19 21:08:46 +02:00
parent a847e1827a
commit 816e13b8aa
41 changed files with 223 additions and 29 deletions

View file

@ -8,11 +8,10 @@
*/
package wile.engineersdecor;
import wile.engineersdecor.detail.ModConfig;
import wile.engineersdecor.detail.ExtItems;
import wile.engineersdecor.detail.Networking;
import wile.engineersdecor.detail.RecipeCondModSpecific;
import net.minecraft.item.crafting.IRecipe;
import wile.engineersdecor.detail.*;
import wile.engineersdecor.blocks.*;
import wile.engineersdecor.items.*;
import net.minecraft.world.World;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.client.multiplayer.WorldClient;
@ -39,6 +38,7 @@ import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.logging.log4j.Logger;
import javax.annotation.Nonnull;
@ -126,12 +126,16 @@ public class ModEngineersDecor
@SubscribeEvent
public static void registerItems(final RegistryEvent.Register<Item> event)
{ ModBlocks.registerItemBlocks(event); }
{ ModBlocks.registerItemBlocks(event); ModItems.registerItems(event); }
@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<IRecipe> event)
{ ModRecipes.registerRecipes(event); }
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void registerModels(final ModelRegistryEvent event)
{ ModBlocks.initModels(); }
{ ModBlocks.initModels(); ModItems.initModels(); }
}
public static final CreativeTabs CREATIVE_TAB_ENGINEERSDECOR = (new CreativeTabs("tabengineersdecor") {

View file

@ -12,6 +12,7 @@ import net.minecraft.block.*;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
@ -41,6 +42,7 @@ public class BlockDecorWall extends BlockDecor
public static final PropertyBool EAST = BlockWall.EAST;
public static final PropertyBool SOUTH = BlockWall.SOUTH;
public static final PropertyBool WEST = BlockWall.WEST;
public static final PropertyInteger TEXTURE_VARIANT = PropertyInteger.create("tvariant", 0, 7);
private static final double d_0 = 0.0d;
private static final double d_1 = 1.0d;
@ -165,12 +167,13 @@ public class BlockDecorWall extends BlockDecor
boolean s = canWallConnectTo(world, pos, EnumFacing.SOUTH);
boolean w = canWallConnectTo(world, pos, EnumFacing.WEST);
boolean nopole = (n && s && !e && !w) || (!n && !s && e && w);
return state.withProperty(UP,!nopole).withProperty(NORTH, n).withProperty(EAST, e).withProperty(SOUTH, s).withProperty(WEST, w);
long prnd = pos.toLong(); prnd = (prnd>>29) ^ (prnd>>17) ^ (prnd>>9) ^ (prnd>>4) ^ pos.getX() ^ pos.getY() ^ pos.getZ();
return state.withProperty(UP,!nopole).withProperty(NORTH, n).withProperty(EAST, e).withProperty(SOUTH, s).withProperty(WEST, w).withProperty(TEXTURE_VARIANT, ((int)prnd) & 0x7);
}
@Override
protected BlockStateContainer createBlockState()
{ return new BlockStateContainer(this, new IProperty[] {UP, NORTH, EAST, WEST, SOUTH}); }
{ return new BlockStateContainer(this, new IProperty[] {UP, NORTH, EAST, WEST, SOUTH, TEXTURE_VARIANT}); }
@Override
@SuppressWarnings("deprecation")

View file

@ -14,11 +14,11 @@ import wile.engineersdecor.blocks.*;
import net.minecraftforge.common.config.Config;
import net.minecraftforge.common.config.ConfigManager;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import javax.annotation.Nullable;
@Config(modid = ModEngineersDecor.MODID)
@ -253,6 +253,12 @@ public class ModConfig
return false;
}
public static final boolean isOptedOut(final @Nullable Item item)
{
if((item == null) || (optout == null)) return true;
return false;
}
public static final void apply()
{
BlockDecorFurnace.BTileEntity.on_config(tweaks.furnace_smelting_speed_percent, tweaks.furnace_fuel_efficiency_percent, tweaks.furnace_boost_energy_consumption);

View file

@ -5,23 +5,43 @@
* @license MIT (see https://opensource.org/licenses/MIT)
*
* General handling auxiliaries for mod recipes.
*
* Credits/references:
*
* - Looked up how blusunrise did the ore-to-grit recipes in `blusunrize.immersiveengineering.common.IERecipes`.
*/
package wile.engineersdecor.detail;
import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.blocks.BlockDecorFurnace;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.util.NonNullList;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraft.item.ItemStack;
import java.util.*;
public class ModRecipes
{
public static final void registerRecipes(RegistryEvent.Register<IRecipe> event)
{}
//--------------------------------------------------------------------------------------------------------------------
// Furnace
//--------------------------------------------------------------------------------------------------------------------
/**
* Not a standard recipe, on-the-fly changable behaviour of the furnace.
*/
public static final void furnaceRecipeOverrideReset()
{ BlockDecorFurnace.BRecipes.instance().reset(); }
/**
* Not a standard recipe, on-the-fly changable behaviour of the furnace.
*/
public static final void furnaceRecipeOverrideSmeltsOresToNuggets()
{
try {

View file

@ -0,0 +1,51 @@
/*
* @file ItemDecor.java
* @author Stefan Wilhelm (wile)
* @copyright (C) 2018 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT)
*
* Basic item functionality for mod items.
*/
package wile.engineersdecor.items;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.detail.ModAuxiliaries;
import javax.annotation.Nullable;
import java.util.List;
public class ItemDecor extends Item
{
ItemDecor(String registryName)
{
super();
setRegistryName(ModEngineersDecor.MODID, registryName);
setTranslationKey(ModEngineersDecor.MODID + "." + registryName);
setMaxStackSize(64);
setCreativeTab(ModEngineersDecor.CREATIVE_TAB_ENGINEERSDECOR);
setHasSubtypes(false);
}
@SideOnly(Side.CLIENT)
public void initModel()
{
ModelResourceLocation rc = new ModelResourceLocation(getRegistryName(),"inventory");
ModelBakery.registerItemVariants(this, rc);
ModelLoader.setCustomMeshDefinition(this, stack->rc);
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag flag)
{ ModAuxiliaries.Tooltip.addInformation(stack, world, tooltip, flag, true); }
}

View file

@ -0,0 +1,63 @@
/*
* @file ModItems.java
* @author Stefan Wilhelm (wile)
* @copyright (C) 2018 Stefan Wilhelm
* @license MIT (see https://opensource.org/licenses/MIT)
*
* Definition and initialisation of items of this module.
*/
package wile.engineersdecor.items;
import wile.engineersdecor.ModEngineersDecor;
import wile.engineersdecor.detail.ModConfig;
import net.minecraft.item.Item;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import javax.annotation.Nonnull;
@SuppressWarnings("unused")
public class ModItems
{
private static final Item[] modItems = {
};
private static final ArrayList<Item> registeredItems = new ArrayList<>();
@Nonnull
public static List<Item> getRegisteredItems()
{ return Collections.unmodifiableList(registeredItems); }
public static final void registerItems(RegistryEvent.Register<Item> event)
{
// Config based registry selection
int num_registrations_skipped = 0;
ArrayList<Item> allItems = new ArrayList<>();
Collections.addAll(allItems, modItems);
final boolean woor = ModConfig.isWithoutOptOutRegistration();
for(Item e:allItems) {
if((!woor) || (!ModConfig.isOptedOut(e))) {
registeredItems.add(e);
} else {
++num_registrations_skipped;
}
}
for(Item e:registeredItems) event.getRegistry().register(e);
ModEngineersDecor.logger.info("Registered " + Integer.toString(registeredItems.size()) + " items.");
if(num_registrations_skipped > 0) {
ModEngineersDecor.logger.info("Skipped registration of " + num_registrations_skipped + " items.");
}
}
@SideOnly(Side.CLIENT)
public static final void initModels()
{
for(Item e:registeredItems) {
if(e instanceof ItemDecor) ((ItemDecor)e).initModel();
}
}
}

View file

@ -3,7 +3,7 @@
"defaults": {
"model": "engineersdecor:wall/clinker_brick_wall_default",
"textures": {
"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall",
"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall0",
"postside": "engineersdecor:blocks/clinker_brick/clinker_brick_pole_side",
"top": "engineersdecor:blocks/clinker_brick/clinker_brick_top",
"particle": "engineersdecor:blocks/clinker_brick/clinker_brick_top"
@ -15,6 +15,16 @@
"north": { "false":{}, "true": {"submodel": {"clinker_wall_north" : {"model": "engineersdecor:wall/clinker_brick_wall_side", "uvlock": true, "y": 0 }}} },
"east" : { "false":{}, "true": {"submodel": {"clinker_wall_east" : {"model": "engineersdecor:wall/clinker_brick_wall_side", "uvlock": true, "y": 90 }}} },
"south": { "false":{}, "true": {"submodel": {"clinker_wall_south" : {"model": "engineersdecor:wall/clinker_brick_wall_side", "uvlock": true, "y": 180 }}} },
"west" : { "false":{}, "true": {"submodel": {"clinker_wall_west" : {"model": "engineersdecor:wall/clinker_brick_wall_side", "uvlock": true, "y": 270 }}} }
"west" : { "false":{}, "true": {"submodel": {"clinker_wall_west" : {"model": "engineersdecor:wall/clinker_brick_wall_side", "uvlock": true, "y": 270 }}} },
"tvariant": {
"0":{"textures":{"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall0"}},
"1":{"textures":{"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall1"}},
"2":{"textures":{"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall2"}},
"3":{"textures":{"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall3"}},
"4":{"textures":{"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall4"}},
"5":{"textures":{"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall5"}},
"6":{"textures":{"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall6"}},
"7":{"textures":{"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall7"}}
}
}
}

View file

@ -13,6 +13,7 @@
"north": { "false":{}, "true": {"submodel": {"concrete_wall_north" : {"model": "engineersdecor:wall/concrete_wall_side", "uvlock": true, "y": 0 }}} },
"east" : { "false":{}, "true": {"submodel": {"concrete_wall_east" : {"model": "engineersdecor:wall/concrete_wall_side", "uvlock": true, "y": 90 }}} },
"south": { "false":{}, "true": {"submodel": {"concrete_wall_south" : {"model": "engineersdecor:wall/concrete_wall_side", "uvlock": true, "y": 180 }}} },
"west" : { "false":{}, "true": {"submodel": {"concrete_wall_west" : {"model": "engineersdecor:wall/concrete_wall_side", "uvlock": true, "y": 270 }}} }
"west" : { "false":{}, "true": {"submodel": {"concrete_wall_west" : {"model": "engineersdecor:wall/concrete_wall_side", "uvlock": true, "y": 270 }}} },
"tvariant": { "0":{},"1":{},"2":{},"3":{},"4":{},"5":{},"6":{},"7":{} }
}
}

View file

@ -13,6 +13,16 @@
"north": { "false":{}, "true": {"submodel": {"concrete_wall_north" : {"model": "engineersdecor:wall/concrete_wall_side", "uvlock": true, "y": 0 }}} },
"east" : { "false":{}, "true": {"submodel": {"concrete_wall_east" : {"model": "engineersdecor:wall/concrete_wall_side", "uvlock": true, "y": 90 }}} },
"south": { "false":{}, "true": {"submodel": {"concrete_wall_south" : {"model": "engineersdecor:wall/concrete_wall_side", "uvlock": true, "y": 180 }}} },
"west" : { "false":{}, "true": {"submodel": {"concrete_wall_west" : {"model": "engineersdecor:wall/concrete_wall_side", "uvlock": true, "y": 270 }}} }
"west" : { "false":{}, "true": {"submodel": {"concrete_wall_west" : {"model": "engineersdecor:wall/concrete_wall_side", "uvlock": true, "y": 270 }}} },
"tvariant": {
"0":{"textures":{ "wall": "engineersdecor:blocks/concrete/rebar_concrete_texture0" }},
"1":{"textures":{ "wall": "engineersdecor:blocks/concrete/rebar_concrete_texture1" }},
"2":{"textures":{ "wall": "engineersdecor:blocks/concrete/rebar_concrete_texture2" }},
"3":{"textures":{ "wall": "engineersdecor:blocks/concrete/rebar_concrete_texture3" }},
"4":{"textures":{ "wall": "engineersdecor:blocks/concrete/rebar_concrete_texture4" }},
"5":{"textures":{ "wall": "engineersdecor:blocks/concrete/rebar_concrete_texture5" }},
"6":{"textures":{ "wall": "engineersdecor:blocks/concrete/rebar_concrete_texture6" }},
"7":{"textures":{ "wall": "engineersdecor:blocks/concrete/rebar_concrete_texture7" }}
}
}
}

View file

@ -3,7 +3,7 @@
"defaults": {
"model": "engineersdecor:wall/slag_brick_wall_default",
"textures": {
"wall": "engineersdecor:blocks/slag_brick/slag_brick_wall",
"wall": "engineersdecor:blocks/slag_brick/slag_brick_wall0",
"postside": "engineersdecor:blocks/slag_brick/slag_brick_pole_side",
"top": "engineersdecor:blocks/slag_brick/slag_brick_top",
"particle": "engineersdecor:blocks/slag_brick/slag_brick_top"
@ -15,6 +15,16 @@
"north": { "false":{}, "true": {"submodel": {"clinker_wall_north" : {"model": "engineersdecor:wall/slag_brick_wall_side", "uvlock": true, "y": 0 }}} },
"east" : { "false":{}, "true": {"submodel": {"clinker_wall_east" : {"model": "engineersdecor:wall/slag_brick_wall_side", "uvlock": true, "y": 90 }}} },
"south": { "false":{}, "true": {"submodel": {"clinker_wall_south" : {"model": "engineersdecor:wall/slag_brick_wall_side", "uvlock": true, "y": 180 }}} },
"west" : { "false":{}, "true": {"submodel": {"clinker_wall_west" : {"model": "engineersdecor:wall/slag_brick_wall_side", "uvlock": true, "y": 270 }}} }
"west" : { "false":{}, "true": {"submodel": {"clinker_wall_west" : {"model": "engineersdecor:wall/slag_brick_wall_side", "uvlock": true, "y": 270 }}} },
"tvariant": {
"0":{"textures":{ "wall": "engineersdecor:blocks/slag_brick/slag_brick_wall0" }},
"1":{"textures":{ "wall": "engineersdecor:blocks/slag_brick/slag_brick_wall1" }},
"2":{"textures":{ "wall": "engineersdecor:blocks/slag_brick/slag_brick_wall2" }},
"3":{"textures":{ "wall": "engineersdecor:blocks/slag_brick/slag_brick_wall3" }},
"4":{"textures":{ "wall": "engineersdecor:blocks/slag_brick/slag_brick_wall4" }},
"5":{"textures":{ "wall": "engineersdecor:blocks/slag_brick/slag_brick_wall5" }},
"6":{"textures":{ "wall": "engineersdecor:blocks/slag_brick/slag_brick_wall6" }},
"7":{"textures":{ "wall": "engineersdecor:blocks/slag_brick/slag_brick_wall7" }}
}
}
}

View file

@ -83,6 +83,7 @@ tile.engineersdecor.small_lab_furnace.help=§6Small metal cased lab kiln.§r Sol
#-----------------------------------------------------------------------------------------------------------
tile.engineersdecor.sign_decor.name=Sign plate (Engineer's decor logo)
tile.engineersdecor.sign_decor.help=§6This should not be craftable or visible in JEI. Used for creative tab and screenshots.
#-----------------------------------------------------------------------------------------------------------
# EOF
#-----------------------------------------------------------------------------------------------------------

View file

@ -79,6 +79,7 @@ tile.engineersdecor.small_lab_furnace.help=§6Лабораторная печь
#-----------------------------------------------------------------------------------------------------------
tile.engineersdecor.sign_decor.name=Sign plate (Engineer's decor logo)
#tile.engineersdecor.sign_decor.help=§6This should not be craftable or visible in JEI. Used for creative tab and screenshots.
#-----------------------------------------------------------------------------------------------------------
# EOF
#-----------------------------------------------------------------------------------------------------------

View file

@ -2,8 +2,8 @@
"parent": "block/block",
"ambientocclusion": false,
"textures": {
"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall",
"particle": "engineersdecor:blocks/clinker_brick/clinker_brick_wall",
"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall0",
"particle": "engineersdecor:blocks/clinker_brick/clinker_brick_wall0",
"top": "engineersdecor:blocks/clinker_brick/clinker_brick_top"
},
"elements": [

View file

@ -1,7 +1,7 @@
{
"credit": "I made this with the Blockbench",
"textures": {
"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall",
"wall": "engineersdecor:blocks/clinker_brick/clinker_brick_wall0",
"top": "engineersdecor:blocks/clinker_brick/clinker_brick_top",
"particle": "engineersdecor:blocks/clinker_brick/clinker_brick_top"
},

View file

@ -2,8 +2,8 @@
"parent": "block/block",
"ambientocclusion": false,
"textures": {
"wall": "engineersdecor:blocks/slag_brick/slag_brick_wall",
"particle": "engineersdecor:blocks/slag_brick/slag_brick_wall",
"wall": "engineersdecor:blocks/slag_brick/slag_brick_wall0",
"particle": "engineersdecor:blocks/slag_brick/slag_brick_wall0",
"top": "engineersdecor:blocks/slag_brick/slag_brick_top"
},
"elements": [

View file

@ -1,7 +1,7 @@
{
"credit": "I made this with the Blockbench",
"textures": {
"wall": "engineersdecor:blocks/slag_brick/slag_brick_wall",
"wall": "engineersdecor:blocks/slag_brick/slag_brick_wall0",
"top": "engineersdecor:blocks/slag_brick/slag_brick_top",
"particle": "engineersdecor:blocks/slag_brick/slag_brick_top"
},

View file

@ -19,6 +19,10 @@
"ingredient": { "type": "forge:ore_dict", "ore": "ingotIron" },
"name": "ingotIron"
},
{
"ingredient": { "type": "forge:ore_dict", "ore": "blockIron" },
"name": "blockIron"
},
{
"ingredient": { "type": "forge:ore_dict", "ore": "plateIron" },
"name": "plateIron"

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B