Moved generators to enum

This commit is contained in:
drcrazy 2018-09-24 16:49:44 +03:00
parent 86a2612b97
commit 809c02934a
16 changed files with 51 additions and 87 deletions

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks;
package techreborn.blocks.generator;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
@ -44,7 +44,6 @@ import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
import techreborn.init.ModSounds;
import techreborn.init.TRContent;
import techreborn.utils.TechRebornCreativeTab;
import javax.annotation.Nullable;
@ -68,7 +67,7 @@ public class BlockFusionCoil extends Block {
if (!tool.isEmpty() && ToolManager.INSTANCE.canHandleTool(tool)) {
if (ToolManager.INSTANCE.handleTool(tool, pos, worldIn, playerIn, side, false)) {
if (playerIn.isSneaking()) {
ItemStack drop = new ItemStack(TRContent.FUSION_COIL, 1);
ItemStack drop = new ItemStack(this);
spawnAsEntity(worldIn, pos, drop);
worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, ModSounds.BLOCK_DISMANTLE,
SoundCategory.BLOCKS, 0.6F, 1F);

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.blocks;
package techreborn.blocks.generator;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
@ -60,7 +60,7 @@ public class BlockFusionControlComputer extends BlockMachineBase {
final EntityPlayer player, final EnumHand hand, final EnumFacing side,
final float hitX, final float hitY, final float hitZ) {
final TileFusionControlComputer tileFusionControlComputer = (TileFusionControlComputer) world.getTileEntity(pos);
if(!player.getHeldItem(hand).isEmpty() && player.getHeldItem(hand).getItem() == Item.getItemFromBlock(TRContent.FUSION_COIL)){
if(!player.getHeldItem(hand).isEmpty() && player.getHeldItem(hand).getItem() == Item.getItemFromBlock(TRContent.Machine.FUSION_COIL.block)){
List<BlockPos> coils = Torus.generate(tileFusionControlComputer.getPos(), tileFusionControlComputer.size);
boolean placed = false;
for(BlockPos coil : coils){
@ -68,7 +68,7 @@ public class BlockFusionControlComputer extends BlockMachineBase {
return true;
}
if(world.isAirBlock(coil) && !tileFusionControlComputer.isCoil(coil)){
world.setBlockState(coil, TRContent.FUSION_COIL.getDefaultState());
world.setBlockState(coil, TRContent.Machine.FUSION_COIL.block.getDefaultState());
if(!player.isCreative()){
player.getHeldItem(hand).shrink(1);
}