Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Cleanup tasks: renamed a lot of items for better consistency moving f…
…orward (Closes #47, Closes #48, Closes #49, Closes #106). Tried to cleanup the weird NPE in ChunkGenTFC a little bit, should stop spamming the log with errors that aren't going to be fixed. Did some cleanup in UnmoldRecipe.
  • Loading branch information
alcatrazEscapee committed Jun 29, 2019
1 parent e184f59 commit 45e8fb2
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 85 deletions.
37 changes: 22 additions & 15 deletions generateResources.py
Expand Up @@ -692,15 +692,15 @@ def item(filename_parts, *layers, parent='item/generated'):
blockstate(('stairs', block_type, rock_type), None, textures={
('top', 'bottom', 'side'): 'tfc:blocks/stonetypes/%s/%s' % (block_type, rock_type),
}, variants=STAIR_VARIANTS)
blockstate(('slab', 'half', block_type, rock_type), 'half_slab', textures={
blockstate(('slab', block_type, rock_type), 'half_slab', textures={
('top', 'bottom', 'side'): 'tfc:blocks/stonetypes/%s/%s' % (block_type, rock_type),
}, variants={
'half': {
'bottom': {},
'top': {'model': 'upper_slab'}
}
})
cube_all(('slab', 'full', block_type, rock_type), 'tfc:blocks/stonetypes/%s/%s' % (block_type, rock_type))
cube_all(('double_slab', block_type, rock_type), 'tfc:blocks/stonetypes/%s/%s' % (block_type, rock_type))

# (STONE) BUTTON
blockstate(('stone', 'button', rock_type), 'button', textures={
Expand Down Expand Up @@ -819,15 +819,15 @@ def item(filename_parts, *layers, parent='item/generated'):
blockstate(('stairs', 'wood', wood_type), None, textures={
('top', 'bottom', 'side'): 'tfc:blocks/wood/planks/%s' % wood_type,
}, variants=STAIR_VARIANTS)
blockstate(('slab', 'half', 'wood', wood_type), 'half_slab', textures={
blockstate(('slab', 'wood', wood_type), 'half_slab', textures={
('top', 'bottom', 'side'): 'tfc:blocks/wood/planks/%s' % wood_type,
}, variants={
'half': {
'bottom': {},
'top': {'model': 'upper_slab'}
}
})
cube_all(('slab', 'full', 'wood', wood_type), 'tfc:blocks/wood/planks/%s' % wood_type)
cube_all(('double_slab', 'wood', wood_type), 'tfc:blocks/wood/planks/%s' % wood_type)

# (WOOD) TRAPDOORS
blockstate(('wood', 'trapdoor', wood_type), None, textures={
Expand Down Expand Up @@ -1002,23 +1002,30 @@ def item(filename_parts, *layers, parent='item/generated'):
for item_type in METAL_ITEMS:
if item_type not in _heads:
continue
item(('mold', item_type, 'unfired'), 'tfc:items/mold/%s/%s' % ('unfired', item_type.split('_')[0]))
item(('mold', item_type, 'empty'), 'tfc:items/mold/%s/%s' % ('empty', item_type.split('_')[0]))
for metal in ['copper', 'bronze', 'black_bronze', 'bismuth_bronze']:
item(('mold', item_type, metal), 'tfc:items/mold/%s/%s' % (metal, item_type.split('_')[0]))
for type in ['empty', 'unfired', 'unknown']:
item(('mold', 'ingot', type), 'tfc:items/mold/ingot/' + type)
# unfired molds
item(('ceramics', 'unfired', 'mold', item_type), 'tfc:items/ceramics/unfired/mold/%s' % item_type)
# fired, empty molds
item(('ceramics', 'fired', 'mold', item_type, 'empty'), 'tfc:items/ceramics/fired/mold/%s/empty' % item_type)
# fired, filled molds
for metal in ('copper', 'bronze', 'black_bronze', 'bismuth_bronze'):
item(('ceramics', 'fired', 'mold', item_type, metal),
'tfc:items/ceramics/fired/mold/%s/%s' % (item_type, metal))

# unfired ingot molds
item(('ceramics', 'unfired', 'mold', 'ingot'), 'tfc:items/ceramics/unfired/mold/ingot')
# fired ingot molds for all metals
item(('ceramics', 'fired', 'mold', 'ingot', 'empty'), 'tfc:items/ceramics/fired/mold/ingot/empty')
item(('ceramics', 'fired', 'mold', 'ingot', 'unknown'), 'tfc:items/ceramics/fired/mold/ingot/unknown')
for metal in METAL_TYPES.keys():
item(('mold', 'ingot', metal), 'tfc:items/mold/ingot/' + metal)
item(('ceramics', 'fired', 'mold', 'ingot', metal), 'tfc:items/ceramics/fired/mold/ingot/' + metal)

del _heads

item(('ceramics', 'unfired', 'vessel'), 'tfc:items/ceramics/unfired/vessel')
item(('ceramics', 'fired', 'vessel'), 'tfc:items/ceramics/fired/vessel')
item(('ceramics', 'unfired', 'vessel_glazed'),
'tfc:items/ceramics/unfired/vessel',
item(('ceramics', 'unfired', 'vessel_glazed'), 'tfc:items/ceramics/unfired/vessel',
'tfc:items/ceramics/fired/vessel_overlay')
item(('ceramics', 'fired', 'vessel_glazed'),
'tfc:items/ceramics/fired/vessel',
item(('ceramics', 'fired', 'vessel_glazed'), 'tfc:items/ceramics/fired/vessel',
'tfc:items/ceramics/fired/vessel_overlay')

item(('ceramics', 'unfired', 'spindle'), 'tfc:items/ceramics/unfired/spindle')
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/net/dries007/tfc/objects/blocks/BlocksTFC.java
Expand Up @@ -408,16 +408,16 @@ public static void registerBlocks(RegistryEvent.Register<Block> event)
// Full slabs are the same as full blocks, they are not saved to a list, they are kept track of by the halfslab version.
for (Rock.Type type : new Rock.Type[] {SMOOTH, COBBLE, BRICKS})
for (Rock rock : TFCRegistries.ROCKS.getValuesCollection())
register(r, "slab/full/" + (type.name() + "/" + rock.getRegistryName().getPath()).toLowerCase(), new BlockSlabTFC.Double(rock, type));
register(r, "double_slab/" + (type.name() + "/" + rock.getRegistryName().getPath()).toLowerCase(), new BlockSlabTFC.Double(rock, type));
for (Tree wood : TFCRegistries.TREES.getValuesCollection())
register(r, "slab/full/wood/" + wood.getRegistryName().getPath(), new BlockSlabTFC.Double(wood));
register(r, "double_slab/wood/" + wood.getRegistryName().getPath(), new BlockSlabTFC.Double(wood));

// Slabs
for (Rock.Type type : new Rock.Type[] {SMOOTH, COBBLE, BRICKS})
for (Rock rock : TFCRegistries.ROCKS.getValuesCollection())
slab.add(register(r, "slab/half/" + (type.name() + "/" + rock.getRegistryName().getPath()).toLowerCase(), new BlockSlabTFC.Half(rock, type), CT_DECORATIONS));
slab.add(register(r, "slab/" + (type.name() + "/" + rock.getRegistryName().getPath()).toLowerCase(), new BlockSlabTFC.Half(rock, type), CT_DECORATIONS));
for (Tree wood : TFCRegistries.TREES.getValuesCollection())
slab.add(register(r, "slab/half/wood/" + wood.getRegistryName().getPath(), new BlockSlabTFC.Half(wood), CT_DECORATIONS));
slab.add(register(r, "slab/wood/" + wood.getRegistryName().getPath(), new BlockSlabTFC.Half(wood), CT_DECORATIONS));

for (Rock rock : TFCRegistries.ROCKS.getValuesCollection())
inventoryItemBlocks.add(new ItemBlockTFC(register(r, "stone/button/" + rock.getRegistryName().getPath().toLowerCase(), new BlockButtonStoneTFC(rock), CT_DECORATIONS)));
Expand Down
Expand Up @@ -28,7 +28,6 @@
import net.minecraftforge.fml.relauncher.SideOnly;

import mcp.MethodsReturnNonnullByDefault;
import net.dries007.tfc.TerraFirmaCraft;
import net.dries007.tfc.api.types.Rock;
import net.dries007.tfc.objects.blocks.BlocksTFC;
import net.dries007.tfc.objects.blocks.crops.BlockCropTFC;
Expand All @@ -47,12 +46,6 @@ public class BlockRockVariant extends Block

public static BlockRockVariant get(Rock rock, Rock.Type type)
{
//noinspection ConstantConditions
if (rock == null)
{
TerraFirmaCraft.getLog().warn("Rock is null at BlockRockVariant#get! Serious problems, potential NPE! Please report this to developers!", new Exception("AHHHHHHHHHHHHHHHHHHHHHHHHH"));
return get(Rock.GRANITE, type);
}
return TABLE.get(rock).get(type);
}

Expand Down
Expand Up @@ -13,7 +13,7 @@
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
Expand Down Expand Up @@ -43,7 +43,7 @@
@MethodsReturnNonnullByDefault
public class BlockLogPile extends Block implements ILightableBlock
{
private static final PropertyBool AXIS = PropertyBool.create("axis");
private static final PropertyEnum<EnumFacing.Axis> AXIS = PropertyEnum.create("axis", EnumFacing.Axis.class, EnumFacing.Axis.X, EnumFacing.Axis.Z);

public BlockLogPile()
{
Expand All @@ -53,20 +53,20 @@ public BlockLogPile()
setSoundType(SoundType.WOOD);
setTickRandomly(true);
setHarvestLevel("axe", 0);
this.setDefaultState(this.getDefaultState().withProperty(AXIS, false).withProperty(LIT, false));
this.setDefaultState(this.getDefaultState().withProperty(AXIS, EnumFacing.Axis.X).withProperty(LIT, false));
}

@Override
@SuppressWarnings("deprecation")
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(AXIS, meta == 0).withProperty(LIT, meta >= 2);
return this.getDefaultState().withProperty(AXIS, meta == 0 ? EnumFacing.Axis.Z : EnumFacing.Axis.X).withProperty(LIT, meta >= 2);
}

@Override
public int getMetaFromState(IBlockState state)
{
return (state.getValue(AXIS) ? 0 : 1) + (state.getValue(LIT) ? 2 : 0);
return (state.getValue(AXIS) == EnumFacing.Axis.Z ? 0 : 1) + (state.getValue(LIT) ? 2 : 0);
}

@Override
Expand Down Expand Up @@ -151,9 +151,9 @@ public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, En
@SuppressWarnings("deprecation")
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
if (placer.getHorizontalFacing().getAxis() == EnumFacing.Axis.Z)
if (placer.getHorizontalFacing().getAxis().isHorizontal())
{
return this.getDefaultState().withProperty(AXIS, true);
return this.getDefaultState().withProperty(AXIS, placer.getHorizontalFacing().getAxis());
}
return this.getDefaultState();
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/net/dries007/tfc/objects/items/ItemsTFC.java
Expand Up @@ -70,8 +70,6 @@ public final class ItemsTFC

@GameRegistry.ObjectHolder("ceramics/fire_clay")
public static final ItemFireClay FIRE_CLAY = getNull();
@GameRegistry.ObjectHolder("mold/ingot")
public static final ItemMold MOLD_INGOT = getNull();
@GameRegistry.ObjectHolder("ceramics/unfired/vessel")
public static final ItemUnfiredPottery CERAMICS_UNFIRED_VESSEL = getNull();
@GameRegistry.ObjectHolder("ceramics/fired/vessel")
Expand Down Expand Up @@ -156,7 +154,9 @@ public static void registerItems(RegistryEvent.Register<Item> event)
for (Metal metal : TFCRegistries.METALS.getValuesCollection())
{
if (type.hasType(metal))
{
simpleItems.add(register(r, "metal/" + type.name().toLowerCase() + "/" + metal.getRegistryName().getPath(), Metal.ItemType.create(metal, type), CT_METAL));
}
}
}

Expand Down Expand Up @@ -195,8 +195,8 @@ public static void registerItems(RegistryEvent.Register<Item> event)
{
// Not using registerPottery here because the ItemMold uses a custom ItemModelMesher, meaning it can't be in simpleItems
ItemFiredPottery item = new ItemMold(type);
register(r, "mold/" + type.name().toLowerCase(), item, CT_POTTERY);
simpleItems.add(register(r, "mold/" + type.name().toLowerCase() + "/unfired", new ItemUnfiredMold(item, type), CT_POTTERY));
register(r, "ceramics/fired/mold/" + type.name().toLowerCase(), item, CT_POTTERY);
simpleItems.add(register(r, "ceramics/unfired/mold/" + type.name().toLowerCase(), new ItemUnfiredMold(item, type), CT_POTTERY));
}
}

Expand Down

0 comments on commit 45e8fb2

Please sign in to comment.