1147 - Initial auto mappings pass

This commit is contained in:
modmuss50 2019-05-26 12:37:59 +01:00
parent 48198dbcb3
commit 4e03ac893c
291 changed files with 3335 additions and 3504 deletions

View file

@ -2,10 +2,6 @@ buildscript {
repositories {
mavenCentral()
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
@ -17,16 +13,20 @@ buildscript {
name = "CB Repo"
url = "http://chickenbones.net/maven"
}
maven {
name = "Modmuss50"
url = "http://maven.modmuss50.me/"
}
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath "net.fabricmc:fabric-loom:0.2.2-SNAPSHOT"
classpath "gradle.plugin.net.minecrell:licenser:0.2.1"
classpath 'de.undercouch:gradle-download-task:3.4.3'
//classpath 'net.covers1624:GradleStuff:1.0-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: net.fabricmc.loom.LoomGradlePlugin
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: net.minecrell.gradle.licenser.Licenser
@ -64,40 +64,6 @@ if (ENV.BUILD_NUMBER) {
version = version + "." + "${System.getenv().BUILD_NUMBER}"
}
minecraft {
mappings channel: 'snapshot', version: '20190401-1.13.2'
runs {
client {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
techreborn {
source sourceSets.main
}
if (findProject(':reborncore') != null) {
reborncore {
source project(":reborncore").sourceSets.main
}
}
}
}
server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
techreborn {
source sourceSets.main
}
}
}
}
}
license {
header file('HEADER')
include '**/*.java'
@ -107,23 +73,27 @@ license {
group = 'TechReborn'
dependencies {
minecraft 'net.minecraftforge:forge:1.13.2-25.0.191'
minecraft "com.mojang:minecraft:1.14"
mappings "net.fabricmc:yarn:1.14+build.21"
if (findProject(':reborncore') != null) {
compile project(":reborncore")
} else {
compile 'RebornCore:RebornCore-1.13.2:+:dev'
modCompile "net.fabricmc:fabric-loader:0.4.8+build.154"
modCompile "net.fabricmc.fabric-api:fabric-api:0.3.0-pre+build.156"
modCompile ('RebornCore:RebornCore-1.14:4.0.0.14') {
transitive = false
}
compileOnly "com.google.code.findbugs:jsr305:+"
}
processResources{
inputs.property 'version', project.version
inputs.property 'mcversion', '1.13.2'
inputs.property 'mcversion', '1.14'
from(sourceSets.main.resources.srcDirs) {
include 'META_INF/mods.toml'
expand 'version':project.version, 'mcversion': '1.13.2'
expand 'version':project.version, 'mcversion': '1.14'
}
from(sourceSets.main.resources.srcDirs) {
@ -249,6 +219,8 @@ import com.google.gson.JsonArray
import groovy.util.XmlSlurper
import org.apache.commons.io.FileUtils
import java.util.function.Consumer
task curseTools {
doLast {
def cacheFiles = new File(".gradle/curseTools")
@ -277,140 +249,3 @@ task curseTools {
}
}
}
import com.google.gson.GsonBuilder
import com.google.gson.JsonObject
import org.apache.commons.io.IOUtils
import java.util.zip.ZipFile
//Reads the new fml_cache_annotation file built into the jar file, to find all crafttweaker methods, and saves the data to a file
task mtDocGen {
doLast{
def inputFile = new File(jar.archivePath.getAbsolutePath())
println("Reading " + inputFile.getName() + " for crafttweaker documentation")
def jarFile = new ZipFile(inputFile)
def annotation_cache = jarFile.getEntry("META-INF/fml_cache_annotation.json")
def cache_json = IOUtils.toString(jarFile.getInputStream(annotation_cache), "UTF-8")
def jsonObject = new GsonBuilder().create().fromJson(cache_json, JsonObject.class)
def builder = new StringBuilder()
for(entry in jsonObject.entrySet()){
def clzz = entry.value.asJsonObject
if(!clzz.has("annotations")){
continue
}
def annoations = clzz.get("annotations").asJsonArray
for(annotation in annoations.toList()){
if(annotation.asJsonObject.get("type").asString.equals("METHOD") && annotation.asJsonObject.get("name").asString.equals("Lstanhebben/zenscript/annotations/ZenMethod;")){
def method = sanitsiseMethodName(annotation.asJsonObject.get("target").asString)
if(hasZenDoc(annotation, annoations)){
method = getZenDoc(annotation, annoations)
}
def zen_name = getZenMetName(clzz)
builder.append(zen_name + "." + method)
builder.append("\n")
}
}
}
def outputFile = new File(jar.archivePath.getAbsolutePath().replace(".jar", "-crafttweaker.txt"))
outputFile.write builder.toString()
println("Crafttweaker documentation saved to " + outputFile.name)
}
}
boolean hasZenDoc(JsonObject currentAnnotation, JsonArray annoations){
for(annotation in annoations.toList()){
if(annotation.asJsonObject.get("target").asString.equals(currentAnnotation.get("target").asString) && annotation.asJsonObject.get("name").asString.equals("Ltechreborn/compat/crafttweaker/ZenDocumentation;")){
return true
}
}
return false
}
String getZenDoc(JsonObject currentAnnotation, JsonArray annoations){
for(annotation in annoations.toList()){
if(annotation.asJsonObject.get("target").asString.equals(currentAnnotation.get("target").asString) && annotation.asJsonObject.get("name").asString.equals("Ltechreborn/compat/crafttweaker/ZenDocumentation;")){
def methodName = annotation.asJsonObject.get("target").asString.split("\\(")[0]
def methodParams = annotation.asJsonObject.get("value").asJsonObject.get("value").asString
if(!methodParams.startsWith("(")){
methodParams = "(" + methodParams
}
if(!methodParams.endsWith(")")){
methodParams = methodParams + ")"
}
return methodName + methodParams
}
}
return ""
}
//Gets the zenMethod class name from the class json object
String getZenMetName(JsonObject jsonObject){
def annoations = jsonObject.get("annotations").asJsonArray
for(annotation in annoations.toList()){
if(annotation.asJsonObject.get("type").asString.equals("CLASS") && annotation.asJsonObject.get("name").asString.equals("Lstanhebben/zenscript/annotations/ZenClass;")){
return annotation.asJsonObject.get("value").asJsonObject.get("value").asString
}
}
}
String sanitsiseMethodName(String methodSig){
def builder = new StringBuilder()
def name = methodSig.split("\\(")[0]
builder.append(name)
builder.append("(")
def methodArgs = methodSig.split("\\(")[1].split("\\)")[0].split(";")
for(arg in methodArgs){
def argSlit = arg.split("/")
def argStr = argSlit[argSlit.length -1]
//If a class is not in a package I assume its a primitive //TODO any suggestions for a better way to do this?
if(!arg.contains("/") && !arg.isEmpty()){
argStr = humanizeArg(argStr)
}
builder.append(argStr)
//Dont add the comma to the last arg
if(arg != methodArgs[methodArgs.length - 1]){
builder.append(",")
}
}
builder.append(")")
return builder.toString()
}
//Argumets that are java primitives do not use a freindly name, this method replaces them with something most people will understand
String humanizeArg(String arg){
def primitiveMap = [
Z: "Boolean",
B: "Byte",
C: "Char",
D: "Double",
F: "Float",
I: "Integer",
J: "Long",
L: "Object",
S: "Short"
]
def builder = new StringBuilder()
for(cha in arg.toCharArray()){
builder.append(primitiveMap.get(cha.toString().toUpperCase()))
builder.append(",")
}
//Removes the last ,
return builder.toString().substring(0, builder.toString().length() - 1)
}
task copyToLib(type: Copy) {
into "$buildDir/output/lib"
from configurations.runtime
}

View file

@ -1 +1 @@
rootProject.name = "TechReborn-1.13.2"
rootProject.name = "TechReborn-1.14.2"

View file

@ -24,18 +24,18 @@
package techreborn;
import net.minecraft.block.BlockDispenser;
import net.minecraft.block.DispenserBlock;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import reborncore.common.multiblock.MultiblockEventHandler;
@ -66,7 +66,7 @@ public class TechReborn {
public static TechReborn INSTANCE;
public static final ItemGroup ITEMGROUP = new ItemGroup(-1, MOD_ID) {
@OnlyIn(Dist.CLIENT)
@Environment(EnvType.CLIENT)
public ItemStack createIcon() {
return TRContent.Parts.MACHINE_PARTS.getStack();
}
@ -127,7 +127,7 @@ public class TechReborn {
// Scrapbox
if (BehaviorDispenseScrapbox.dispenseScrapboxes) {
BlockDispenser.registerDispenseBehavior(TRContent.SCRAP_BOX, new BehaviorDispenseScrapbox());
DispenserBlock.registerBehavior(TRContent.SCRAP_BOX, new BehaviorDispenseScrapbox());
}
Torus.genSizeMap(TileFusionControlComputer.maxCoilSize);

View file

@ -25,14 +25,13 @@
package techreborn.api;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.item.ItemUsageContext;
import java.util.List;
public interface IC2Helper {
public void initDuplicates();
public boolean extractSap(ItemUseContext context, List<ItemStack> stacks);
public boolean extractSap(ItemUsageContext context, List<ItemStack> stacks);
}

View file

@ -24,10 +24,10 @@
package techreborn.api;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.minecraft.recipe.Recipe;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;
@ -35,19 +35,19 @@ public class RollingMachineRecipe {
public static final RollingMachineRecipe instance = new RollingMachineRecipe();
public void addShapedOreRecipe(ResourceLocation resourceLocation, ItemStack outputItemStack, Object... objectInputs) {
public void addShapedOreRecipe(Identifier resourceLocation, ItemStack outputItemStack, Object... objectInputs) {
throw new UnsupportedOperationException("Needs moving to json");
}
public void addShapelessOreRecipe(ResourceLocation resourceLocation, ItemStack outputItemStack, Object... objectInputs) {
public void addShapelessOreRecipe(Identifier resourceLocation, ItemStack outputItemStack, Object... objectInputs) {
throw new UnsupportedOperationException("Needs moving to json");
}
public ItemStack findMatchingRecipeOutput(InventoryCrafting inv, World world) {
public ItemStack findMatchingRecipeOutput(CraftingInventory inv, World world) {
throw new UnsupportedOperationException("Needs moving to json");
}
public IRecipe findMatchingRecipe(InventoryCrafting inv, World world) {
public Recipe findMatchingRecipe(CraftingInventory inv, World world) {
throw new UnsupportedOperationException("Needs moving to json");
}

View file

@ -25,7 +25,7 @@
package techreborn.api.fluidreplicator;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fluids.Fluid;
import reborncore.common.util.FluidUtils;
import techreborn.init.TRContent;
import techreborn.tiles.machine.multiblock.TileFluidReplicator;

View file

@ -24,10 +24,10 @@
package techreborn.api.fluidreplicator;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory;
import reborncore.common.util.Tank;
@ -52,7 +52,7 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter {
* @param inputSlots This is the list of the slots that the crafting logic should look for the input UU-Matter.
* @param outputSlots This is the list of slots that the crafting logic should look for output fluid
*/
public FluidReplicatorRecipeCrafter(TileEntity parentTile, Inventory<?> inventory, int[] inputSlots, int[] outputSlots) {
public FluidReplicatorRecipeCrafter(BlockEntity parentTile, Inventory<?> inventory, int[] inputSlots, int[] outputSlots) {
super(ModRecipes.FLUID_REPLICATOR, parentTile, 1, 1, inventory, inputSlots, outputSlots);
}
@ -63,11 +63,11 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter {
if (recipe == null) {
return false;
}
ItemStack inputStack = inventory.getStackInSlot(inputSlots[0]);
if (!inputStack.isItemEqual(TRContent.Parts.UU_MATTER.getStack())) {
ItemStack inputStack = inventory.getInvStack(inputSlots[0]);
if (!inputStack.isEqualIgnoreTags(TRContent.Parts.UU_MATTER.getStack())) {
return false;
}
if (inputStack.getCount() < recipe.getInput()) {
if (inputStack.getAmount() < recipe.getInput()) {
return false;
}
@ -92,7 +92,7 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter {
// RecipeCrafter
@Override
public void updateEntity() {
if (tile.getWorld().isRemote) {
if (tile.getWorld().isClient) {
return;
}
ticksSinceLastChange++;

View file

@ -24,7 +24,7 @@
package techreborn.api.fluidreplicator;
import net.minecraftforge.fluids.Fluid;
import org.apache.commons.lang3.Validate;
import reborncore.common.util.FluidUtils;

View file

@ -24,7 +24,7 @@
package techreborn.api.generator;
import net.minecraftforge.fluids.Fluid;
import reborncore.common.util.FluidUtils;
public class FluidGeneratorRecipe {

View file

@ -25,7 +25,7 @@
package techreborn.api.generator;
import com.google.common.collect.Sets;
import net.minecraftforge.fluids.Fluid;
import reborncore.common.util.FluidUtils;
import java.util.HashSet;

View file

@ -24,7 +24,7 @@
package techreborn.api.generator;
import net.minecraftforge.fluids.Fluid;
import java.util.EnumMap;
import java.util.Optional;

View file

@ -24,13 +24,13 @@
package techreborn.api.recipe;
import net.minecraft.tileentity.TileEntity;
import reborncore.common.crafting.Recipe;
import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory;
import techreborn.init.ModRecipes;
import java.util.List;
import net.minecraft.block.entity.BlockEntity;
/**
* @author drcrazy
@ -44,14 +44,14 @@ public class ScrapboxRecipeCrafter extends RecipeCrafter {
* @param inputSlots Slot IDs for input
* @param outputSlots Slot IDs for output
*/
public ScrapboxRecipeCrafter(TileEntity parentTile, Inventory<?> inventory, int[] inputSlots, int[] outputSlots) {
public ScrapboxRecipeCrafter(BlockEntity parentTile, Inventory<?> inventory, int[] inputSlots, int[] outputSlots) {
super(ModRecipes.SCRAPBOX, parentTile, 1, 1, inventory, inputSlots, outputSlots);
}
@Override
public void updateCurrentRecipe(){
List<Recipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(tile.getWorld());
int random = tile.getWorld().rand.nextInt(scrapboxRecipeList.size());
int random = tile.getWorld().random.nextInt(scrapboxRecipeList.size());
// Sets the current recipe then syncs
setCurrentRecipe(scrapboxRecipeList.get(random));
this.currentNeededTicks = Math.max((int) (currentRecipe.getTime() * (1.0 - getSpeedMultiplier())), 1);

View file

@ -25,9 +25,9 @@
package techreborn.api.recipe.recipes;
import com.google.gson.JsonObject;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.JsonUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.JsonHelper;
import reborncore.common.crafting.Recipe;
import reborncore.common.crafting.RecipeType;
import techreborn.tiles.machine.multiblock.TileIndustrialBlastFurnace;
@ -36,14 +36,14 @@ public class BlastFurnaceRecipe extends Recipe {
int heat;
public BlastFurnaceRecipe(RecipeType<?> type, ResourceLocation name) {
public BlastFurnaceRecipe(RecipeType<?> type, Identifier name) {
super(type, name);
}
@Override
public void deserialize(JsonObject jsonObject) {
super.deserialize(jsonObject);
heat = JsonUtils.getInt(jsonObject, "heat");
heat = JsonHelper.getInt(jsonObject, "heat");
}
@Override
@ -53,7 +53,7 @@ public class BlastFurnaceRecipe extends Recipe {
}
@Override
public boolean canCraft(final TileEntity tile) {
public boolean canCraft(final BlockEntity tile) {
if (tile instanceof TileIndustrialBlastFurnace) {
final TileIndustrialBlastFurnace blastFurnace = (TileIndustrialBlastFurnace) tile;
return blastFurnace.getHeat() >= heat;
@ -62,7 +62,7 @@ public class BlastFurnaceRecipe extends Recipe {
}
@Override
public boolean onCraft(final TileEntity tile) {
public boolean onCraft(final BlockEntity tile) {
return true;
}
}

View file

@ -24,9 +24,9 @@
package techreborn.api.recipe.recipes;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.Identifier;
import reborncore.common.crafting.Recipe;
import reborncore.common.crafting.RecipeType;
import techreborn.tiles.machine.multiblock.TileIndustrialGrinder;
@ -36,12 +36,12 @@ public class IndustrialGrinderRecipe extends Recipe {
//TODO 1.14 fluids
FluidStack fluidStack = null;
public IndustrialGrinderRecipe(RecipeType<?> type, ResourceLocation name) {
public IndustrialGrinderRecipe(RecipeType<?> type, Identifier name) {
super(type, name);
}
@Override
public boolean canCraft(final TileEntity tileEntity) {
public boolean canCraft(final BlockEntity tileEntity) {
TileIndustrialGrinder tile = (TileIndustrialGrinder) tileEntity;
if (!tile.getMultiBlock()) {
return false;
@ -63,7 +63,7 @@ public class IndustrialGrinderRecipe extends Recipe {
}
@Override
public boolean onCraft(final TileEntity tileEntity) {
public boolean onCraft(final BlockEntity tileEntity) {
TileIndustrialGrinder tile = (TileIndustrialGrinder) tileEntity;
final FluidStack recipeFluid = fluidStack;
final FluidStack tankFluid = tile.tank.getFluid();

View file

@ -24,9 +24,9 @@
package techreborn.api.recipe.recipes;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.Identifier;
import reborncore.common.crafting.Recipe;
import reborncore.common.crafting.RecipeType;
import techreborn.tiles.machine.multiblock.TileIndustrialSawmill;
@ -36,12 +36,12 @@ public class IndustrialSawmillRecipe extends Recipe {
//TODO 1.14 fluids
FluidStack fluidStack = null;
public IndustrialSawmillRecipe(RecipeType<?> type, ResourceLocation name) {
public IndustrialSawmillRecipe(RecipeType<?> type, Identifier name) {
super(type, name);
}
@Override
public boolean canCraft(TileEntity tileEntity) {
public boolean canCraft(BlockEntity tileEntity) {
TileIndustrialSawmill tile = (TileIndustrialSawmill) tileEntity;
if (!tile.getMutliBlock()) {
return false;
@ -63,7 +63,7 @@ public class IndustrialSawmillRecipe extends Recipe {
}
@Override
public boolean onCraft(TileEntity tileEntity) {
public boolean onCraft(BlockEntity tileEntity) {
TileIndustrialSawmill tile = (TileIndustrialSawmill) tileEntity;
final FluidStack recipeFluid = fluidStack;
final FluidStack tankFluid = tile.tank.getFluid();

View file

@ -24,27 +24,27 @@
package techreborn.blocks;
import net.minecraft.ChatFormat;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
import reborncore.client.models.ModelCompound;
@ -59,13 +59,13 @@ import javax.annotation.Nullable;
import java.util.List;
public class BlockAlarm extends BaseTileBlock {
public static DirectionProperty FACING = BlockStateProperties.FACING;
public static DirectionProperty FACING = Properties.FACING;
public static BooleanProperty ACTIVE;
protected final VoxelShape[] shape;
public BlockAlarm() {
super(Block.Properties.create(Material.ROCK));
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, EnumFacing.NORTH).with(ACTIVE, false));
super(Block.Settings.of(Material.STONE));
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH).with(ACTIVE, false));
this.shape = GenCuboidShapes(3, 10);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/lighting"));
BlockWrenchEventHandler.wrenableBlocks.add(this);
@ -74,54 +74,54 @@ public class BlockAlarm extends BaseTileBlock {
private VoxelShape[] GenCuboidShapes(double depth, double width) {
double culling = (16.0D - width) / 2 ;
VoxelShape[] shapes = {
Block.makeCuboidShape(culling, 16.0 - depth, culling, 16.0 - culling, 16.0D, 16.0 - culling),
Block.makeCuboidShape(culling, 0.0D, culling, 16.0D - culling, depth, 16.0 - culling),
Block.makeCuboidShape(culling, culling, 16.0 - depth, 16.0 - culling, 16.0 - culling, 16.0D),
Block.makeCuboidShape(culling, culling, 0.0D, 16.0 - culling, 16.0 - culling, depth),
Block.makeCuboidShape(16.0 - depth, culling, culling, 16.0D, 16.0 - culling, 16.0 - culling),
Block.makeCuboidShape(0.0D, culling, culling, depth, 16.0 - culling, 16.0 - culling)
Block.createCuboidShape(culling, 16.0 - depth, culling, 16.0 - culling, 16.0D, 16.0 - culling),
Block.createCuboidShape(culling, 0.0D, culling, 16.0D - culling, depth, 16.0 - culling),
Block.createCuboidShape(culling, culling, 16.0 - depth, 16.0 - culling, 16.0 - culling, 16.0D),
Block.createCuboidShape(culling, culling, 0.0D, 16.0 - culling, 16.0 - culling, depth),
Block.createCuboidShape(16.0 - depth, culling, culling, 16.0D, 16.0 - culling, 16.0 - culling),
Block.createCuboidShape(0.0D, culling, culling, depth, 16.0 - culling, 16.0 - culling)
};
return shapes;
}
public static boolean isActive(IBlockState state) {
public static boolean isActive(BlockState state) {
return state.get(ACTIVE);
}
public static EnumFacing getFacing(IBlockState state) {
return (EnumFacing) state.get(FACING);
public static Direction getFacing(BlockState state) {
return (Direction) state.get(FACING);
}
public static void setFacing(EnumFacing facing, World world, BlockPos pos) {
public static void setFacing(Direction facing, World world, BlockPos pos) {
world.setBlockState(pos, world.getBlockState(pos).with(FACING, facing));
}
public static void setActive(boolean active, World world, BlockPos pos) {
EnumFacing facing = world.getBlockState(pos).get(FACING);
IBlockState state = world.getBlockState(pos).with(ACTIVE, active).with(FACING, facing);
Direction facing = world.getBlockState(pos).get(FACING);
BlockState state = world.getBlockState(pos).with(ACTIVE, active).with(FACING, facing);
world.setBlockState(pos, state, 3);
}
// BaseTileBlock
@Nullable
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileAlarm();
}
// Block
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
ACTIVE = BooleanProperty.create("active");
builder.add(FACING, ACTIVE);
}
@Nullable
@Override
public IBlockState getStateForPlacement(BlockItemUseContext context) {
for (EnumFacing enumfacing : context.getNearestLookingDirections()) {
IBlockState iblockstate = this.getDefaultState().with(FACING, enumfacing.getOpposite());
if (iblockstate.isValidPosition(context.getWorld(), context.getPos())) {
public BlockState getPlacementState(ItemPlacementContext context) {
for (Direction enumfacing : context.getPlacementFacings()) {
BlockState iblockstate = this.getDefaultState().with(FACING, enumfacing.getOpposite());
if (iblockstate.canPlaceAt(context.getWorld(), context.getBlockPos())) {
return iblockstate;
}
}
@ -130,9 +130,9 @@ public class BlockAlarm extends BaseTileBlock {
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
// We extended BaseTileBlock. Thus we should always have tile entity. I hope.
if (tileEntity == null) {
@ -145,7 +145,7 @@ public class BlockAlarm extends BaseTileBlock {
}
}
if (!worldIn.isRemote && playerIn.isSneaking()) {
if (!worldIn.isClient && playerIn.isSneaking()) {
((TileAlarm) tileEntity).rightClick();
return true;
@ -155,22 +155,22 @@ public class BlockAlarm extends BaseTileBlock {
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.MODEL;
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}
@Override
public boolean isFullCube(IBlockState state) {
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
tooltip.add(new TextComponentTranslation("techreborn.tooltip.alarm").applyTextStyle(TextFormatting.GRAY));
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, TooltipContext flagIn) {
tooltip.add(new TranslatableComponent("techreborn.tooltip.alarm").applyFormat(ChatFormat.GRAY));
}
@Override
public VoxelShape getShape(IBlockState state, IBlockReader worldIn, BlockPos pos) {
return shape[getFacing(state).getIndex()];
public VoxelShape getShape(BlockState state, BlockView worldIn, BlockPos pos) {
return shape[getFacing(state).getId()];
}
}

View file

@ -24,15 +24,15 @@
package techreborn.blocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Rotation;
import net.minecraft.util.SoundCategory;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.BlockRotation;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
import reborncore.api.tile.IMachineGuiHandler;
@ -56,23 +56,23 @@ public class BlockComputerCube extends BlockMachineBase {
}
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack tool = playerIn.getHeldItem(EnumHand.MAIN_HAND);
ItemStack tool = playerIn.getStackInHand(Hand.MAIN_HAND);
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.COMPUTER_CUBE, 1);
spawnAsEntity(worldIn, pos, drop);
worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, ModSounds.BLOCK_DISMANTLE,
dropStack(worldIn, pos, drop);
worldIn.playSound(null, playerIn.x, playerIn.y, playerIn.z, ModSounds.BLOCK_DISMANTLE,
SoundCategory.BLOCKS, 0.6F, 1F);
if (!worldIn.isRemote) {
if (!worldIn.isClient) {
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
}
return true;
}
else {
rotate(worldIn.getBlockState(pos), worldIn, pos, Rotation.CLOCKWISE_90);
rotate(worldIn.getBlockState(pos), worldIn, pos, BlockRotation.CLOCKWISE_90);
return true;
}
}

View file

@ -25,11 +25,11 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.world.BlockView;
import reborncore.common.multiblock.BlockMultiblockBase;
import techreborn.tiles.TileMachineCasing;
@ -38,11 +38,11 @@ public class BlockMachineCasing extends BlockMultiblockBase {
public final int heatCapacity;
public BlockMachineCasing(int heatCapacity) {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(2f).sound(SoundType.METAL));
super(Block.Settings.of(Material.METAL).strength(2f).sounds(BlockSoundGroup.METAL));
this.heatCapacity = heatCapacity;
}
public static int getHeatFromState(IBlockState state) {
public static int getHeatFromState(BlockState state) {
Block block = state.getBlock();
if (!(block instanceof BlockMachineCasing)) {
return 0;
@ -52,7 +52,7 @@ public class BlockMachineCasing extends BlockMultiblockBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileMachineCasing();
}

View file

@ -25,13 +25,13 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.Material;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.common.BaseBlock;
public class BlockMachineFrame extends BaseBlock {
public BlockMachineFrame() {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(1f).sound(SoundType.METAL));
super(Block.Settings.of(Material.METAL).strength(1f).sounds(BlockSoundGroup.METAL));
}
}

View file

@ -25,19 +25,19 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.init.SoundEvents;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.util.SoundCategory;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.ProjectileEntity;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import reborncore.common.BaseBlock;
@ -51,40 +51,40 @@ public class BlockNuke extends BaseBlock {
public static BooleanProperty OVERLAY = BooleanProperty.create("overlay");
public BlockNuke() {
super(Block.Properties.create(Material.TNT));
this.setDefaultState(this.stateContainer.getBaseState().with(OVERLAY, false));
super(Block.Settings.of(Material.TNT));
this.setDefaultState(this.stateFactory.getDefaultState().with(OVERLAY, false));
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
public void ignite(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter) {
if (!worldIn.isRemote) {
public void ignite(World worldIn, BlockPos pos, BlockState state, LivingEntity igniter) {
if (!worldIn.isClient) {
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F),
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), igniter);
worldIn.spawnEntity(entitynukeprimed);
worldIn.playSound((EntityPlayer) null, entitynukeprimed.posX, entitynukeprimed.posY, entitynukeprimed.posZ,
worldIn.playSound((PlayerEntity) null, entitynukeprimed.x, entitynukeprimed.y, entitynukeprimed.z,
SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
}
@Override
public void onExplosionDestroy(World worldIn, BlockPos pos, Explosion explosionIn) {
if (!worldIn.isRemote) {
public void onDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn) {
if (!worldIn.isClient) {
EntityNukePrimed entitynukeprimed = new EntityNukePrimed(worldIn, (double) ((float) pos.getX() + 0.5F),
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
entitynukeprimed.setFuse(worldIn.rand.nextInt(EntityNukePrimed.fuseTime / 4) + EntityNukePrimed.fuseTime / 8);
(double) pos.getY(), (double) ((float) pos.getZ() + 0.5F), explosionIn.getCausingEntity());
entitynukeprimed.setFuse(worldIn.random.nextInt(EntityNukePrimed.fuseTime / 4) + EntityNukePrimed.fuseTime / 8);
worldIn.spawnEntity(entitynukeprimed);
}
}
@Override
public void onEntityCollision(IBlockState state, World worldIn, BlockPos pos, Entity entityIn) {
if (!worldIn.isRemote && entityIn instanceof EntityArrow) {
EntityArrow entityarrow = (EntityArrow) entityIn;
EntityLivingBase shooter = null;
if (entityarrow.getShooter() instanceof EntityLivingBase) {
shooter = (EntityLivingBase) entityarrow.getShooter();
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
if (!worldIn.isClient && entityIn instanceof ProjectileEntity) {
ProjectileEntity entityarrow = (ProjectileEntity) entityIn;
LivingEntity shooter = null;
if (entityarrow.getOwner() instanceof LivingEntity) {
shooter = (LivingEntity) entityarrow.getOwner();
}
if (entityarrow.isBurning()) {
if (entityarrow.isOnFire()) {
ignite(worldIn, pos, state, shooter);
worldIn.removeBlock(pos);
}
@ -93,24 +93,24 @@ public class BlockNuke extends BaseBlock {
@SuppressWarnings("deprecation")
@Override
public void onBlockAdded(IBlockState state, World worldIn, BlockPos pos, IBlockState oldState) {
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState) {
super.onBlockAdded(state, worldIn, pos, oldState);
if (worldIn.isBlockPowered(pos)) {
if (worldIn.isReceivingRedstonePower(pos)) {
ignite(worldIn, pos, state, null);
worldIn.removeBlock(pos);
}
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos p_189540_5_) {
if (worldIn.isBlockPowered(pos)) {
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos p_189540_5_) {
if (worldIn.isReceivingRedstonePower(pos)) {
ignite(worldIn, pos, state, null);
worldIn.removeBlock(pos);
}
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
builder.add(OVERLAY);
}
}

View file

@ -25,10 +25,10 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.common.registration.RebornRegister;
@ -68,11 +68,11 @@ public class BlockOre extends Block {
public static int sphaleriteMaxQuantity = 2;
public BlockOre() {
super(Block.Properties.create(Material.ROCK).hardnessAndResistance(2f));
super(Block.Settings.of(Material.STONE).strength(2f));
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
Block ore = state.getBlock();
Random random = new Random();

View file

@ -25,14 +25,14 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.block.FenceBlock;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.sound.BlockSoundGroup;
public class BlockRefinedIronFence extends BlockFence {
public class BlockRefinedIronFence extends FenceBlock {
public BlockRefinedIronFence() {
super(Block.Properties.create(Material.IRON, MaterialColor.WOOD).hardnessAndResistance(2.0F, 3.0F).sound(SoundType.METAL));
super(Block.Settings.of(Material.METAL, MaterialColor.WOOD).strength(2.0F, 3.0F).sounds(BlockSoundGroup.METAL));
}
}

View file

@ -25,25 +25,25 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockGlass;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.GlassBlock;
import net.minecraft.block.Material;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
import java.util.Random;
public class BlockReinforcedGlass extends BlockGlass {
public class BlockReinforcedGlass extends GlassBlock {
public BlockReinforcedGlass() {
super(Block.Properties.create(Material.GLASS).hardnessAndResistance(4f, 60f).sound(SoundType.STONE));
super(Block.Settings.of(Material.GLASS).strength(4f, 60f).sounds(BlockSoundGroup.STONE));
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
@Override
public int quantityDropped(IBlockState state, Random random) {
public int quantityDropped(BlockState state, Random random) {
return 1;
}
}

View file

@ -25,13 +25,13 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFire;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.IItemProvider;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FireBlock;
import net.minecraft.block.LeavesBlock;
import net.minecraft.block.Material;
import net.minecraft.item.ItemConvertible;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import reborncore.client.models.ModelCompound;
@ -39,16 +39,16 @@ import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
import techreborn.init.TRContent;
public class BlockRubberLeaves extends BlockLeaves {
public class BlockRubberLeaves extends LeavesBlock {
public BlockRubberLeaves() {
super(Block.Properties.create(Material.LEAVES).hardnessAndResistance(0.2F).tickRandomly().sound(SoundType.PLANT));
((BlockFire) Blocks.FIRE).setFireInfo(this, 30, 60);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, DISTANCE, PERSISTENT));
super(Block.Settings.of(Material.LEAVES).strength(0.2F).ticksRandomly().sounds(BlockSoundGroup.GRASS));
((FireBlock) Blocks.FIRE).registerFlammableBlock(this, 30, 60);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, EnvTypeANCE, PERSISTENT));
}
@Override
public IItemProvider getItemDropped(IBlockState state, World worldIn, BlockPos pos, int fortune) {
public ItemConvertible getItemDropped(BlockState state, World worldIn, BlockPos pos, int fortune) {
return TRContent.RUBBER_SAPLING;
}
}

View file

@ -25,27 +25,27 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFire;
import net.minecraft.block.BlockLog;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FireBlock;
import net.minecraft.block.LogBlock;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.SoundCategory;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.tag.BlockTags;
import net.minecraft.tag.Tag;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -64,39 +64,39 @@ import java.util.Random;
/**
* Created by modmuss50 on 19/02/2016.
*/
public class BlockRubberLog extends BlockLog {
public class BlockRubberLog extends LogBlock {
public static DirectionProperty SAP_SIDE = BlockStateProperties.HORIZONTAL_FACING;
public static DirectionProperty SAP_SIDE = Properties.FACING_HORIZONTAL;
public static BooleanProperty HAS_SAP = BooleanProperty.create("hassap");
public BlockRubberLog() {
super(MaterialColor.OBSIDIAN, Block.Properties.create(Material.WOOD, MaterialColor.BROWN).hardnessAndResistance(2.0F).sound(SoundType.WOOD).tickRandomly());
this.setDefaultState(this.getDefaultState().with(SAP_SIDE, EnumFacing.NORTH).with(HAS_SAP, false).with(AXIS, EnumFacing.Axis.Y));
((BlockFire) Blocks.FIRE).setFireInfo(this, 5, 5);
super(MaterialColor.SPRUCE, Block.Settings.of(Material.WOOD, MaterialColor.BROWN).strength(2.0F).sounds(BlockSoundGroup.WOOD).ticksRandomly());
this.setDefaultState(this.getDefaultState().with(SAP_SIDE, Direction.NORTH).with(HAS_SAP, false).with(AXIS, Direction.Axis.Y));
((FireBlock) Blocks.FIRE).registerFlammableBlock(this, 5, 5);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
super.fillStateContainer(builder);
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
super.appendProperties(builder);
builder.add(SAP_SIDE, HAS_SAP);
}
@Override
public boolean isIn(Tag<Block> tagIn) {
public boolean matches(Tag<Block> tagIn) {
return tagIn == BlockTags.LOGS;
}
@Override
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) {
public void onBreak(World worldIn, BlockPos pos, BlockState state, PlayerEntity player) {
int i = 4;
int j = i + 1;
if (worldIn.isAreaLoaded(pos.add(-j, -j, -j), pos.add(j, j, j))) {
for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-i, -i, -i), pos.add(i, i, i))) {
IBlockState state1 = worldIn.getBlockState(blockpos);
if (state1.isIn(BlockTags.LEAVES)) {
state1.tick(worldIn, blockpos, worldIn.getRandom());
state1.randomTick(worldIn, blockpos, worldIn.getRandom());
BlockState state1 = worldIn.getBlockState(blockpos);
if (state1.matches(BlockTags.LEAVES)) {
state1.scheduledTick(worldIn, blockpos, worldIn.getRandom());
state1.onRandomTick(worldIn, blockpos, worldIn.getRandom());
}
}
}
@ -104,16 +104,16 @@ public class BlockRubberLog extends BlockLog {
@SuppressWarnings("deprecation")
@Override
public void tick(IBlockState state, World worldIn, BlockPos pos, Random random) {
super.tick(state, worldIn, pos, random);
if (state.get(AXIS) != EnumFacing.Axis.Y) {
public void onScheduledTick(BlockState state, World worldIn, BlockPos pos, Random random) {
super.onScheduledTick(state, worldIn, pos, random);
if (state.get(AXIS) != Direction.Axis.Y) {
return;
}
if (state.get(HAS_SAP)) {
return;
}
if (random.nextInt(50) == 0) {
EnumFacing facing = EnumFacing.byHorizontalIndex(random.nextInt(4));
Direction facing = Direction.fromHorizontal(random.nextInt(4));
if (worldIn.getBlockState(pos.down()).getBlock() == this
&& worldIn.getBlockState(pos.up()).getBlock() == this) {
worldIn.setBlockState(pos, state.with(HAS_SAP, true).with(SAP_SIDE, facing));
@ -123,10 +123,10 @@ public class BlockRubberLog extends BlockLog {
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
Hand hand, Direction side, float hitX, float hitY, float hitZ) {
super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
if (stack.isEmpty()) {
return false;
}
@ -136,22 +136,22 @@ public class BlockRubberLog extends BlockLog {
}
if ((capEnergy != null && capEnergy.getEnergyStored() > 20) || stack.getItem() instanceof ItemTreeTap) {
if (state.get(HAS_SAP) && state.get(SAP_SIDE) == side) {
worldIn.setBlockState(pos, state.with(HAS_SAP, false).with(SAP_SIDE, EnumFacing.byHorizontalIndex(0)));
worldIn.setBlockState(pos, state.with(HAS_SAP, false).with(SAP_SIDE, Direction.fromHorizontal(0)));
worldIn.playSound(null, pos.getX(), pos.getY(), pos.getZ(), ModSounds.SAP_EXTRACT, SoundCategory.BLOCKS,
0.6F, 1F);
if (!worldIn.isRemote) {
if (!worldIn.isClient) {
if (capEnergy != null) {
capEnergy.extractEnergy(20, false);
ExternalPowerSystems.requestEnergyFromArmor(capEnergy, playerIn);
} else {
playerIn.getHeldItem(EnumHand.MAIN_HAND).damageItem(1, playerIn);
playerIn.getStackInHand(Hand.MAIN_HAND).damageItem(1, playerIn);
}
if (!playerIn.inventory.addItemStackToInventory(TRContent.Parts.SAP.getStack())) {
if (!playerIn.inventory.insertStack(TRContent.Parts.SAP.getStack())) {
WorldUtils.dropItem(TRContent.Parts.SAP.getStack(), worldIn, pos.offset(side));
}
if (playerIn instanceof EntityPlayerMP) {
TRRecipeHandler.unlockTRRecipes((EntityPlayerMP) playerIn);
if (playerIn instanceof ServerPlayerEntity) {
TRRecipeHandler.unlockTRRecipes((ServerPlayerEntity) playerIn);
}
}
return true;
@ -161,7 +161,7 @@ public class BlockRubberLog extends BlockLog {
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
drops.add(new ItemStack(this));
if (state.get(HAS_SAP)) {
if (new Random().nextInt(4) == 0) {

View file

@ -25,10 +25,10 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFire;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.block.Blocks;
import net.minecraft.block.FireBlock;
import net.minecraft.block.Material;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
@ -39,8 +39,8 @@ import techreborn.TechReborn;
public class BlockRubberPlank extends Block {
public BlockRubberPlank() {
super(Block.Properties.create(Material.WOOD).hardnessAndResistance(2f).sound(SoundType.WOOD));
((BlockFire) Blocks.FIRE).setFireInfo(this, 5, 20);
super(Block.Settings.of(Material.WOOD).strength(2f).sounds(BlockSoundGroup.WOOD));
((FireBlock) Blocks.FIRE).registerFlammableBlock(this, 5, 20);
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
}

View file

@ -25,18 +25,18 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.block.SlabBlock;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
public class BlockRubberPlankSlab extends BlockSlab {
public class BlockRubberPlankSlab extends SlabBlock {
public BlockRubberPlankSlab() {
super(Block.Properties.create(Material.WOOD, MaterialColor.OBSIDIAN).hardnessAndResistance(2.0F, 15.0F).sound(SoundType.WOOD));
super(Block.Settings.of(Material.WOOD, MaterialColor.SPRUCE).strength(2.0F, 15.0F).sounds(BlockSoundGroup.WOOD));
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
}

View file

@ -25,16 +25,16 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;
import net.minecraft.block.StairsBlock;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn;
import techreborn.init.TRContent;
public class BlockRubberPlankStair extends BlockStairs {
public class BlockRubberPlankStair extends StairsBlock {
public BlockRubberPlankStair() {
super(TRContent.RUBBER_PLANKS.getDefaultState(), Block.Properties.from(TRContent.RUBBER_PLANKS));
super(TRContent.RUBBER_PLANKS.getDefaultState(), Block.Settings.copy(TRContent.RUBBER_PLANKS));
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
}
}

View file

@ -25,16 +25,16 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.Material;
import net.minecraft.block.SaplingBlock;
import net.minecraft.sound.BlockSoundGroup;
/**
* Created by modmuss50 on 20/02/2016.
*/
public class BlockRubberSapling extends BlockSapling {
public class BlockRubberSapling extends SaplingBlock {
public BlockRubberSapling() {
super(new RubberTree(), Block.Properties.create(Material.PLANTS).sound(SoundType.PLANT));
super(new RubberTree(), Block.Settings.of(Material.PLANT).sounds(BlockSoundGroup.GRASS));
}
}

View file

@ -25,14 +25,14 @@
package techreborn.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.Material;
import net.minecraft.sound.BlockSoundGroup;
import reborncore.common.BaseBlock;
public class BlockStorage extends BaseBlock {
public BlockStorage() {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(2f).sound(SoundType.METAL));
super(Block.Settings.of(Material.METAL).strength(2f).sounds(BlockSoundGroup.METAL));
}
// public static ItemStack getStorageBlockByName(String name, int count) {

View file

@ -24,13 +24,13 @@
package techreborn.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.ChatFormat;
import net.minecraft.block.Material;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.common.blocks.BlockMachineBase;
@ -43,8 +43,8 @@ public class BlockSupercondensator extends BlockMachineBase {
}
@Override
public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
tooltip.add(new TextComponentString("WIP Coming Soon").applyTextStyle(TextFormatting.RED));
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, TooltipContext flagIn) {
tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED));
// TODO
// Remember to remove WIP override and imports once complete
}

View file

@ -25,20 +25,19 @@
package techreborn.blocks;
import java.util.Random;
import net.minecraft.block.trees.AbstractTree;
import net.minecraft.block.sapling.SaplingGenerator;
import net.minecraft.world.gen.feature.AbstractTreeFeature;
import net.minecraft.world.gen.feature.NoFeatureConfig;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import techreborn.world.feature.RubberTreeFeature;
/**
* @author drcrazy
*
*/
public class RubberTree extends AbstractTree {
public class RubberTree extends SaplingGenerator {
@Override
protected AbstractTreeFeature<NoFeatureConfig> getTreeFeature(Random random) {
protected AbstractTreeFeature<DefaultFeatureConfig> createTreeFeature(Random random) {
return new RubberTreeFeature();
}
}

View file

@ -25,20 +25,20 @@
package techreborn.blocks.cable;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockWithEntity;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.AbstractProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.AbstractProperty;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
@ -56,7 +56,7 @@ import javax.annotation.Nullable;
* Created by modmuss50 on 19/05/2017.
*/
@RebornRegister(TechReborn.MOD_ID)
public class BlockCable extends BlockContainer {
public class BlockCable extends BlockWithEntity {
public static final BooleanProperty EAST = BooleanProperty.create("east");
public static final BooleanProperty WEST = BooleanProperty.create("west");
@ -77,22 +77,22 @@ public class BlockCable extends BlockContainer {
public final TRContent.Cables type;
public BlockCable(TRContent.Cables type) {
super(Block.Properties.create(Material.ROCK).hardnessAndResistance(1f, 8f));
super(Block.Settings.of(Material.STONE).strength(1f, 8f));
this.type = type;
setDefaultState(this.stateContainer.getBaseState().with(EAST, false).with(WEST, false).with(NORTH, false).with(SOUTH, false).with(UP, false).with(DOWN, false));
setDefaultState(this.stateFactory.getDefaultState().with(EAST, false).with(WEST, false).with(NORTH, false).with(SOUTH, false).with(UP, false).with(DOWN, false));
BlockWrenchEventHandler.wrenableBlocks.add(this);
}
//see for more info https://www.reddit.com/r/feedthebeast/comments/5mxwq9/psa_mod_devs_do_you_call_worldgettileentity_from/
public TileEntity getTileEntitySafely(IWorld blockAccess, BlockPos pos) {
public BlockEntity getTileEntitySafely(IWorld blockAccess, BlockPos pos) {
// if (blockAccess instanceof ChunkCache) {
// return ((ChunkCache) blockAccess).getTileEntity(pos, Chunk.EnumCreateEntityType.CHECK);
// } else {
return blockAccess.getTileEntity(pos);
return blockAccess.getBlockEntity(pos);
// }
}
public AbstractProperty<Boolean> getProperty(EnumFacing facing) {
public AbstractProperty<Boolean> getProperty(Direction facing) {
switch (facing) {
case EAST:
return EAST;
@ -113,22 +113,22 @@ public class BlockCable extends BlockContainer {
// BlockContainer
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.MODEL;
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}
@Nullable
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileCable();
}
// Block
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
// We should always have tile entity. I hope.
if (tileEntity == null) {
@ -144,7 +144,7 @@ public class BlockCable extends BlockContainer {
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
builder.add(EAST, WEST, NORTH, SOUTH, UP, DOWN);
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.fluid;
import net.minecraft.block.BlockFlowingFluid;
import net.minecraft.fluid.FlowingFluid;
import net.minecraft.block.FluidBlock;
import net.minecraft.fluid.BaseFluid;
public class BlockFluidBase extends BlockFlowingFluid {
public class BlockFluidBase extends FluidBlock {
public BlockFluidBase(FlowingFluid fluid, Properties properties) {
public BlockFluidBase(BaseFluid fluid, Settings properties) {
super(fluid, properties);
}

View file

@ -24,13 +24,13 @@
package techreborn.blocks.fluid;
import net.minecraft.fluid.FlowingFluid;
import net.minecraft.fluid.BaseFluid;
public class BlockFluidTechReborn extends BlockFluidBase {
String name;
public BlockFluidTechReborn(FlowingFluid fluid, Properties properties, String name) {
public BlockFluidTechReborn(BaseFluid fluid, Settings properties, String name) {
super(fluid, properties);
//setTranslationKey(name);
this.name = name;

View file

@ -24,14 +24,14 @@
package techreborn.blocks.fluid;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.Fluid;
import net.minecraft.util.Identifier;
public class TechRebornFluid extends Fluid {
public TechRebornFluid(String fluidName) {
super(fluidName,
new ResourceLocation("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"),
new ResourceLocation("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"));
new Identifier("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"),
new Identifier("techreborn:blocks/fluids/" + fluidName.replaceFirst("fluid", "") + "_flowing"));
//FluidRegistry.addBucketForFluid(this);
}
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -45,7 +45,7 @@ public class BlockDieselGenerator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileDieselGenerator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -41,7 +41,7 @@ public class BlockDragonEggSyphon extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileDragonEggSyphon();
}

View file

@ -25,23 +25,23 @@
package techreborn.blocks.generator;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.Material;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.api.ToolManager;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -54,23 +54,23 @@ import java.util.List;
public class BlockFusionCoil extends Block {
public BlockFusionCoil() {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(2f).sound(SoundType.METAL));
super(Block.Settings.of(Material.METAL).strength(2f).sounds(BlockSoundGroup.METAL));
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/generators"));
}
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack tool = playerIn.getHeldItem(EnumHand.MAIN_HAND);
ItemStack tool = playerIn.getStackInHand(Hand.MAIN_HAND);
if (!tool.isEmpty() && ToolManager.INSTANCE.canHandleTool(tool)) {
if (ToolManager.INSTANCE.handleTool(tool, pos, worldIn, playerIn, side, false)) {
if (playerIn.isSneaking()) {
ItemStack drop = new ItemStack(this);
spawnAsEntity(worldIn, pos, drop);
worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, ModSounds.BLOCK_DISMANTLE,
dropStack(worldIn, pos, drop);
worldIn.playSound(null, playerIn.x, playerIn.y, playerIn.z, ModSounds.BLOCK_DISMANTLE,
SoundCategory.BLOCKS, 0.6F, 1F);
if (!worldIn.isRemote) {
if (!worldIn.isClient) {
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
}
return true;
@ -80,12 +80,12 @@ public class BlockFusionCoil extends Block {
return false;
}
@OnlyIn(Dist.CLIENT)
@Environment(EnvType.CLIENT)
@Override
public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip,
ITooltipFlag flagIn) {
super.addInformation(stack, worldIn, tooltip, flagIn);
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip,
TooltipContext flagIn) {
super.buildTooltip(stack, worldIn, tooltip, flagIn);
// TODO: Translate
tooltip.add(new TextComponentString("Right click Fusion Control computer to auto place"));
tooltip.add(new TextComponent("Right click Fusion Control computer to auto place"));
}
}

View file

@ -24,14 +24,14 @@
package techreborn.blocks.generator;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
@ -54,20 +54,20 @@ public class BlockFusionControlComputer extends BlockMachineBase {
}
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
final TileFusionControlComputer tileFusionControlComputer = (TileFusionControlComputer) worldIn.getTileEntity(pos);
if(!playerIn.getHeldItem(hand).isEmpty() && (playerIn.getHeldItem(hand).getItem() == TRContent.Machine.FUSION_COIL.asItem())){
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
Hand hand, Direction side, float hitX, float hitY, float hitZ) {
final TileFusionControlComputer tileFusionControlComputer = (TileFusionControlComputer) worldIn.getBlockEntity(pos);
if(!playerIn.getStackInHand(hand).isEmpty() && (playerIn.getStackInHand(hand).getItem() == TRContent.Machine.FUSION_COIL.asItem())){
List<BlockPos> coils = Torus.generate(tileFusionControlComputer.getPos(), tileFusionControlComputer.size);
boolean placed = false;
for(BlockPos coil : coils){
if(playerIn.getHeldItem(hand).isEmpty()){
if(playerIn.getStackInHand(hand).isEmpty()){
return true;
}
if(worldIn.isAirBlock(coil) && !tileFusionControlComputer.isCoil(coil)){
if(worldIn.isAir(coil) && !tileFusionControlComputer.isCoil(coil)){
worldIn.setBlockState(coil, TRContent.Machine.FUSION_COIL.block.getDefaultState());
if(!playerIn.isCreative()){
playerIn.getHeldItem(hand).shrink(1);
playerIn.getStackInHand(hand).subtractAmount(1);
}
placed = true;
}
@ -87,18 +87,18 @@ public class BlockFusionControlComputer extends BlockMachineBase {
}
@Override
public void onEntityWalk(final World worldIn, final BlockPos pos, final Entity entityIn) {
super.onEntityWalk(worldIn, pos, entityIn);
if (worldIn.getTileEntity(pos) instanceof TileFusionControlComputer) {
if (((TileFusionControlComputer) worldIn.getTileEntity(pos)).crafingTickTime != 0
&& ((TileFusionControlComputer) worldIn.getTileEntity(pos)).checkCoils()) {
entityIn.attackEntityFrom(new FusionDamageSource(), 200F);
public void onSteppedOn(final World worldIn, final BlockPos pos, final Entity entityIn) {
super.onSteppedOn(worldIn, pos, entityIn);
if (worldIn.getBlockEntity(pos) instanceof TileFusionControlComputer) {
if (((TileFusionControlComputer) worldIn.getBlockEntity(pos)).crafingTickTime != 0
&& ((TileFusionControlComputer) worldIn.getBlockEntity(pos)).checkCoils()) {
entityIn.damage(new FusionDamageSource(), 200F);
}
}
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileFusionControlComputer();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockGasTurbine extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileGasTurbine();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -41,7 +41,7 @@ public class BlockLightningRod extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileLightningRod();
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.generator;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.ChatFormat;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -47,8 +47,8 @@ public class BlockMagicEnergyAbsorber extends BlockMachineBase {
}
@Override
public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
tooltip.add(new TextComponentString("WIP Coming Soon").applyTextStyle(TextFormatting.RED));
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, TooltipContext flagIn) {
tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED));
// TODO
// Remember to remove WIP override and imports once complete
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.generator;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.ChatFormat;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -47,8 +47,8 @@ public class BlockMagicEnergyConverter extends BlockMachineBase {
}
@Override
public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
tooltip.add(new TextComponentString("WIP Coming Soon").applyTextStyle(TextFormatting.RED));
public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip, TooltipContext flagIn) {
tooltip.add(new TextComponent("WIP Coming Soon").applyFormat(ChatFormat.RED));
// TODO
// Remember to remove WIP override and imports once complete
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -45,7 +45,7 @@ public class BlockPlasmaGenerator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TilePlasmaGenerator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockSemiFluidGenerator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileSemiFluidGenerator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -48,7 +48,7 @@ public class BlockSolarPanel extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileSolarPanel();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockSolidFuelGenerator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileSolidFuelGenerator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockThermalGenerator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileThermalGenerator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -44,7 +44,7 @@ public class BlockWaterMill extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileWaterMill();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.generator;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -44,7 +44,7 @@ public class BlockWindMill extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileWindMill();
}

View file

@ -27,23 +27,23 @@ package techreborn.blocks.lighting;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.BlockRenderLayer;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
import reborncore.client.models.ModelCompound;
@ -56,7 +56,7 @@ import techreborn.tiles.lighting.TileLamp;
public class BlockLamp extends BaseTileBlock {
public static DirectionProperty FACING = BlockStateProperties.FACING;
public static DirectionProperty FACING = Properties.FACING;
public static BooleanProperty ACTIVE;
protected final VoxelShape[] shape;
@ -64,8 +64,8 @@ public class BlockLamp extends BaseTileBlock {
private int brightness;
public BlockLamp(int brightness, int cost, double depth, double width) {
super(Block.Properties.create(Material.REDSTONE_LIGHT));
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, EnumFacing.NORTH).with(ACTIVE, false));
super(Block.Settings.of(Material.REDSTONE_LAMP));
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH).with(ACTIVE, false));
this.shape = GenCuboidShapes(depth, width);
this.cost = cost;
this.brightness = brightness;
@ -76,31 +76,31 @@ public class BlockLamp extends BaseTileBlock {
private VoxelShape[] GenCuboidShapes(double depth, double width) {
double culling = (16.0D - width) / 2 ;
VoxelShape[] shapes = {
Block.makeCuboidShape(culling, 16.0 - depth, culling, 16.0 - culling, 16.0D, 16.0 - culling),
Block.makeCuboidShape(culling, 0.0D, culling, 16.0D - culling, depth, 16.0 - culling),
Block.makeCuboidShape(culling, culling, 16.0 - depth, 16.0 - culling, 16.0 - culling, 16.0D),
Block.makeCuboidShape(culling, culling, 0.0D, 16.0 - culling, 16.0 - culling, depth),
Block.makeCuboidShape(16.0 - depth, culling, culling, 16.0D, 16.0 - culling, 16.0 - culling),
Block.makeCuboidShape(0.0D, culling, culling, depth, 16.0 - culling, 16.0 - culling)
Block.createCuboidShape(culling, 16.0 - depth, culling, 16.0 - culling, 16.0D, 16.0 - culling),
Block.createCuboidShape(culling, 0.0D, culling, 16.0D - culling, depth, 16.0 - culling),
Block.createCuboidShape(culling, culling, 16.0 - depth, 16.0 - culling, 16.0 - culling, 16.0D),
Block.createCuboidShape(culling, culling, 0.0D, 16.0 - culling, 16.0 - culling, depth),
Block.createCuboidShape(16.0 - depth, culling, culling, 16.0D, 16.0 - culling, 16.0 - culling),
Block.createCuboidShape(0.0D, culling, culling, depth, 16.0 - culling, 16.0 - culling)
};
return shapes;
}
public static boolean isActive(IBlockState state) {
public static boolean isActive(BlockState state) {
return state.get(ACTIVE);
}
public static EnumFacing getFacing(IBlockState state) {
public static Direction getFacing(BlockState state) {
return state.get(FACING);
}
public static void setFacing(EnumFacing facing, World world, BlockPos pos) {
public static void setFacing(Direction facing, World world, BlockPos pos) {
world.setBlockState(pos, world.getBlockState(pos).with(FACING, facing));
}
public static void setActive(Boolean active, World world, BlockPos pos) {
EnumFacing facing = (EnumFacing)world.getBlockState(pos).get(FACING);
IBlockState state = world.getBlockState(pos).with(ACTIVE, active).with(FACING, facing);
Direction facing = (Direction)world.getBlockState(pos).get(FACING);
BlockState state = world.getBlockState(pos).with(ACTIVE, active).with(FACING, facing);
world.setBlockState(pos, state, 3);
}
@ -110,23 +110,23 @@ public class BlockLamp extends BaseTileBlock {
// BaseTileBlock
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileLamp();
}
// Block
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
ACTIVE = BooleanProperty.create("active");
builder.add(FACING, ACTIVE);
}
@Nullable
@Override
public IBlockState getStateForPlacement(BlockItemUseContext context) {
for (EnumFacing enumfacing : context.getNearestLookingDirections()) {
IBlockState iblockstate = this.getDefaultState().with(FACING, enumfacing.getOpposite());
if (iblockstate.isValidPosition(context.getWorld(), context.getPos())) {
public BlockState getPlacementState(ItemPlacementContext context) {
for (Direction enumfacing : context.getPlacementFacings()) {
BlockState iblockstate = this.getDefaultState().with(FACING, enumfacing.getOpposite());
if (iblockstate.canPlaceAt(context.getWorld(), context.getBlockPos())) {
return iblockstate;
}
}
@ -134,7 +134,7 @@ public class BlockLamp extends BaseTileBlock {
}
@Override
public int getLightValue(IBlockState state) {
public int getLuminance(BlockState state) {
return state.get(ACTIVE) ? brightness : 0;
}
@ -144,12 +144,12 @@ public class BlockLamp extends BaseTileBlock {
}
@Override
public boolean isFullCube(IBlockState state) {
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockReader worldIn, IBlockState state, BlockPos pos, EnumFacing facing) {
public BlockFaceShape getBlockFaceShape(BlockView worldIn, BlockState state, BlockPos pos, Direction facing) {
// This makes only the back face of lamps connect to fences.
if (getFacing(state).getOpposite() == facing)
return BlockFaceShape.SOLID;
@ -158,15 +158,15 @@ public class BlockLamp extends BaseTileBlock {
}
@Override
public VoxelShape getShape(IBlockState state, IBlockReader worldIn, BlockPos pos) {
return shape[getFacing(state).getIndex()];
public VoxelShape getShape(BlockState state, BlockView worldIn, BlockPos pos) {
return shape[getFacing(state).getId()];
}
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
// We extended BaseTileBlock. Thus we should always have tile entity. I hope.
if (tileEntity == null) {

View file

@ -24,12 +24,12 @@
package techreborn.blocks.storage;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.client.EGui;
@ -43,12 +43,12 @@ public class BlockAdjustableSU extends BlockEnergyStorage {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileAdjustableSU();
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired) {
drops.add(new ItemStack(TRContent.MachineBlocks.INDUSTRIAL.getFrame()));
} else {

View file

@ -25,18 +25,18 @@
package techreborn.blocks.storage;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
import reborncore.api.tile.IMachineGuiHandler;
@ -51,24 +51,24 @@ import techreborn.TechReborn;
* Created by Rushmead
*/
public abstract class BlockEnergyStorage extends BaseTileBlock {
public static DirectionProperty FACING = BlockStateProperties.FACING;
public static DirectionProperty FACING = Properties.FACING;
public String name;
public IMachineGuiHandler gui;
public BlockEnergyStorage(String name, IMachineGuiHandler gui) {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(2f));
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, EnumFacing.NORTH));
super(Block.Settings.of(Material.METAL).strength(2f));
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH));
this.name = name;
this.gui = gui;
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/energy"));
BlockWrenchEventHandler.wrenableBlocks.add(this);
}
public void setFacing(EnumFacing facing, World world, BlockPos pos) {
public void setFacing(Direction facing, World world, BlockPos pos) {
world.setBlockState(pos, world.getBlockState(pos).with(FACING, facing));
}
public EnumFacing getFacing(IBlockState state) {
public Direction getFacing(BlockState state) {
return state.get(FACING);
}
@ -96,15 +96,15 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
// Block
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
// We extended BlockTileBase. Thus we should always have tile entity. I hope.
if (tileEntity == null) {
@ -126,14 +126,14 @@ public abstract class BlockEnergyStorage extends BaseTileBlock {
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
public void onPlaced(World worldIn, BlockPos pos, BlockState state, LivingEntity placer,
ItemStack stack) {
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
EnumFacing facing = placer.getHorizontalFacing().getOpposite();
if (placer.rotationPitch < -50) {
facing = EnumFacing.DOWN;
} else if (placer.rotationPitch > 50) {
facing = EnumFacing.UP;
super.onPlaced(worldIn, pos, state, placer, stack);
Direction facing = placer.getHorizontalFacing().getOpposite();
if (placer.pitch < -50) {
facing = Direction.DOWN;
} else if (placer.pitch > 50) {
facing = Direction.UP;
}
setFacing(facing, worldIn, pos);
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.storage;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.client.EGui;
@ -46,12 +46,12 @@ public class BlockHighVoltageSU extends BlockEnergyStorage {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileHighVoltageSU();
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired) {
drops.add(new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
} else {

View file

@ -24,14 +24,14 @@
package techreborn.blocks.storage;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.client.EGui;
@ -45,30 +45,30 @@ public class BlockInterdimensionalSU extends BlockEnergyStorage {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileInterdimensionalSU();
}
@Override
public IBlockState getStateForPlacement(BlockItemUseContext context) {
final TileEntity tile = context.getWorld().getTileEntity(context.getPos());
public BlockState getPlacementState(ItemPlacementContext context) {
final BlockEntity tile = context.getWorld().getBlockEntity(context.getBlockPos());
if (tile instanceof TileInterdimensionalSU) {
((TileInterdimensionalSU) tile).ownerUdid = context.getPlayer().getUniqueID().toString();
((TileInterdimensionalSU) tile).ownerUdid = context.getPlayer().getUuid().toString();
}
return this.getDefaultState();
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
super.onBlockPlacedBy(world, pos, state, placer, stack);
TileEntity tile = world.getTileEntity(pos);
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) {
super.onPlaced(world, pos, state, placer, stack);
BlockEntity tile = world.getBlockEntity(pos);
if (tile instanceof TileInterdimensionalSU) {
((TileInterdimensionalSU) tile).ownerUdid = placer.getUniqueID().toString();
((TileInterdimensionalSU) tile).ownerUdid = placer.getUuid().toString();
}
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired) {
drops.add(new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
} else {

View file

@ -25,17 +25,17 @@
package techreborn.blocks.storage;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
import reborncore.client.models.ModelCompound;
@ -54,36 +54,36 @@ import techreborn.tiles.storage.lesu.TileLSUStorage;
public class BlockLSUStorage extends BaseTileBlock {
public BlockLSUStorage() {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(2f));
super(Block.Settings.of(Material.METAL).strength(2f));
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/energy"));
BlockWrenchEventHandler.wrenableBlocks.add(this);
}
// BaseTileBlock
@Override
public void onReplaced(IBlockState state, World worldIn, BlockPos pos, IBlockState newState, boolean isMoving) {
public void onBlockRemoved(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (state.getBlock() == newState.getBlock()) {
return;
}
if (worldIn.getTileEntity(pos) instanceof TileLSUStorage) {
TileLSUStorage tile = (TileLSUStorage) worldIn.getTileEntity(pos);
if (worldIn.getBlockEntity(pos) instanceof TileLSUStorage) {
TileLSUStorage tile = (TileLSUStorage) worldIn.getBlockEntity(pos);
if (tile != null) {
tile.removeFromNetwork();
}
}
super.onReplaced(state, worldIn, pos, newState, isMoving);
super.onBlockRemoved(state, worldIn, pos, newState, isMoving);
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileLSUStorage();
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack itemstack) {
super.onBlockPlacedBy(world, pos, state, player, itemstack);
if (world.getTileEntity(pos) instanceof TileLSUStorage) {
TileLSUStorage tile = (TileLSUStorage) world.getTileEntity(pos);
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity player, ItemStack itemstack) {
super.onPlaced(world, pos, state, player, itemstack);
if (world.getBlockEntity(pos) instanceof TileLSUStorage) {
TileLSUStorage tile = (TileLSUStorage) world.getBlockEntity(pos);
if (tile != null) {
tile.rebuildNetwork();
}
@ -93,9 +93,9 @@ public class BlockLSUStorage extends BaseTileBlock {
// Block
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
// We extended BaseTileBlock. Thus we should always have tile entity. I hope.
if (tileEntity == null) {
@ -112,7 +112,7 @@ public class BlockLSUStorage extends BaseTileBlock {
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired) {
drops.add(new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
} else {

View file

@ -24,12 +24,12 @@
package techreborn.blocks.storage;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.client.EGui;
@ -43,12 +43,12 @@ public class BlockLapotronicSU extends BlockEnergyStorage {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileLapotronicSU();
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired) {
drops.add(new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
} else {

View file

@ -24,8 +24,8 @@
package techreborn.blocks.storage;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import techreborn.client.EGui;
import techreborn.tiles.storage.TileLowVoltageSU;
@ -39,7 +39,7 @@ public class BlockLowVoltageSU extends BlockEnergyStorage {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileLowVoltageSU();
}
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.storage;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.client.EGui;
@ -46,12 +46,12 @@ public class BlockMediumVoltageSU extends BlockEnergyStorage {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileMediumVoltageSU();
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired) {
drops.add(new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
} else {

View file

@ -24,12 +24,12 @@
package techreborn.blocks.tier0;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
@ -47,7 +47,7 @@ public class BlockIronAlloyFurnace extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIronAlloyFurnace();
}
@ -57,7 +57,7 @@ public class BlockIronAlloyFurnace extends BlockMachineBase {
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
drops.add(new ItemStack(this));
}
}

View file

@ -24,19 +24,19 @@
package techreborn.blocks.tier0;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Particles;
import net.minecraft.init.SoundEvents;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.SoundCategory;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -55,8 +55,8 @@ public class BlockIronFurnace extends BlockMachineBase {
}
@SuppressWarnings("incomplete-switch")
@OnlyIn(Dist.CLIENT)
public void animateTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) {
@Environment(EnvType.CLIENT)
public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) {
if (this.isActive(stateIn)) {
final double d0 = pos.getX() + 0.5D;
@ -67,33 +67,33 @@ public class BlockIronFurnace extends BlockMachineBase {
false);
}
final EnumFacing enumfacing = stateIn.get(BlockMachineBase.FACING);
final Direction enumfacing = stateIn.get(BlockMachineBase.FACING);
final double d3 = 0.52D;
final double d4 = rand.nextDouble() * 0.6D - 0.3D;
switch (enumfacing) {
case WEST:
worldIn.addParticle(Particles.SMOKE, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(Particles.FLAME, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.SMOKE, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.FLAME, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
break;
case EAST:
worldIn.addParticle(Particles.SMOKE, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(Particles.FLAME, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.SMOKE, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.FLAME, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D);
break;
case NORTH:
worldIn.addParticle(Particles.SMOKE, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(Particles.FLAME, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.SMOKE, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.FLAME, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D);
break;
case SOUTH:
worldIn.addParticle(Particles.SMOKE, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(Particles.FLAME, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.SMOKE, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D);
worldIn.addParticle(ParticleTypes.FLAME, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D);
}
}
}
// BlockMachineBase
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIronFurnace();
}
@ -103,7 +103,7 @@ public class BlockIronFurnace extends BlockMachineBase {
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
drops.add(new ItemStack(this));
}
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockAlloySmelter extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileAlloySmelter();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockAssemblingMachine extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileAssemblingMachine();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockAutoCraftingTable extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileAutoCraftingTable();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockCompressor extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileCompressor();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockElectricFurnace extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileElectricFurnace();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockExtractor extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileExtractor();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockGrinder extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileGrinder();
}

View file

@ -25,22 +25,22 @@
package techreborn.blocks.tier1;
import com.google.common.collect.Lists;
import net.minecraft.ChatFormat;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.state.StateFactory;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.IToolDrop;
import reborncore.api.ToolManager;
@ -66,8 +66,8 @@ public class BlockPlayerDetector extends BlockMachineBase {
public static PropertyString TYPE;
public BlockPlayerDetector() {
super(Block.Properties.create(Material.IRON), true);
this.setDefaultState(this.stateContainer.getBaseState().with(TYPE, types[0]));
super(Block.Settings.of(Material.METAL), true);
this.setDefaultState(this.stateFactory.getDefaultState().with(TYPE, types[0]));
for (int i = 0; i < types.length; i++) {
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, i, "machines/tier1_machines").setInvVariant("type=" + types[i]));
}
@ -75,24 +75,24 @@ public class BlockPlayerDetector extends BlockMachineBase {
// BlockMachineBase
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TilePlayerDectector();
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
public void onPlaced(World worldIn, BlockPos pos, BlockState state, LivingEntity placer,
ItemStack stack) {
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
TileEntity tile = worldIn.getTileEntity(pos);
super.onPlaced(worldIn, pos, state, placer, stack);
BlockEntity tile = worldIn.getBlockEntity(pos);
if (tile instanceof TilePlayerDectector) {
((TilePlayerDectector) tile).owenerUdid = placer.getUniqueID().toString();
((TilePlayerDectector) tile).owenerUdid = placer.getUuid().toString();
}
}
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
if (tileEntity == null) {
return super.onBlockActivated(state, worldIn, pos, playerIn, hand, side, hitX, hitY, hitZ);
@ -100,7 +100,7 @@ public class BlockPlayerDetector extends BlockMachineBase {
String type = state.get(TYPE);
String newType = type;
TextFormatting color = TextFormatting.GREEN;
ChatFormat color = ChatFormat.GREEN;
if (!stack.isEmpty() && ToolManager.INSTANCE.canHandleTool(stack)) {
if (ToolManager.INSTANCE.handleTool(stack, pos, worldIn, playerIn, side, false)) {
@ -111,9 +111,9 @@ public class BlockPlayerDetector extends BlockMachineBase {
return false;
}
if (!drop.isEmpty()) {
spawnAsEntity(worldIn, pos, drop);
dropStack(worldIn, pos, drop);
}
if (!worldIn.isRemote) {
if (!worldIn.isClient) {
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
}
return true;
@ -121,10 +121,10 @@ public class BlockPlayerDetector extends BlockMachineBase {
} else {
if (type.equals("all")) {
newType = "others";
color = TextFormatting.RED;
color = ChatFormat.RED;
} else if (type.equals("others")) {
newType = "you";
color = TextFormatting.BLUE;
color = ChatFormat.BLUE;
} else if (type.equals("you")) {
newType = "all";
}
@ -133,9 +133,9 @@ public class BlockPlayerDetector extends BlockMachineBase {
}
}
if (worldIn.isRemote) {
ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, new TextComponentString(
TextFormatting.GRAY + I18n.format("techreborn.message.detects") + " " + color
if (worldIn.isClient) {
ChatUtils.sendNoSpamMessages(MessageIDs.playerDetectorID, new TextComponent(
ChatFormat.GRAY + I18n.translate("techreborn.message.detects") + " " + color
+ StringUtils.toFirstCapital(newType)));
}
return true;
@ -148,24 +148,24 @@ public class BlockPlayerDetector extends BlockMachineBase {
// Block
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
TYPE = new PropertyString("type", types);
builder.add(TYPE);
}
@Override
public boolean canConnectRedstone(IBlockState state, IBlockReader world, BlockPos pos, @Nullable EnumFacing side) {
public boolean canConnectRedstone(BlockState state, BlockView world, BlockPos pos, @Nullable Direction side) {
return true;
}
@Override
public boolean canProvidePower(IBlockState state) {
public boolean emitsRedstonePower(BlockState state) {
return true;
}
@Override
public int getWeakPower(IBlockState blockState, IBlockReader blockAccess, BlockPos pos, EnumFacing side) {
TileEntity entity = blockAccess.getTileEntity(pos);
public int getWeakRedstonePower(BlockState blockState, BlockView blockAccess, BlockPos pos, Direction side) {
BlockEntity entity = blockAccess.getBlockEntity(pos);
if (entity instanceof TilePlayerDectector) {
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
}
@ -173,8 +173,8 @@ public class BlockPlayerDetector extends BlockMachineBase {
}
@Override
public int getStrongPower(IBlockState blockState, IBlockReader blockAccess, BlockPos pos, EnumFacing side) {
TileEntity entity = blockAccess.getTileEntity(pos);
public int getStrongRedstonePower(BlockState blockState, BlockView blockAccess, BlockPos pos, Direction side) {
BlockEntity entity = blockAccess.getBlockEntity(pos);
if (entity instanceof TilePlayerDectector) {
return ((TilePlayerDectector) entity).isProvidingPower() ? 15 : 0;
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockRecycler extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileRecycler();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockRollingMachine extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileRollingMachine();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier1;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockScrapboxinator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileScrapboxinator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockChargeOMat extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileChargeOMat();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockChemicalReactor extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileChemicalReactor();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockDigitalChest extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileDigitalChest();
}

View file

@ -24,31 +24,31 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
import reborncore.common.blocks.BlockMachineBase;
import techreborn.TechReborn;
import techreborn.client.EGui;
import techreborn.tiles.machine.multiblock.TileDistillationTower;
import techreborn.tiles.machine.multiblock.TileEnvTypeillationTower;
public class BlockDistillationTower extends BlockMachineBase {
public class BlockEnvTypeillationTower extends BlockMachineBase {
public BlockDistillationTower() {
public BlockEnvTypeillationTower() {
super();
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/tier2_machines"));
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
return new TileDistillationTower();
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileEnvTypeillationTower();
}
@Override
public IMachineGuiHandler getGui() {
return EGui.DISTILLATION_TOWER;
return EGui.EnvTypeILLATION_TOWER;
}
@Override

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockImplosionCompressor extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileImplosionCompressor();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockIndustrialBlastFurnace extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIndustrialBlastFurnace();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockIndustrialCentrifuge extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIndustrialCentrifuge();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockIndustrialElectrolyzer extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIndustrialElectrolyzer();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockIndustrialGrinder extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIndustrialGrinder();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockIndustrialSawmill extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileIndustrialSawmill();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier2;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockVacuumFreezer extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileVacuumFreezer();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockChunkLoader extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileChunkLoader();
}

View file

@ -24,10 +24,10 @@
package techreborn.blocks.tier3;
import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
@ -45,7 +45,7 @@ public class BlockCreativeQuantumChest extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileCreativeQuantumChest();
}
@ -60,10 +60,10 @@ public class BlockCreativeQuantumChest extends BlockMachineBase {
}
@Override
public void onReplaced(IBlockState state, World worldIn, BlockPos pos, IBlockState newState, boolean isMoving) {
public void onBlockRemoved(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (state.getBlock() != newState.getBlock()) {
//lets not drop max int items into the world, that sounds like a bad idea
worldIn.removeTileEntity(pos);
worldIn.removeBlockEntity(pos);
}
}
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockCreativeQuantumTank extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileCreativeQuantumTank();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockFluidReplicator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileFluidReplicator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockMatterFabricator extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileMatterFabricator();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockQuantumChest extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileQuantumChest();
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.tier3;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry;
@ -42,7 +42,7 @@ public class BlockQuantumTank extends BlockMachineBase {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileQuantumTank();
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.transformers;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.init.TRContent;
@ -45,12 +45,12 @@ public class BlockHVTransformer extends BlockTransformer {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileHVTransformer();
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired){
drops.add(new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()));
}

View file

@ -24,8 +24,8 @@
package techreborn.blocks.transformers;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockReader;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.world.BlockView;
import techreborn.tiles.transformers.TileLVTransformer;
/**
@ -38,7 +38,7 @@ public class BlockLVTransformer extends BlockTransformer {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileLVTransformer();
}
}

View file

@ -24,12 +24,12 @@
package techreborn.blocks.transformers;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.RebornCoreConfig;
import techreborn.init.TRContent;
@ -45,12 +45,12 @@ public class BlockMVTransformer extends BlockTransformer {
}
@Override
public TileEntity createNewTileEntity(IBlockReader worldIn) {
public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileMVTransformer();
}
@Override
public void getDrops(IBlockState state, NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
public void getDrops(BlockState state, DefaultedList<ItemStack> drops, World world, BlockPos pos, int fortune) {
if (RebornCoreConfig.wrenchRequired){
drops.add(new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()));
}

View file

@ -25,18 +25,18 @@
package techreborn.blocks.transformers;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import reborncore.api.ToolManager;
import reborncore.client.models.ModelCompound;
@ -51,50 +51,50 @@ import techreborn.TechReborn;
*/
public abstract class BlockTransformer extends BaseTileBlock {
public static DirectionProperty FACING = BlockStateProperties.FACING;
public static DirectionProperty FACING = Properties.FACING;
public String name;
public BlockTransformer(String name) {
super(Block.Properties.create(Material.IRON).hardnessAndResistance(2f));
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, EnumFacing.NORTH));
super(Block.Settings.of(Material.METAL).strength(2f));
this.setDefaultState(this.stateFactory.getDefaultState().with(FACING, Direction.NORTH));
this.name = name;
RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/energy"));
BlockWrenchEventHandler.wrenableBlocks.add(this);
}
public void setFacing(EnumFacing facing, World world, BlockPos pos) {
public void setFacing(Direction facing, World world, BlockPos pos) {
world.setBlockState(pos, world.getBlockState(pos).with(FACING, facing));
}
public EnumFacing getFacing(IBlockState state) {
public Direction getFacing(BlockState state) {
return state.get(FACING);
}
// BaseTileBlock
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer,
public void onPlaced(World worldIn, BlockPos pos, BlockState state, LivingEntity placer,
ItemStack stack) {
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
EnumFacing facing = placer.getHorizontalFacing().getOpposite();
if (placer.rotationPitch < -50) {
facing = EnumFacing.DOWN;
} else if (placer.rotationPitch > 50) {
facing = EnumFacing.UP;
super.onPlaced(worldIn, pos, state, placer, stack);
Direction facing = placer.getHorizontalFacing().getOpposite();
if (placer.pitch < -50) {
facing = Direction.DOWN;
} else if (placer.pitch > 50) {
facing = Direction.UP;
}
setFacing(facing, worldIn, pos);
}
// Block
@Override
protected void fillStateContainer(StateContainer.Builder<Block, IBlockState> builder) {
protected void appendProperties(StateFactory.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
@SuppressWarnings("deprecation")
@Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(EnumHand.MAIN_HAND);
TileEntity tileEntity = worldIn.getTileEntity(pos);
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Direction side, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getStackInHand(Hand.MAIN_HAND);
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
// We extended BlockTileBase. Thus we should always have tile entity. I hope.
if (tileEntity == null) {

View file

@ -24,20 +24,20 @@
package techreborn.client;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import techreborn.init.TRContent;
public class ClientEventHandler {
@SubscribeEvent
public static void renderPlayer(RenderPlayerEvent.Pre event) {
EntityPlayer player = event.getEntityPlayer();
Item chestslot = !player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).isEmpty()
? player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() : null;
PlayerEntity player = event.getEntityPlayer();
Item chestslot = !player.getEquippedStack(EquipmentSlot.CHEST).isEmpty()
? player.getEquippedStack(EquipmentSlot.CHEST).getItem() : null;
if (chestslot != null && chestslot == TRContent.CLOAKING_DEVICE) {
event.setCanceled(true);
}

View file

@ -24,24 +24,23 @@
package techreborn.client;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.ContainerScreen;
import net.minecraft.container.Container;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.IInteractionObject;
import net.minecraft.world.World;
import net.minecraftforge.fml.ExtensionPoint;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.network.FMLPlayMessages;
import net.minecraftforge.fml.network.NetworkHooks;
import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.containerBuilder.IContainerProvider;
import techreborn.client.container.ContainerDestructoPack;
@ -89,7 +88,7 @@ public enum EGui implements IMachineGuiHandler {
DESTRUCTOPACK(false),
DIESEL_GENERATOR(true),
DIGITAL_CHEST(true),
DISTILLATION_TOWER(true),
EnvTypeILLATION_TOWER(true),
ELECTRIC_FURNACE(true),
EXTRACTOR(true),
FUSION_CONTROLLER(true),
@ -129,11 +128,11 @@ public enum EGui implements IMachineGuiHandler {
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.GUIFACTORY, ()-> EGui::getClientGuiElement);
}
public static GuiContainer getClientGuiElement(FMLPlayMessages.OpenContainer msg) {
public static ContainerScreen getClientGuiElement(FMLPlayMessages.OpenContainer msg) {
EGui gui = byID(msg.getId());
EntityPlayer player = Minecraft.getInstance().player;
PlayerEntity player = MinecraftClient.getInstance().player;
BlockPos pos = msg.getAdditionalData().readBlockPos();
TileEntity tile = player.world.getTileEntity(pos);
BlockEntity tile = player.world.getBlockEntity(pos);
switch (gui) {
case AESU:
@ -216,8 +215,8 @@ public enum EGui implements IMachineGuiHandler {
return new GuiAutoCrafting(player, (TileAutoCraftingTable) tile);
case PLASMA_GENERATOR:
return new GuiPlasmaGenerator(player, (TilePlasmaGenerator) tile);
case DISTILLATION_TOWER:
return new GuiDistillationTower(player, (TileDistillationTower) tile);
case EnvTypeILLATION_TOWER:
return new GuiEnvTypeillationTower(player, (TileEnvTypeillationTower) tile);
case FLUID_REPLICATOR:
return new GuiFluidReplicator(player, (TileFluidReplicator) tile);
default:
@ -226,7 +225,7 @@ public enum EGui implements IMachineGuiHandler {
}
}
public static EGui byID(ResourceLocation resourceLocation){
public static EGui byID(Identifier resourceLocation){
return Arrays.stream(values())
.filter(eGui -> eGui.name().toLowerCase().equals(resourceLocation.getPath()))
.findFirst()
@ -234,13 +233,13 @@ public enum EGui implements IMachineGuiHandler {
}
@Override
public void open(EntityPlayer player, BlockPos pos, World world) {
if(!world.isRemote){
public void open(PlayerEntity player, BlockPos pos, World world) {
if(!world.isClient){
EGui gui = this;
NetworkHooks.openGui((EntityPlayerMP) player, new IInteractionObject() {
NetworkHooks.openGui((ServerPlayerEntity) player, new IInteractionObject() {
@Override
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) {
TileEntity tileEntity = playerIn.world.getTileEntity(pos);
public Container createContainer(PlayerInventory playerInventory, PlayerEntity playerIn) {
BlockEntity tileEntity = playerIn.world.getBlockEntity(pos);
if (tileEntity instanceof IContainerProvider) {
return ((IContainerProvider) tileEntity).createContainer(player);
}
@ -253,8 +252,8 @@ public enum EGui implements IMachineGuiHandler {
}
@Override
public ITextComponent getName() {
return new TextComponentString(getGuiID());
public Component getName() {
return new TextComponent(getGuiID());
}
@Override
@ -264,7 +263,7 @@ public enum EGui implements IMachineGuiHandler {
@Nullable
@Override
public ITextComponent getCustomName() {
public Component getCustomName() {
return null;
}
}, packetBuffer -> packetBuffer.writeBlockPos(pos));

View file

@ -24,11 +24,11 @@
package techreborn.client;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import reborncore.client.containerBuilder.IContainerProvider;
import techreborn.client.container.ContainerDestructoPack;
import techreborn.client.gui.*;
@ -58,11 +58,11 @@ import techreborn.tiles.storage.lesu.TileLapotronicSU;
public class GuiHandler implements IGuiHandler {
@Override
public Object getServerGuiElement(final int ID, final EntityPlayer player, final World world, final int x,
public Object getServerGuiElement(final int ID, final PlayerEntity player, final World world, final int x,
final int y, final int z) {
final EGui gui = EGui.values()[ID];
final TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
final BlockEntity tile = world.getBlockEntity(new BlockPos(x, y, z));
if (gui.useContainerBuilder() && tile != null)
return ((IContainerProvider) tile).createContainer(player);
@ -77,10 +77,10 @@ public class GuiHandler implements IGuiHandler {
}
@Override
public Object getClientGuiElement(final int ID, final EntityPlayer player, final World world, final int x,
public Object getClientGuiElement(final int ID, final PlayerEntity player, final World world, final int x,
final int y, final int z) {
final EGui gui = EGui.values()[ID];
final TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
final BlockEntity tile = world.getBlockEntity(new BlockPos(x, y, z));
switch (gui) {
case AESU:
@ -163,8 +163,8 @@ public class GuiHandler implements IGuiHandler {
return new GuiAutoCrafting(player, (TileAutoCraftingTable) tile);
case PLASMA_GENERATOR:
return new GuiPlasmaGenerator(player, (TilePlasmaGenerator) tile);
case DISTILLATION_TOWER:
return new GuiDistillationTower(player, (TileDistillationTower) tile);
case EnvTypeILLATION_TOWER:
return new GuiEnvTypeillationTower(player, (TileEnvTypeillationTower) tile);
case MANUAL:
return new GuiManual(player);
case FLUID_REPLICATOR:

View file

@ -24,8 +24,8 @@
package techreborn.client.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.container.Slot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import reborncore.client.gui.slots.SlotFilteredVoid;
import reborncore.common.container.RebornContainer;
@ -34,10 +34,10 @@ import techreborn.init.TRContent;
public class ContainerDestructoPack extends RebornContainer {
private EntityPlayer player;
private PlayerEntity player;
private Inventory<?> inv;
public ContainerDestructoPack(EntityPlayer player) {
public ContainerDestructoPack(PlayerEntity player) {
super(null);
this.player = player;
inv = new Inventory<>(1, "destructopack", 64, null);
@ -45,7 +45,7 @@ public class ContainerDestructoPack extends RebornContainer {
}
@Override
public boolean canInteractWith(EntityPlayer arg0) {
public boolean canUse(PlayerEntity arg0) {
return true;
}

View file

@ -24,10 +24,10 @@
package techreborn.client.container.builder.slot;
import net.minecraft.init.Items;
import net.minecraft.block.entity.FurnaceBlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraftforge.items.IItemHandler;
import net.minecraft.item.Items;
import reborncore.client.gui.slots.BaseSlot;
public class FurnaceFuelSlot extends BaseSlot {
@ -37,15 +37,15 @@ public class FurnaceFuelSlot extends BaseSlot {
}
@Override
public boolean isItemValid(ItemStack stack)
public boolean canInsert(ItemStack stack)
{
return TileEntityFurnace.isItemFuel(stack) || isBucket(stack);
return FurnaceBlockEntity.isItemFuel(stack) || isBucket(stack);
}
@Override
public int getItemStackLimit(ItemStack stack)
public int getMaxStackAmount(ItemStack stack)
{
return isBucket(stack) ? 1 : super.getItemStackLimit(stack);
return isBucket(stack) ? 1 : super.getMaxStackAmount(stack);
}
public static boolean isBucket(ItemStack stack)

Some files were not shown because too many files have changed in this diff Show more