Open cdkrot opened 10 years ago
Sure, I'd be glad to be a contributor.
Welcome to mechanics mod! You should be able to commit now.
Just added languaging.
Cool, thanks.
I'm gonna remove the duplicate resources in the java
folder, they look identical to the resource
ones.
Yes they are. I copied them when minecraft wasn't loading them. (haven't checked how it is now)
As long as the resources
folder is included as src, then it works fine.
Fine, textures are still loaded.
I'm gonna do some bug testing, I'll report if I find anything.
Ok,
Hmmm, should we follow the vanilla hopper rule that if a chest cannot be opened by a player, it does not interact with it?
Mmm, can you refer a code source, please?
Yes, just a minute.
Also, using a filter in the allocator requires using the actual item, should it make a 'blank copy' instead so you don't have to use up an item?
Yes, i haven't thought about that before.
Okay, this seems to be the function that does it, using ISidedInventory where possible:
public static ItemStack func_145889_a(IInventory p_145889_0_, ItemStack p_145889_1_, int p_145889_2_)
{
if (p_145889_0_ instanceof ISidedInventory && p_145889_2_ > -1)
{
ISidedInventory isidedinventory = (ISidedInventory)p_145889_0_;
int[] aint = isidedinventory.getAccessibleSlotsFromSide(p_145889_2_);
for (int l = 0; l < aint.length && p_145889_1_ != null && p_145889_1_.stackSize > 0; ++l)
{
p_145889_1_ = func_145899_c(p_145889_0_, p_145889_1_, aint[l], p_145889_2_);
}
}
else
{
int j = p_145889_0_.getSizeInventory();
for (int k = 0; k < j && p_145889_1_ != null && p_145889_1_.stackSize > 0; ++k)
{
p_145889_1_ = func_145899_c(p_145889_0_, p_145889_1_, k, p_145889_2_);
}
}
if (p_145889_1_ != null && p_145889_1_.stackSize == 0)
{
p_145889_1_ = null;
}
return p_145889_1_;
}
I meaned, where it used in our code.
Oh, okay. Hold on.
allocateItems
:
private void allocateItems(World world, int x, int y, int z, Random random) {
VecI3Base d = DirectionalVecs.list[world.getBlockMetadata(x, y, z)];
TileEntityAllocator tile = (TileEntityAllocator) world.getTileEntity(x, y, z);
ItemStack[] filter = tile.allocatorFilterItems;
IInventoryEX input = containerAtPos(world, x - d.x, y - d.y, z - d.z);
if (input == null) {
List<Entity> entities = (List<Entity>) world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox((double) (x - d.x), (double) y - d.y, (double) (z - d.z), (double) (x - d.x + 1), (double) (y - d.y + 1), (float) (z - d.z + 1)));
List<IInventoryEX> invs = AllocatorRegistry.instance.getIInventoryAllInFor(entities, true);
// TODO: entity inventories should be caught by other way
// [REFACTORING].
if (invs.size() > 0)
input = invs.get(random.nextInt(invs.size()));
else
return;// no input.
}
// TODO: should be inlined here.
int itemIndex = getRandomItemStackFromContainer(input, random, filter);
if (itemIndex >= 0)
if (outputItem(world, x, y, z, d, input.asIInventory().getStackInSlot(itemIndex), random))
input.onTakenSuccessful(itemIndex, null);
}
Probably yes,
Looks likes it does a pretty same things as we, but does it mentions input and output?
It might.
Okay, that function handles both input and output. It's a little complicated how it works overall, but I can describe it, give me a minute.
Okay: First, this code:
// func_145888_j is the "is it time to update" check, func_149917_c is a meta check for something
if (!this.func_145888_j() && BlockHopper.func_149917_c(this.getBlockMetadata()))
{
boolean flag = this.func_145883_k(); // output this tile entity -> inventory connected
flag = func_145891_a(this) || flag; // input from above inventory -> this tile entity
if (flag) // something was transferred
{
this.func_145896_c(8); // reset timer
this.markDirty(); //save data
return true;
}
}
func_145883_k
calls func_145899_a
with an item stack from the tile entity. func_145891_a
calls func_145899_a
with an item stack from the inventory above this hopper. There's some more specifics, but that's the basics.
(didn't understand the code above) I think we should use a func_145889_a() (more above), it suits all our needs. I can do a required modifications if needed.
I'll handle it, I'll give it a more sensible name as well.
So right now passed 2 weeks, there was a great time, but i think it's time to think about next plan. What we should do before release:
Also i checked your mod Crystalix, i like it, cool concept :).
Thanks!
About benchmark: not a bug, just loosed some code between code cleaning, etc.
Okay, cool.
Mailing list for all people interested in Mechanics ( @cdkrot, @T145, @kenzierocks ). Right now we have 4 tasks to do:
Localization systemJust do tasks which you want, and write here about you progress. @kenzierocks, if you want to become a contributor, say me.