Avaritia icon indicating copy to clipboard operation
Avaritia copied to clipboard

[1.15] Alternative Neutron Generating Block [enhancement]

Open BenGoldberg1 opened this issue 6 years ago • 0 comments

This is an idea to add a second way to generate Piles of Neutrons. It will generate them on average at the same rate as the Neutron Collector, but will do so in a manner which is the opposite from that block in almost every way.

The new block would not have a TileEntity. Instead, it would have a method getTickRandomly() which returns true, and a method updateTick, which will (occasionally) generate Pile of Neutron Item Entities.

This would be implemented with something similar to:

public void updateTick(World w, BlockPos pos, IBlockState state, Random r) {
    if( r.nextFloat() * random_block_ticks_per_neutron >= 1.0f ) return;
    ItemStack neutrons = ItemUtils.copyStack(ModItems.neutron_pile, 1);
    float x = pos.getX()+r.nextFloat(), y = pos.getY()+r.nextFloat(), z = pos.getZ()+r.nextFloat();
    /* You might need to adjust x, y, z by +1 or -1 to ensure it spawns within this block.  */
    w.spawnEntityInWorld( new ItemEntity( w, x, y, z, neutrons ) );
}

The class would have the following constants near the top:

    static final int PRODUCTION_TICKS = TileNeutronCollector.PRODUCTION_TICKS;
    static final float neutrons_per_second = PRODUCTION_TICKS / 20.0f;
    static final float seconds_per_random_block_tick = 68.27f;
    static final float random_block_ticks_per_neutron = neutrons_per_second * seconds_per_random_block_tick;

The 68.27 is taken from the official minecraft wiki. The 20 is of course the standard number of ticks per second.

There's no counter, no inventory. It just makes items, and does it slowly.

Because these neutrons are generated as item entities, they can be collected with hoppers (or vacuum chests/vacuum hoppers/item collectors/ranged collectors/etc), or by the player walking over them, or moved around with water streams, etc. If the block is surrounded by solid blocks (including more of the same type as this neutron generator!), the items will of course float upwards. Nothing in this paragraph should strike you as new or unusual. It is ordinary vanilla item entity mechanics.

The name of the new block might perhaps be Neutron Elevator.

The appearance would be similar to the Neutron Collector, perhaps with the light grey replaced by transparent pixels. This is to let the player see the Piles of Neutrons floating up. I'm not sure if the block would need to be transparent as minecraft thinks of the term, or if just having transparent pixels would be enough.

The cost of the new block would be about the same as the Neutron Collector, perhaps a little bit pricier, since it requires such simple infrastructure to collect the neutrons.

The main goal of this suggestion is to provide a way to for players to create neutrons using less server CPU time, and also less memory. If you chose to implement this block, it would be a good idea have both this and the original Neutron Collector in the mod, to avoid breaking people's worlds when they update the mod.

It would also be nice (but not required) to have higher tier versions of this block, which would be called the Neutronium Nugget Elevator, Neutronium Ingot Elevator, and Neutronium Block Elevator, each of which would be crafted from 9 of the previous tier block, and produce items at the same rate as the Neutron Elevator. These would be colored a bit differently, perhaps with the blue replaced by green, yellow, and red, respectively.

These compressed versions, if you choose to include them, of course aren't to let the player save in-game resources or increase neutronium production rate (because it's the same), or even to reduce collection infrastructure (because it's already so simple to collect from the Neutron Elevator), or to reduce server CPU/memory (because the Neutron Elevator should use so little) but simply to reduce the amount of space required, so a player might choose to stick all of his neutronium generation somewhere in his base, where they would look cool, instead of somewhere distant, out of sight and out of mind.

BenGoldberg1 avatar Mar 25 '18 04:03 BenGoldberg1