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 { repositories {
mavenCentral() mavenCentral()
jcenter() jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven { maven {
name = "sonatype" name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/" url = "https://oss.sonatype.org/content/repositories/snapshots/"
@ -17,16 +13,20 @@ buildscript {
name = "CB Repo" name = "CB Repo"
url = "http://chickenbones.net/maven" url = "http://chickenbones.net/maven"
} }
maven {
name = "Modmuss50"
url = "http://maven.modmuss50.me/"
}
} }
dependencies { 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 "gradle.plugin.net.minecrell:licenser:0.2.1"
classpath 'de.undercouch:gradle-download-task:3.4.3' classpath 'de.undercouch:gradle-download-task:3.4.3'
//classpath 'net.covers1624:GradleStuff:1.0-SNAPSHOT' //classpath 'net.covers1624:GradleStuff:1.0-SNAPSHOT'
} }
} }
apply plugin: 'net.minecraftforge.gradle' apply plugin: net.fabricmc.loom.LoomGradlePlugin
apply plugin: 'maven' apply plugin: 'maven'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: net.minecrell.gradle.licenser.Licenser apply plugin: net.minecrell.gradle.licenser.Licenser
@ -64,40 +64,6 @@ if (ENV.BUILD_NUMBER) {
version = version + "." + "${System.getenv().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 { license {
header file('HEADER') header file('HEADER')
include '**/*.java' include '**/*.java'
@ -107,23 +73,27 @@ license {
group = 'TechReborn' group = 'TechReborn'
dependencies { 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"
modCompile "net.fabricmc:fabric-loader:0.4.8+build.154"
modCompile "net.fabricmc.fabric-api:fabric-api:0.3.0-pre+build.156"
if (findProject(':reborncore') != null) { modCompile ('RebornCore:RebornCore-1.14:4.0.0.14') {
compile project(":reborncore") transitive = false
} else {
compile 'RebornCore:RebornCore-1.13.2:+:dev'
} }
compileOnly "com.google.code.findbugs:jsr305:+"
} }
processResources{ processResources{
inputs.property 'version', project.version inputs.property 'version', project.version
inputs.property 'mcversion', '1.13.2' inputs.property 'mcversion', '1.14'
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
include 'META_INF/mods.toml' 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) { from(sourceSets.main.resources.srcDirs) {
@ -249,6 +219,8 @@ import com.google.gson.JsonArray
import groovy.util.XmlSlurper import groovy.util.XmlSlurper
import org.apache.commons.io.FileUtils import org.apache.commons.io.FileUtils
import java.util.function.Consumer
task curseTools { task curseTools {
doLast { doLast {
def cacheFiles = new File(".gradle/curseTools") 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; package techreborn;
import net.minecraft.block.BlockDispenser; import net.minecraft.block.DispenserBlock;
import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist; import net.fabricmc.api.EnvType;
import net.minecraftforge.api.distmarker.OnlyIn; import net.fabricmc.api.Environment;
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 org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import reborncore.common.multiblock.MultiblockEventHandler; import reborncore.common.multiblock.MultiblockEventHandler;
@ -66,7 +66,7 @@ public class TechReborn {
public static TechReborn INSTANCE; public static TechReborn INSTANCE;
public static final ItemGroup ITEMGROUP = new ItemGroup(-1, MOD_ID) { public static final ItemGroup ITEMGROUP = new ItemGroup(-1, MOD_ID) {
@OnlyIn(Dist.CLIENT) @Environment(EnvType.CLIENT)
public ItemStack createIcon() { public ItemStack createIcon() {
return TRContent.Parts.MACHINE_PARTS.getStack(); return TRContent.Parts.MACHINE_PARTS.getStack();
} }
@ -127,7 +127,7 @@ public class TechReborn {
// Scrapbox // Scrapbox
if (BehaviorDispenseScrapbox.dispenseScrapboxes) { if (BehaviorDispenseScrapbox.dispenseScrapboxes) {
BlockDispenser.registerDispenseBehavior(TRContent.SCRAP_BOX, new BehaviorDispenseScrapbox()); DispenserBlock.registerBehavior(TRContent.SCRAP_BOX, new BehaviorDispenseScrapbox());
} }
Torus.genSizeMap(TileFusionControlComputer.maxCoilSize); Torus.genSizeMap(TileFusionControlComputer.maxCoilSize);

View file

@ -25,14 +25,13 @@
package techreborn.api; package techreborn.api;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext; import net.minecraft.item.ItemUsageContext;
import java.util.List; import java.util.List;
public interface IC2Helper { public interface IC2Helper {
public void initDuplicates(); 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; package techreborn.api;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.recipe.Recipe;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.Identifier;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -35,19 +35,19 @@ public class RollingMachineRecipe {
public static final RollingMachineRecipe instance = new 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"); 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"); 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"); 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"); throw new UnsupportedOperationException("Needs moving to json");
} }

View file

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

View file

@ -24,10 +24,10 @@
package techreborn.api.fluidreplicator; package techreborn.api.fluidreplicator;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack; 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.recipes.RecipeCrafter;
import reborncore.common.util.Inventory; import reborncore.common.util.Inventory;
import reborncore.common.util.Tank; 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 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 * @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); super(ModRecipes.FLUID_REPLICATOR, parentTile, 1, 1, inventory, inputSlots, outputSlots);
} }
@ -63,11 +63,11 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter {
if (recipe == null) { if (recipe == null) {
return false; return false;
} }
ItemStack inputStack = inventory.getStackInSlot(inputSlots[0]); ItemStack inputStack = inventory.getInvStack(inputSlots[0]);
if (!inputStack.isItemEqual(TRContent.Parts.UU_MATTER.getStack())) { if (!inputStack.isEqualIgnoreTags(TRContent.Parts.UU_MATTER.getStack())) {
return false; return false;
} }
if (inputStack.getCount() < recipe.getInput()) { if (inputStack.getAmount() < recipe.getInput()) {
return false; return false;
} }
@ -92,7 +92,7 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter {
// RecipeCrafter // RecipeCrafter
@Override @Override
public void updateEntity() { public void updateEntity() {
if (tile.getWorld().isRemote) { if (tile.getWorld().isClient) {
return; return;
} }
ticksSinceLastChange++; ticksSinceLastChange++;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -25,11 +25,11 @@
package techreborn.blocks; package techreborn.blocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType; import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material; import net.minecraft.block.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.world.IBlockReader; import net.minecraft.world.BlockView;
import reborncore.common.multiblock.BlockMultiblockBase; import reborncore.common.multiblock.BlockMultiblockBase;
import techreborn.tiles.TileMachineCasing; import techreborn.tiles.TileMachineCasing;
@ -38,11 +38,11 @@ public class BlockMachineCasing extends BlockMultiblockBase {
public final int heatCapacity; public final int heatCapacity;
public BlockMachineCasing(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; this.heatCapacity = heatCapacity;
} }
public static int getHeatFromState(IBlockState state) { public static int getHeatFromState(BlockState state) {
Block block = state.getBlock(); Block block = state.getBlock();
if (!(block instanceof BlockMachineCasing)) { if (!(block instanceof BlockMachineCasing)) {
return 0; return 0;
@ -52,7 +52,7 @@ public class BlockMachineCasing extends BlockMultiblockBase {
} }
@Override @Override
public TileEntity createNewTileEntity(IBlockReader worldIn) { public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileMachineCasing(); return new TileMachineCasing();
} }

View file

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

View file

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

View file

@ -25,14 +25,14 @@
package techreborn.blocks; package techreborn.blocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockFence; import net.minecraft.block.FenceBlock;
import net.minecraft.block.SoundType; import net.minecraft.block.Material;
import net.minecraft.block.material.Material; import net.minecraft.block.MaterialColor;
import net.minecraft.block.material.MaterialColor; import net.minecraft.sound.BlockSoundGroup;
public class BlockRefinedIronFence extends BlockFence { public class BlockRefinedIronFence extends FenceBlock {
public BlockRefinedIronFence() { 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; package techreborn.blocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockGlass; import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.GlassBlock;
import net.minecraft.block.material.Material; import net.minecraft.block.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.sound.BlockSoundGroup;
import reborncore.client.models.ModelCompound; import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry; import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn; import techreborn.TechReborn;
import java.util.Random; import java.util.Random;
public class BlockReinforcedGlass extends BlockGlass { public class BlockReinforcedGlass extends GlassBlock {
public BlockReinforcedGlass() { 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)); RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
} }
@Override @Override
public int quantityDropped(IBlockState state, Random random) { public int quantityDropped(BlockState state, Random random) {
return 1; return 1;
} }
} }

View file

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

View file

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

View file

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

View file

@ -25,18 +25,18 @@
package techreborn.blocks; package techreborn.blocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockSlab; import net.minecraft.block.Material;
import net.minecraft.block.SoundType; import net.minecraft.block.MaterialColor;
import net.minecraft.block.material.Material; import net.minecraft.block.SlabBlock;
import net.minecraft.block.material.MaterialColor; import net.minecraft.sound.BlockSoundGroup;
import reborncore.client.models.ModelCompound; import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry; import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn; import techreborn.TechReborn;
public class BlockRubberPlankSlab extends BlockSlab { public class BlockRubberPlankSlab extends SlabBlock {
public BlockRubberPlankSlab() { 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)); RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
} }
} }

View file

@ -25,16 +25,16 @@
package techreborn.blocks; package techreborn.blocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs; import net.minecraft.block.StairsBlock;
import reborncore.client.models.ModelCompound; import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry; import reborncore.client.models.RebornModelRegistry;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.TRContent; import techreborn.init.TRContent;
public class BlockRubberPlankStair extends BlockStairs { public class BlockRubberPlankStair extends StairsBlock {
public BlockRubberPlankStair() { 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)); RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this));
} }
} }

View file

@ -25,16 +25,16 @@
package techreborn.blocks; package techreborn.blocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockSapling; import net.minecraft.block.Material;
import net.minecraft.block.SoundType; import net.minecraft.block.SaplingBlock;
import net.minecraft.block.material.Material; import net.minecraft.sound.BlockSoundGroup;
/** /**
* Created by modmuss50 on 20/02/2016. * Created by modmuss50 on 20/02/2016.
*/ */
public class BlockRubberSapling extends BlockSapling { public class BlockRubberSapling extends SaplingBlock {
public BlockRubberSapling() { 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; package techreborn.blocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType; import net.minecraft.block.Material;
import net.minecraft.block.material.Material; import net.minecraft.sound.BlockSoundGroup;
import reborncore.common.BaseBlock; import reborncore.common.BaseBlock;
public class BlockStorage extends BaseBlock { public class BlockStorage extends BaseBlock {
public BlockStorage() { 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) { // public static ItemStack getStorageBlockByName(String name, int count) {

View file

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

View file

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

View file

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

View file

@ -24,12 +24,12 @@
package techreborn.blocks.fluid; package techreborn.blocks.fluid;
import net.minecraft.block.BlockFlowingFluid; import net.minecraft.block.FluidBlock;
import net.minecraft.fluid.FlowingFluid; 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); super(fluid, properties);
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -25,23 +25,23 @@
package techreborn.blocks.generator; package techreborn.blocks.generator;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType; import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material; import net.minecraft.block.Blocks;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.Material;
import net.minecraft.client.util.ITooltipFlag; import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing; import net.minecraft.network.chat.Component;
import net.minecraft.util.EnumHand; import net.minecraft.network.chat.TextComponent;
import net.minecraft.util.SoundCategory; 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.math.BlockPos;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.math.Direction;
import net.minecraft.util.text.TextComponentString; import net.minecraft.world.BlockView;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.fabricmc.api.EnvType;
import net.minecraftforge.api.distmarker.OnlyIn; import net.fabricmc.api.Environment;
import reborncore.api.ToolManager; import reborncore.api.ToolManager;
import reborncore.client.models.ModelCompound; import reborncore.client.models.ModelCompound;
import reborncore.client.models.RebornModelRegistry; import reborncore.client.models.RebornModelRegistry;
@ -54,23 +54,23 @@ import java.util.List;
public class BlockFusionCoil extends Block { public class BlockFusionCoil extends Block {
public BlockFusionCoil() { 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")); RebornModelRegistry.registerModel(new ModelCompound(TechReborn.MOD_ID, this, "machines/generators"));
} }
@Override @Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { 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 (!tool.isEmpty() && ToolManager.INSTANCE.canHandleTool(tool)) {
if (ToolManager.INSTANCE.handleTool(tool, pos, worldIn, playerIn, side, false)) { if (ToolManager.INSTANCE.handleTool(tool, pos, worldIn, playerIn, side, false)) {
if (playerIn.isSneaking()) { if (playerIn.isSneaking()) {
ItemStack drop = new ItemStack(this); ItemStack drop = new ItemStack(this);
spawnAsEntity(worldIn, pos, drop); dropStack(worldIn, pos, drop);
worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, ModSounds.BLOCK_DISMANTLE, worldIn.playSound(null, playerIn.x, playerIn.y, playerIn.z, ModSounds.BLOCK_DISMANTLE,
SoundCategory.BLOCKS, 0.6F, 1F); SoundCategory.BLOCKS, 0.6F, 1F);
if (!worldIn.isRemote) { if (!worldIn.isClient) {
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
} }
return true; return true;
@ -80,12 +80,12 @@ public class BlockFusionCoil extends Block {
return false; return false;
} }
@OnlyIn(Dist.CLIENT) @Environment(EnvType.CLIENT)
@Override @Override
public void addInformation(ItemStack stack, @Nullable IBlockReader worldIn, List<ITextComponent> tooltip, public void buildTooltip(ItemStack stack, @Nullable BlockView worldIn, List<Component> tooltip,
ITooltipFlag flagIn) { TooltipContext flagIn) {
super.addInformation(stack, worldIn, tooltip, flagIn); super.buildTooltip(stack, worldIn, tooltip, flagIn);
// TODO: Translate // 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; 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.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Hand;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; 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.minecraft.world.World;
import reborncore.api.tile.IMachineGuiHandler; import reborncore.api.tile.IMachineGuiHandler;
import reborncore.client.models.ModelCompound; import reborncore.client.models.ModelCompound;
@ -54,20 +54,20 @@ public class BlockFusionControlComputer extends BlockMachineBase {
} }
@Override @Override
public boolean onBlockActivated(IBlockState state, World worldIn, BlockPos pos, EntityPlayer playerIn, public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn,
EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { Hand hand, Direction side, float hitX, float hitY, float hitZ) {
final TileFusionControlComputer tileFusionControlComputer = (TileFusionControlComputer) worldIn.getTileEntity(pos); final TileFusionControlComputer tileFusionControlComputer = (TileFusionControlComputer) worldIn.getBlockEntity(pos);
if(!playerIn.getHeldItem(hand).isEmpty() && (playerIn.getHeldItem(hand).getItem() == TRContent.Machine.FUSION_COIL.asItem())){ if(!playerIn.getStackInHand(hand).isEmpty() && (playerIn.getStackInHand(hand).getItem() == TRContent.Machine.FUSION_COIL.asItem())){
List<BlockPos> coils = Torus.generate(tileFusionControlComputer.getPos(), tileFusionControlComputer.size); List<BlockPos> coils = Torus.generate(tileFusionControlComputer.getPos(), tileFusionControlComputer.size);
boolean placed = false; boolean placed = false;
for(BlockPos coil : coils){ for(BlockPos coil : coils){
if(playerIn.getHeldItem(hand).isEmpty()){ if(playerIn.getStackInHand(hand).isEmpty()){
return true; 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()); worldIn.setBlockState(coil, TRContent.Machine.FUSION_COIL.block.getDefaultState());
if(!playerIn.isCreative()){ if(!playerIn.isCreative()){
playerIn.getHeldItem(hand).shrink(1); playerIn.getStackInHand(hand).subtractAmount(1);
} }
placed = true; placed = true;
} }
@ -87,18 +87,18 @@ public class BlockFusionControlComputer extends BlockMachineBase {
} }
@Override @Override
public void onEntityWalk(final World worldIn, final BlockPos pos, final Entity entityIn) { public void onSteppedOn(final World worldIn, final BlockPos pos, final Entity entityIn) {
super.onEntityWalk(worldIn, pos, entityIn); super.onSteppedOn(worldIn, pos, entityIn);
if (worldIn.getTileEntity(pos) instanceof TileFusionControlComputer) { if (worldIn.getBlockEntity(pos) instanceof TileFusionControlComputer) {
if (((TileFusionControlComputer) worldIn.getTileEntity(pos)).crafingTickTime != 0 if (((TileFusionControlComputer) worldIn.getBlockEntity(pos)).crafingTickTime != 0
&& ((TileFusionControlComputer) worldIn.getTileEntity(pos)).checkCoils()) { && ((TileFusionControlComputer) worldIn.getBlockEntity(pos)).checkCoils()) {
entityIn.attackEntityFrom(new FusionDamageSource(), 200F); entityIn.damage(new FusionDamageSource(), 200F);
} }
} }
} }
@Override @Override
public TileEntity createNewTileEntity(IBlockReader worldIn) { public BlockEntity createBlockEntity(BlockView worldIn) {
return new TileFusionControlComputer(); return new TileFusionControlComputer();
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -24,10 +24,10 @@
package techreborn.client.container.builder.slot; 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.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.item.Items;
import net.minecraftforge.items.IItemHandler;
import reborncore.client.gui.slots.BaseSlot; import reborncore.client.gui.slots.BaseSlot;
public class FurnaceFuelSlot extends BaseSlot { public class FurnaceFuelSlot extends BaseSlot {
@ -37,15 +37,15 @@ public class FurnaceFuelSlot extends BaseSlot {
} }
@Override @Override
public boolean isItemValid(ItemStack stack) public boolean canInsert(ItemStack stack)
{ {
return TileEntityFurnace.isItemFuel(stack) || isBucket(stack); return FurnaceBlockEntity.isItemFuel(stack) || isBucket(stack);
} }
@Override @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) public static boolean isBucket(ItemStack stack)

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