Moved misc blocks to their own package. Start of rubber stuff

This commit is contained in:
drcrazy 2019-07-15 17:24:31 +03:00
parent 4f1593771e
commit d6788c8da5
14 changed files with 102 additions and 106 deletions

View file

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
package techreborn.blocks; package techreborn.blocks.misc;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;

View file

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
package techreborn.blocks; package techreborn.blocks.misc;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;

View file

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
package techreborn.blocks; package techreborn.blocks.misc;
import net.fabricmc.fabric.api.block.FabricBlockSettings; import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.FenceBlock; import net.minecraft.block.FenceBlock;

View file

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
package techreborn.blocks; package techreborn.blocks.misc;
import net.fabricmc.fabric.api.block.FabricBlockSettings; import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.GlassBlock; import net.minecraft.block.GlassBlock;

View file

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
package techreborn.blocks; package techreborn.blocks.misc;
import net.fabricmc.fabric.api.block.FabricBlockSettings; import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;

View file

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
package techreborn.blocks; package techreborn.blocks.misc;
import net.fabricmc.fabric.api.block.FabricBlockSettings; import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.*; import net.minecraft.block.*;

View file

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
package techreborn.blocks; package techreborn.blocks.misc;
import net.fabricmc.fabric.api.block.FabricBlockSettings; import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Block; import net.minecraft.block.Block;

View file

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
package techreborn.blocks; package techreborn.blocks.misc;
import net.fabricmc.fabric.api.block.FabricBlockSettings; import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Material; import net.minecraft.block.Material;

View file

@ -22,7 +22,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
package techreborn.blocks; package techreborn.blocks.misc;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.StairsBlock; import net.minecraft.block.StairsBlock;

View file

@ -22,12 +22,13 @@
* SOFTWARE. * SOFTWARE.
*/ */
package techreborn.blocks; package techreborn.blocks.misc;
import net.fabricmc.fabric.api.block.FabricBlockSettings; import net.fabricmc.fabric.api.block.FabricBlockSettings;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.block.SaplingBlock; import net.minecraft.block.SaplingBlock;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import techreborn.world.RubberTreeGenerator;
/** /**
* Created by modmuss50 on 20/02/2016. * Created by modmuss50 on 20/02/2016.
@ -35,6 +36,6 @@ import net.minecraft.sound.BlockSoundGroup;
public class BlockRubberSapling extends SaplingBlock { public class BlockRubberSapling extends SaplingBlock {
public BlockRubberSapling() { public BlockRubberSapling() {
super(new RubberTree(), FabricBlockSettings.of(Material.PLANT).sounds(BlockSoundGroup.GRASS).build()); super(new RubberTreeGenerator(), FabricBlockSettings.of(Material.PLANT).sounds(BlockSoundGroup.GRASS).build());
} }
} }

View file

@ -32,7 +32,7 @@ import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import techreborn.blocks.BlockNuke; import techreborn.blocks.misc.BlockNuke;
import techreborn.entities.EntityNukePrimed; import techreborn.entities.EntityNukePrimed;
import techreborn.init.TRContent; import techreborn.init.TRContent;

View file

@ -24,23 +24,26 @@
package techreborn.events; package techreborn.events;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.Item.Settings;
import reborncore.RebornRegistry; import reborncore.RebornRegistry;
import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.util.BucketHandler;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.blocks.*; import techreborn.blocks.misc.BlockComputerCube;
import techreborn.blocks.misc.BlockNuke;
import techreborn.blocks.misc.BlockRefinedIronFence;
import techreborn.blocks.misc.BlockReinforcedGlass;
import techreborn.blocks.misc.BlockRubberLeaves;
import techreborn.blocks.misc.BlockRubberLog;
import techreborn.blocks.misc.BlockRubberPlank;
import techreborn.blocks.misc.BlockRubberPlankSlab;
import techreborn.blocks.misc.BlockRubberPlankStair;
import techreborn.blocks.misc.BlockRubberSapling;
import techreborn.config.ConfigTechReborn; import techreborn.config.ConfigTechReborn;
import techreborn.entities.EntityNukePrimed;
import techreborn.init.TRArmorMaterial; import techreborn.init.TRArmorMaterial;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.init.TRContent.*; import techreborn.init.TRContent.*;
import techreborn.init.TRTileEntities;
import techreborn.init.TRToolTier; import techreborn.init.TRToolTier;
import techreborn.itemblocks.ItemBlockRubberSapling;
import techreborn.items.DynamicCell; import techreborn.items.DynamicCell;
import techreborn.items.ItemFrequencyTransmitter; import techreborn.items.ItemFrequencyTransmitter;
import techreborn.items.ItemManual; import techreborn.items.ItemManual;
@ -80,29 +83,28 @@ public class ModRegistry {
} }
public static void registerBlocks() { public static void registerBlocks() {
Arrays.stream(Ores.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().group(TechReborn.ITEMGROUP))); Settings itemGroup = new Item.Settings().group(TechReborn.ITEMGROUP);
Arrays.stream(StorageBlocks.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().group(TechReborn.ITEMGROUP))); Arrays.stream(Ores.values()).forEach(value -> RebornRegistry.registerBlock(value.block, itemGroup));
Arrays.stream(StorageBlocks.values()).forEach(value -> RebornRegistry.registerBlock(value.block, itemGroup));
Arrays.stream(MachineBlocks.values()).forEach(value -> { Arrays.stream(MachineBlocks.values()).forEach(value -> {
RebornRegistry.registerBlock(value.frame, new Item.Settings().group(TechReborn.ITEMGROUP)); RebornRegistry.registerBlock(value.frame, itemGroup);
RebornRegistry.registerBlock(value.casing, new Item.Settings().group(TechReborn.ITEMGROUP)); RebornRegistry.registerBlock(value.casing, itemGroup);
}); });
Arrays.stream(TRContent.SolarPanels.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().group(TechReborn.ITEMGROUP))); Arrays.stream(TRContent.SolarPanels.values()).forEach(value -> RebornRegistry.registerBlock(value.block, itemGroup));
Arrays.stream(Cables.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().group(TechReborn.ITEMGROUP))); Arrays.stream(Cables.values()).forEach(value -> RebornRegistry.registerBlock(value.block, itemGroup));
Arrays.stream(Machine.values()).forEach(value -> RebornRegistry.registerBlock(value.block, new Item.Settings().group(TechReborn.ITEMGROUP))); Arrays.stream(Machine.values()).forEach(value -> RebornRegistry.registerBlock(value.block, itemGroup));
// Misc. blocks // Misc. blocks
RebornRegistry.registerBlock(TRContent.COMPUTER_CUBE = InitUtils.setup(new BlockComputerCube(), "computer_cube"), new Item.Settings().group(TechReborn.ITEMGROUP)); RebornRegistry.registerBlock(TRContent.COMPUTER_CUBE = InitUtils.setup(new BlockComputerCube(), "computer_cube"), itemGroup);
RebornRegistry.registerBlock(TRContent.NUKE = InitUtils.setup(new BlockNuke(), "nuke"), new Item.Settings().group(TechReborn.ITEMGROUP)); RebornRegistry.registerBlock(TRContent.NUKE = InitUtils.setup(new BlockNuke(), "nuke"), itemGroup);
RebornRegistry.registerBlock(TRContent.REFINED_IRON_FENCE = InitUtils.setup(new BlockRefinedIronFence(), "refined_iron_fence"), new Item.Settings().group(TechReborn.ITEMGROUP)); RebornRegistry.registerBlock(TRContent.REFINED_IRON_FENCE = InitUtils.setup(new BlockRefinedIronFence(), "refined_iron_fence"), itemGroup);
RebornRegistry.registerBlock(TRContent.REINFORCED_GLASS = InitUtils.setup(new BlockReinforcedGlass(), "reinforced_glass"), new Item.Settings().group(TechReborn.ITEMGROUP)); RebornRegistry.registerBlock(TRContent.REINFORCED_GLASS = InitUtils.setup(new BlockReinforcedGlass(), "reinforced_glass"), itemGroup);
RebornRegistry.registerBlock(TRContent.RUBBER_LEAVES = InitUtils.setup(new BlockRubberLeaves(), "rubber_leaves"), new Item.Settings().group(TechReborn.ITEMGROUP)); RebornRegistry.registerBlock(TRContent.RUBBER_LEAVES = InitUtils.setup(new BlockRubberLeaves(), "rubber_leaves"), itemGroup);
RebornRegistry.registerBlock(TRContent.RUBBER_LOG = InitUtils.setup(new BlockRubberLog(), "rubber_log"), new Item.Settings().group(TechReborn.ITEMGROUP)); RebornRegistry.registerBlock(TRContent.RUBBER_LOG = InitUtils.setup(new BlockRubberLog(), "rubber_log"), itemGroup);
RebornRegistry.registerBlock(TRContent.RUBBER_PLANKS = InitUtils.setup(new BlockRubberPlank(), "rubber_planks"), new Item.Settings().group(TechReborn.ITEMGROUP)); RebornRegistry.registerBlock(TRContent.RUBBER_PLANKS = InitUtils.setup(new BlockRubberPlank(), "rubber_planks"), itemGroup);
// RebornRegistry.registerBlock(TRContent.RUBBER_SAPLING = InitUtils.setup(new BlockRubberSapling(), "rubber_sapling"), RebornRegistry.registerBlock(TRContent.RUBBER_SAPLING = InitUtils.setup(new BlockRubberSapling(), "rubber_sapling"), itemGroup);
// ItemBlockRubberSapling.class, RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_SLAB = InitUtils.setup(new BlockRubberPlankSlab(), "rubber_plank_slab"), itemGroup);
// "rubber_sapling"); RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_STAIR = InitUtils.setup(new BlockRubberPlankStair(), "rubber_plank_stair"), itemGroup);
RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_SLAB = InitUtils.setup(new BlockRubberPlankSlab(), "rubber_plank_slab"), new Item.Settings().group(TechReborn.ITEMGROUP));
RebornRegistry.registerBlock(TRContent.RUBBER_PLANK_STAIR = InitUtils.setup(new BlockRubberPlankStair(), "rubber_plank_stair"), new Item.Settings().group(TechReborn.ITEMGROUP));
TechReborn.LOGGER.debug("TechReborns Blocks Loaded"); TechReborn.LOGGER.debug("TechReborns Blocks Loaded");
} }
@ -204,17 +206,6 @@ public class ModRegistry {
RebornRegistry.registerItem(TRContent.DEBUG_TOOL = InitUtils.setup(new ItemDebugTool(), "debug_tool")); RebornRegistry.registerItem(TRContent.DEBUG_TOOL = InitUtils.setup(new ItemDebugTool(), "debug_tool"));
RebornRegistry.registerItem(TRContent.CELL = InitUtils.setup(new DynamicCell(), "cell")); RebornRegistry.registerItem(TRContent.CELL = InitUtils.setup(new DynamicCell(), "cell"));
// TODO: do we need this at all?
BlockMachineBase.advancedFrameStack = new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame());
BlockMachineBase.basicFrameStack = new ItemStack(TRContent.MachineBlocks.BASIC.getFrame());
TechReborn.LOGGER.debug("TechReborns Items Loaded"); TechReborn.LOGGER.debug("TechReborns Items Loaded");
} }
// @SubscribeEvent(priority = EventPriority.LOW)//LOW is used as we want it to load as late as possible, but before crafttweaker
// public static void registerRecipes(RegistryEvent.Register<IRecipe> event) {
// //Register ModRecipes
// ModRecipes.init();
// }
} }

View file

@ -26,20 +26,17 @@ package techreborn.world;
import net.minecraft.block.sapling.SaplingGenerator; import net.minecraft.block.sapling.SaplingGenerator;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraft.world.chunk.ChunkManager;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.AbstractTreeFeature; import net.minecraft.world.gen.feature.AbstractTreeFeature;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Random; import java.util.Random;
public class RubberTreeGenerator extends SaplingGenerator { public class RubberSaplingGenerator extends SaplingGenerator {
boolean isWorldGen = true; boolean isWorldGen = true;
public RubberTreeGenerator() { public RubberSaplingGenerator() {
super(); super();
} }
@ -49,7 +46,7 @@ public class RubberTreeGenerator extends SaplingGenerator {
return null; return null;
} }
public RubberTreeGenerator(boolean isWorldGen) { public RubberSaplingGenerator(boolean isWorldGen) {
super(); super();
this.isWorldGen = isWorldGen; this.isWorldGen = isWorldGen;
} }

View file

@ -22,29 +22,36 @@
* SOFTWARE. * SOFTWARE.
*/ */
package techreborn.blocks; package techreborn.world;
import net.minecraft.block.sapling.SaplingGenerator; import java.util.Random;
import java.util.Set;
import java.util.function.Function;
import com.mojang.datafixers.Dynamic;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MutableIntBoundingBox;
import net.minecraft.world.ModifiableTestableWorld;
import net.minecraft.world.gen.feature.AbstractTreeFeature; import net.minecraft.world.gen.feature.AbstractTreeFeature;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import javax.annotation.Nullable;
import java.util.Random;
/** /**
* @author drcrazy * @author drcrazy
* *
*/ */
public class RubberTree extends SaplingGenerator { public class RubberTreeFeature extends AbstractTreeFeature<DefaultFeatureConfig> {
@Nullable public RubberTreeFeature(Function<Dynamic<?>, ? extends DefaultFeatureConfig> featureConfig, boolean boolean_1) {
@Override super(featureConfig, boolean_1);
protected AbstractTreeFeature<DefaultFeatureConfig> createTreeFeature(Random random) { // TODO Auto-generated constructor stub
return null; }
@Override
protected boolean generate(Set<BlockPos> changedBlocks, ModifiableTestableWorld worldIn, Random rand, BlockPos saplingPos,
MutableIntBoundingBox var5) {
// TODO Auto-generated method stub
return false;
} }
// @Override
// protected AbstractTreeFeature<DefaultFeatureConfig> createTreeFeature(Random random) {
// return new RubberTreeFeature();
// }
} }