Skip to content
Permalink
Browse files

Fixes from gold pan + sluice stuff. Gold pan only returns native nugg…

…ets from sand or gravel. Can't fill gold pan underwater. Fixed sluice render when nearby.
  • Loading branch information...
alcatrazEscapee committed Aug 19, 2019
1 parent b287eca commit f0bd947258bdce2796e17bb0ef2b4ad8f4cedfc1
@@ -111,4 +111,10 @@ public void render(TESluice te, double x, double y, double z, float partialTicks

GlStateManager.popMatrix();
}

@Override
public boolean isGlobalRenderer(TESluice te)
{
return true;
}
}
@@ -87,35 +87,41 @@ public ItemStack onItemUseFinish(@Nonnull ItemStack stack, World world, EntityLi
EntityPlayer player = (EntityPlayer) entityLiving;
if (stack.getItemDamage() > 0)
{
//Check if player still is looking at water
// Check if player still is looking at water
if (canPan(world, player))
{
Chunk chunk = world.getChunk(player.getPosition());
ChunkDataTFC chunkDataTFC = ChunkDataTFC.get(chunk);
if (chunkDataTFC.canWork(6))
// Only pan for native nuggets in sand + gravel
if (stack.getItemDamage() == 1 || stack.getItemDamage() == 2)
{
Random rand = new Random(world.getSeed() + chunk.getPos().x * 241179128412L + chunk.getPos().z * 327910215471L);
List<Ore> chunkOres = TFCRegistries.ORES.getValuesCollection()
.stream().filter(Ore::canPan).filter(x -> rand.nextDouble() < x.getChunkChance())
.collect(Collectors.toList());

chunkOres.forEach(x -> {
if (Constants.RNG.nextDouble() < x.getPanChance())
{
Helpers.spawnItemStack(world, player.getPosition(), new ItemStack(ItemSmallOre.get(x)));
}
});
chunkDataTFC.addWork(6);
stack.setItemDamage(0);
if (Constants.RNG.nextFloat() < 0.01) // 1/100 chance, same as 1.7.10
if (chunkDataTFC.canWork(6))
{
stack.shrink(1);
world.playSound(null, entityLiving.getPosition(), TFCSounds.CERAMIC_BREAK, SoundCategory.PLAYERS, 1.0f, 1.0f);
Random rand = new Random(world.getSeed() + chunk.getPos().x * 241179128412L + chunk.getPos().z * 327910215471L);
List<Ore> chunkOres = TFCRegistries.ORES.getValuesCollection()
.stream().filter(Ore::canPan).filter(x -> rand.nextDouble() < x.getChunkChance())
.collect(Collectors.toList());

chunkOres.forEach(x -> {
if (Constants.RNG.nextDouble() < x.getPanChance())
{
Helpers.spawnItemStack(world, player.getPosition(), new ItemStack(ItemSmallOre.get(x)));
}
});
chunkDataTFC.addWork(6);
stack.setItemDamage(0);
}
// todo: pan for seeds or stuff in dirt / grass / clay????
else
{
player.sendMessage(new TextComponentTranslation(MOD_ID + ".tooltip.goldpan.chunkworked"));
}
}
else

if (Constants.RNG.nextFloat() < 0.01) // 1/100 chance, same as 1.7.10
{
player.sendMessage(new TextComponentTranslation(MOD_ID + ".tooltip.goldpan.chunkworked"));
stack.shrink(1);
world.playSound(null, entityLiving.getPosition(), TFCSounds.CERAMIC_BREAK, SoundCategory.PLAYERS, 1.0f, 1.0f);
}
}
}
@@ -127,7 +133,10 @@ public ItemStack onItemUseFinish(@Nonnull ItemStack stack, World world, EntityLi
if (result == null || result.typeOfHit != RayTraceResult.Type.BLOCK) return stack;
BlockPos pos = result.getBlockPos();
IBlockState state = world.getBlockState(pos);
if (!(state.getBlock() instanceof BlockRockVariant)) return stack;
if (!(state.getBlock() instanceof BlockRockVariant) || (result.sideHit != null && world.getBlockState(pos.offset(result.sideHit)).getMaterial().isLiquid()))
{
return stack;
}
Rock.Type type = ((BlockRockVariant) state.getBlock()).getType();
if (type == Rock.Type.SAND)
{
@@ -155,18 +164,21 @@ else if (type == Rock.Type.DIRT || type == Rock.Type.GRASS)
}

@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items)
public int getMaxItemUseDuration(ItemStack stack)
{
if (!isInCreativeTab(tab)) return;

for (int meta = 0; meta < TYPES.length; meta++)
items.add(new ItemStack(this, 1, meta));
return stack.getItemDamage() > 0 ? 54 : 1;
}

@Override
public int getMaxItemUseDuration(ItemStack stack)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items)
{
return stack.getItemDamage() > 0 ? 54 : 24;
if (isInCreativeTab(tab))
{
for (int meta = 0; meta < TYPES.length; meta++)
{
items.add(new ItemStack(this, 1, meta));
}
}
}

@Nonnull
@@ -28,6 +28,8 @@
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.fluids.BlockFluidBase;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import net.dries007.tfc.ConfigTFC;
import net.dries007.tfc.Constants;
@@ -48,6 +50,14 @@
private int soil;
private int ticksRemaining, delayTimer;

@SideOnly(Side.CLIENT)
@Override
@Nonnull
public AxisAlignedBB getRenderBoundingBox()
{
return INFINITE_EXTENT_AABB;
}

protected static Predicate<Fluid> ALLOWED_FLUIDS;

public TESluice()

0 comments on commit f0bd947

Please sign in to comment.
You can’t perform that action at this time.