Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Lots of small quick fixes:
 - Fixed seeds popping off of farmland.
 - Simplified ore dict names for ore items.
 - Fixed quern ore dict (and possibly others) not working for damaged items. (fixes #475).
 - Fixed crops only dropping extra seeds in expert, not master tier. Rebalanced crop drops and skill bonus a bit.
 - Fixed fire clay recipe (fixes #474).
 - Re-added recipe for jackolantern. (just the vanilla one for now, will need to be registry replaced with one that doesn't give infinite light. (fixes #406).
 - Fixed farmland dropping an item with metadata.
  • Loading branch information
alcatrazEscapee committed Oct 6, 2019
1 parent b3db8ed commit 7657f0b
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -50,7 +50,7 @@ file "build.properties" withReader {
* The version number is a sacred tool that a computer must understand and be able to compare to see what's what.
* `-SNAPSHOT` or `.rc0v14s4dffds2` communicates nothing useful.
*/
version = "0.24.4" // To be clear, you can edit this if you are submitting a patch PR, or if you are merging a feature into master.
version = "0.24.5" // To be clear, you can edit this if you are submitting a patch PR, or if you are merging a feature into master.
if (System.getenv().BUILD_NUMBER != null) version += "." + System.getenv().BUILD_NUMBER

group = "net.dries007.tfc" // According to java standards, as I have control over this domain. If you fork this and release your own version, change this.
Expand Down
Expand Up @@ -5,6 +5,7 @@

package net.dries007.tfc.network;

import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
Expand Down Expand Up @@ -47,6 +48,7 @@ public IMessage onMessage(PacketPlaceBlockSpecial message, MessageContext ctx)
double placeReach = player.getEntityAttribute(EntityPlayer.REACH_DISTANCE).getAttributeValue();
if (player.getDistanceSq(pos) <= placeReach * placeReach && hitFace != null)
{
IBlockState offsetState = world.getBlockState(pos.offset(hitFace));
if (world.getBlockState(pos).getBlock() == BlocksTFC.PLACED_ITEM)
{
TEPlacedItem tile = Helpers.getTE(world, pos, TEPlacedItem.class);
Expand All @@ -55,15 +57,15 @@ public IMessage onMessage(PacketPlaceBlockSpecial message, MessageContext ctx)
tile.onRightClick(player, stack, rayTrace);
}
}
else if (world.getBlockState(pos.offset(hitFace)).getBlock() == BlocksTFC.PLACED_ITEM)
else if (offsetState.getBlock() == BlocksTFC.PLACED_ITEM)
{
TEPlacedItem tile = Helpers.getTE(world, pos.offset(hitFace), TEPlacedItem.class);
if (tile != null)
{
tile.onRightClick(player, stack, rayTrace);
}
}
else if (!stack.isEmpty() && world.getBlockState(pos.offset(hitFace).down()).isSideSolid(world, pos.offset(hitFace).down(), EnumFacing.UP) && world.getBlockState(pos.offset(hitFace)).getBlock().isReplaceable(world, pos))
else if (!stack.isEmpty() && world.getBlockState(pos.offset(hitFace).down()).isSideSolid(world, pos.offset(hitFace).down(), EnumFacing.UP) && offsetState.getBlock().isAir(offsetState, world, pos))
{
if (player.isSneaking())
{
Expand Down
Expand Up @@ -32,6 +32,7 @@
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.ItemHandlerHelper;

import net.dries007.tfc.objects.blocks.stone.BlockFarmlandTFC;
import net.dries007.tfc.objects.te.TEPlacedItemFlat;
import net.dries007.tfc.util.Helpers;

Expand Down Expand Up @@ -131,7 +132,7 @@ public boolean isOpaqueCube(IBlockState state)
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
{
super.neighborChanged(state, worldIn, pos, blockIn, fromPos);
if (!worldIn.isSideSolid(pos.down(), EnumFacing.UP))
if (!worldIn.isSideSolid(pos.down(), EnumFacing.UP) && !(worldIn.getBlockState(pos.down()).getBlock() instanceof BlockFarmlandTFC))
{
worldIn.setBlockToAir(pos);
}
Expand Down
Expand Up @@ -112,8 +112,8 @@ public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBloc
SimpleSkill skill = CapabilityPlayerData.getSkill(player, SkillType.AGRICULTURE);
if (skill != null)
{
foodStack.setCount(2 + (int) (skill.getTotalLevel()));
if (skill.getTier() == SkillTier.EXPERT && RANDOM.nextInt(4) == 0)
foodStack.setCount(1 + RANDOM.nextInt(2 + (int) (6 * skill.getTotalLevel())));
if (skill.getTier().isAtLeast(SkillTier.ADEPT) && RANDOM.nextInt(10 - 2 * skill.getTier().ordinal()) == 0)
{
seedStack.setCount(2);
}
Expand Down
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
Expand Down Expand Up @@ -160,7 +161,22 @@ public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Bloc
@Nonnull
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return rand.nextInt(10) > 5 - fortune ? Item.getItemFromBlock(BlockFruitTreeSapling.get(tree)) : Items.AIR;
return Items.AIR;
}

@Override
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
ItemStack stack = player.getHeldItemMainhand();
if (stack.getItem().getToolClasses(stack).contains("axe") || stack.getItem().getToolClasses(stack).contains("saw"))
{
if (!worldIn.isRemote && RANDOM.nextBoolean())
{
ItemStack dropStack = new ItemStack(BlockFruitTreeSapling.get(tree));
InventoryHelper.spawnItemStack(worldIn, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, dropStack);
}
}
super.onBlockHarvested(worldIn, pos, state, player);
}

@Override
Expand Down
Expand Up @@ -134,7 +134,7 @@ protected BlockStateContainer createBlockState()
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player)
{
return new ItemStack(Item.getItemFromBlock(this));
return new ItemStack(this);
}

@Override
Expand All @@ -143,6 +143,12 @@ public Item getItemDropped(IBlockState state, Random rand, int fortune)
return Item.getItemFromBlock(get(rock, Rock.Type.DIRT));
}

@Override
public int damageDropped(IBlockState state)
{
return 0;
}

public int getWaterScore(IBlockAccess world, BlockPos pos)
{
final int hRange = 7;
Expand Down
Expand Up @@ -59,7 +59,7 @@ public ItemOreTFC(Ore ore)
for (Ore.Grade grade : Ore.Grade.values())
{
//noinspection ConstantConditions
OreDictionaryHelper.registerMeta(this, grade.getMeta(), "ore", ore.getRegistryName().getPath(), grade);
OreDictionaryHelper.registerMeta(this, grade.getMeta(), "ore", ore.getMetal().getRegistryName().getPath(), grade);
}
}
else // Mineral
Expand Down
Expand Up @@ -43,7 +43,6 @@ public static void onRecipeRegister(RegistryEvent.Register<IRecipe> event)
modRegistry.remove(new ResourceLocation("minecraft:melon_seeds"));
modRegistry.remove(new ResourceLocation("minecraft:melon_block"));
modRegistry.remove(new ResourceLocation("minecraft:pumpkin_seeds"));
modRegistry.remove(new ResourceLocation("minecraft:lit_pumpkin"));
modRegistry.remove(new ResourceLocation("minecraft:golden_apple"));
modRegistry.remove(new ResourceLocation("minecraft:glowstone"));
modRegistry.remove(new ResourceLocation("minecraft:furnace"));
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/net/dries007/tfc/util/OreDictionaryHelper.java
Expand Up @@ -180,19 +180,23 @@ private Thing(Block thing)

private Thing(Item thing)
{
this(thing, 0);
this(thing, -1);
}

private Thing(Item thing, int meta)
{
block = null;
item = thing;

if (meta == -1 && thing.getHasSubtypes() || thing.isDamageable())
{
meta = OreDictionary.WILDCARD_VALUE;
}
this.meta = meta;
block = null;
}

private ItemStack toItemStack()
{
//noinspection ConstantConditions
return (block == null) ? new ItemStack(item, 1, meta) : new ItemStack(block, 1, meta);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets

0 comments on commit 7657f0b

Please sign in to comment.