mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Bumped mappings, deprecated some base classes (for now), ported remaining
This commit is contained in:
parent
40d27de0f5
commit
aa015521bc
11 changed files with 401 additions and 424 deletions
49
build.gradle
49
build.gradle
|
@ -1,10 +1,8 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
maven { url = 'https://files.minecraftforge.net/maven' }
|
||||
jcenter()
|
||||
maven {
|
||||
name = "forge"
|
||||
url = "http://files.minecraftforge.net/maven"
|
||||
}
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
|
||||
|
@ -16,30 +14,40 @@ apply plugin: 'eclipse'
|
|||
apply plugin: 'idea'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = "2.0.0"
|
||||
version = mod_version
|
||||
group = "de.ellpeck.actuallyadditions"
|
||||
archivesBaseName = "ActuallyAdditions-1.15.2"
|
||||
archivesBaseName = "actuallyadditions-${mc_version}"
|
||||
|
||||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
|
||||
|
||||
minecraft {
|
||||
mappings channel: "stable", version: "60-1.15"
|
||||
mappings channel: "snapshot", version: mcp_version
|
||||
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
runs {
|
||||
client = {
|
||||
client {
|
||||
properties 'forge.logging.markers': ''
|
||||
properties 'forge.logging.console.level': 'debug'
|
||||
workingDirectory project.file('run').canonicalPath
|
||||
source sourceSets.main
|
||||
workingDirectory project.file('run')
|
||||
mods {
|
||||
actuallyadditions {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
server = {
|
||||
server {
|
||||
properties 'forge.logging.markers': ''
|
||||
properties 'forge.logging.console.level': 'debug'
|
||||
workingDirectory project.file('run/server').canonicalPath
|
||||
source sourceSets.main
|
||||
workingDirectory project.file('run')
|
||||
mods {
|
||||
actuallyadditions {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
data = {
|
||||
workingDirectory project.file("run/data").canonicalPath
|
||||
args "--mod", "actuallyadditions", "--all", "--output", "\"" + file("src/generated/resources").toString() + "\"", "--validate", "--existing", "\"" + sourceSets.main.resources.srcDirs[0] + "\""
|
||||
data {
|
||||
workingDirectory project.file('run')
|
||||
args "--mod", "actuallyadditions", "--all", "--output", file('src/generated/resources/'), "--existing", "\"" + sourceSets.main.resources.srcDirs[0] + "\""
|
||||
mods {
|
||||
actuallyadditions {
|
||||
source sourceSets.main
|
||||
|
@ -51,19 +59,18 @@ minecraft {
|
|||
|
||||
repositories {
|
||||
maven {
|
||||
// location of the maven that hosts JEI files
|
||||
name = "Progwml6 maven"
|
||||
name = "Progwml6 maven / JEI Maven"
|
||||
url = "https://dvs1.progwml6.com/files/maven/"
|
||||
}
|
||||
maven {
|
||||
// location of a maven mirror for JEI files, as a fallback
|
||||
name = "ModMaven"
|
||||
name = "ModMaven / JEI Mirror"
|
||||
url = "https://modmaven.k-4u.nl"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
|
||||
|
||||
// compile against the JEI API but do not include it at runtime
|
||||
compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api")
|
||||
// at runtime, use the full JEI jar
|
||||
|
@ -74,7 +81,7 @@ jar {
|
|||
manifest {
|
||||
attributes(["Specification-Title": "actuallyadditions",
|
||||
"Specification-Vendor": "Ellpeck",
|
||||
"Specification-Version": "24.0",
|
||||
"Specification-Version": mod_version,
|
||||
"Implementation-Title": project.name,
|
||||
"Implementation-Version": "${version}",
|
||||
"Implementation-Vendor" :"Ellpeck",
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
||||
mod_version=2.0
|
||||
|
||||
mc_version=1.15.2
|
||||
forge_version=31.2.0
|
||||
mcp_version=20200514-1.15.1
|
||||
forge_version=31.2.36
|
||||
jei_version=6.0.3.15
|
|
@ -1,48 +1,51 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.IRarity;
|
||||
|
||||
public class BlockBase extends Block implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||
|
||||
private final String name;
|
||||
|
||||
public BlockBase(Material material, String name) {
|
||||
super(material);
|
||||
this.name = name;
|
||||
|
||||
this.register();
|
||||
}
|
||||
|
||||
private void register() {
|
||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
}
|
||||
|
||||
protected String getBaseName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
protected ItemBlockBase getItemBlock() {
|
||||
return new ItemBlockBase(this);
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRendering() {
|
||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
}
|
||||
//package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
//
|
||||
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
//import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||
//import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
//import net.minecraft.block.Block;
|
||||
//import net.minecraft.block.material.Material;
|
||||
//import net.minecraft.item.EnumRarity;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.item.Rarity;
|
||||
//import net.minecraftforge.common.IRarity;
|
||||
//
|
||||
//public class BlockBase extends Block implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||
//
|
||||
// private final String name;
|
||||
//
|
||||
// public BlockBase(Material material, String name) {
|
||||
// super(material);
|
||||
// this.name = name;
|
||||
//
|
||||
// this.register();
|
||||
// }
|
||||
//
|
||||
// private void register() {
|
||||
// ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
// }
|
||||
//
|
||||
// protected String getBaseName() {
|
||||
// return this.name;
|
||||
// }
|
||||
//
|
||||
// protected ItemBlockBase getItemBlock() {
|
||||
// return new ItemBlockBase(this);
|
||||
// }
|
||||
//
|
||||
// public boolean shouldAddCreative() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void registerRendering() {
|
||||
// ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public Rarity getRarity(ItemStack stack) {
|
||||
// return EnumRarity.COMMON;
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,47 +1,33 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.BushBlock;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BlockBushBase extends BlockBush implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||
|
||||
private final String name;
|
||||
|
||||
public BlockBushBase(String name) {
|
||||
this.name = name;
|
||||
this.setSoundType(SoundType.PLANT);
|
||||
|
||||
this.register();
|
||||
public class BlockBushBase extends BushBlock {
|
||||
public BlockBushBase(Properties properties) {
|
||||
super(properties.sound(SoundType.PLANT));
|
||||
// this.register();
|
||||
}
|
||||
|
||||
private void register() {
|
||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
}
|
||||
// private void register() {
|
||||
// ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
// }
|
||||
|
||||
protected String getBaseName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
protected ItemBlockBase getItemBlock() {
|
||||
return new ItemBlockBase(this);
|
||||
}
|
||||
// protected ItemBlockBase getItemBlock() {
|
||||
// return new ItemBlockBase(this);
|
||||
// }
|
||||
|
||||
public boolean shouldAddCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRendering() {
|
||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||
}
|
||||
// @Override
|
||||
// public void registerRendering() {
|
||||
// ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||
// }
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
// @Override
|
||||
// public EnumRarity getRarity(ItemStack stack) {
|
||||
// return EnumRarity.COMMON;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -1,79 +1,63 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
|
||||
public abstract class BlockContainerBase extends BlockContainer implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
private final String name;
|
||||
public abstract class BlockContainerBase extends ContainerBlock {
|
||||
|
||||
public BlockContainerBase(Material material, String name) {
|
||||
super(material);
|
||||
this.name = name;
|
||||
public BlockContainerBase(Properties properties) {
|
||||
super(properties);
|
||||
|
||||
this.register();
|
||||
// this.register();
|
||||
}
|
||||
|
||||
private void register() {
|
||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
}
|
||||
// private void register() {
|
||||
// ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
// }
|
||||
|
||||
protected String getBaseName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
protected ItemBlockBase getItemBlock() {
|
||||
return new ItemBlockBase(this);
|
||||
}
|
||||
// protected ItemBlockBase getItemBlock() {
|
||||
// return new ItemBlockBase(this);
|
||||
// }
|
||||
|
||||
public boolean shouldAddCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRendering() {
|
||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
// @Override
|
||||
// public void registerRendering() {
|
||||
// ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public EnumRarity getRarity(ItemStack stack) {
|
||||
// return EnumRarity.COMMON;
|
||||
// }
|
||||
|
||||
private void dropInventory(World world, BlockPos position) {
|
||||
if (!world.isRemote) {
|
||||
|
@ -89,22 +73,27 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
}
|
||||
}
|
||||
|
||||
// todo: replace with native implementation
|
||||
private void dropSlotFromInventory(int i, TileEntityInventoryBase tile, World world, BlockPos pos) {
|
||||
ItemStack stack = tile.inv.getStackInSlot(i);
|
||||
if (StackUtil.isValid(stack)) {
|
||||
float dX = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dY = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
float dZ = world.rand.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityItem = new EntityItem(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, stack.copy());
|
||||
ItemEntity entityItem = new ItemEntity(world, pos.getX() + dX, pos.getY() + dY, pos.getZ() + dZ, stack.copy());
|
||||
float factor = 0.05F;
|
||||
entityItem.motionX = world.rand.nextGaussian() * factor;
|
||||
entityItem.motionY = world.rand.nextGaussian() * factor + 0.2F;
|
||||
entityItem.motionZ = world.rand.nextGaussian() * factor;
|
||||
world.spawnEntity(entityItem);
|
||||
|
||||
entityItem.move(MoverType.SELF, new Vec3d(
|
||||
world.rand.nextGaussian() * factor,
|
||||
world.rand.nextGaussian() * factor + 0.2F,
|
||||
world.rand.nextGaussian() * factor
|
||||
));
|
||||
|
||||
world.addEntity(entityItem);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player) {
|
||||
public boolean tryToggleRedstone(World world, BlockPos pos, PlayerEntity player) {
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (StackUtil.isValid(stack) && stack.getItem() == ConfigValues.itemRedstoneTorchConfigurator) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
@ -122,7 +111,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random random) {
|
||||
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityBase) {
|
||||
|
@ -147,18 +136,18 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos otherPos) {
|
||||
this.neighborsChangedCustom(worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
|
||||
super.onNeighborChange(world, pos, neighbor);
|
||||
public void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor) {
|
||||
super.onNeighborChange(state, world, pos, neighbor);
|
||||
if (world instanceof World) {
|
||||
this.neighborsChangedCustom((World) world, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) {
|
||||
this.neighborsChangedCustom(worldIn, pos);
|
||||
}
|
||||
|
||||
public void updateRedstoneState(World world, BlockPos pos) {
|
||||
if (!world.isRemote) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
@ -168,7 +157,7 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
boolean wasPowered = base.isRedstonePowered;
|
||||
if (powered && !wasPowered) {
|
||||
if (base.respondsToPulses()) {
|
||||
world.scheduleUpdate(pos, this, this.tickRate(world));
|
||||
world.getPendingBlockTicks().scheduleTick(pos, this, this.tickRate(world));
|
||||
}
|
||||
base.setRedstonePowered(true);
|
||||
} else if (!powered && wasPowered) {
|
||||
|
@ -178,117 +167,118 @@ public abstract class BlockContainerBase extends BlockContainer implements ItemB
|
|||
}
|
||||
}
|
||||
|
||||
protected boolean tryUseItemOnTank(EntityPlayer player, EnumHand hand, FluidTank tank) {
|
||||
protected boolean tryUseItemOnTank(PlayerEntity player, Hand hand, FluidTank tank) {
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
return StackUtil.isValid(heldItem) && FluidUtil.interactWithFluidHandler(player, hand, tank);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
|
||||
public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean isMoving) {
|
||||
this.updateRedstoneState(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
|
||||
if (stack.hasTagCompound()) {
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
|
||||
if (stack.hasTag()) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityBase) {
|
||||
TileEntityBase base = (TileEntityBase) tile;
|
||||
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Data");
|
||||
if (compound != null) {
|
||||
base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||
}
|
||||
CompoundNBT compound = stack.getOrCreateTag().getCompound("Data");
|
||||
base.readSyncableNBT(compound, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
public void onBlockHarvested(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
if (!player.isCreative()) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) {
|
||||
player.sendMessage(new TextComponentTranslation("info." + ActuallyAdditions.MODID + ".machineBroke").setStyle(new Style().setColor(TextFormatting.RED)));
|
||||
player.sendMessage(new TranslationTextComponent("info." + ActuallyAdditions.MODID + ".machineBroke").setStyle(new Style().setColor(TextFormatting.RED)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride(IBlockState state) {
|
||||
public boolean hasComparatorInputOverride(BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
|
||||
public int getComparatorInputOverride(BlockState state, World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityBase) { return ((TileEntityBase) tile).getComparatorStrength(); }
|
||||
return 0;
|
||||
}
|
||||
|
||||
// todo: come back to this. It think it's goal is to keep data on the dropped item... I know
|
||||
// how to do this but I need to make sure I do it right.
|
||||
|
||||
// @Override
|
||||
// public void spawnAdditionalDrops(BlockState state, World world, BlockPos pos, ItemStack stack) {
|
||||
// TileEntity tile = world.getTileEntity(pos);
|
||||
// if (tile instanceof TileEntityBase) {
|
||||
// TileEntityBase base = (TileEntityBase) tile;
|
||||
// if (!base.stopFromDropping) {
|
||||
// CompoundNBT data = new CompoundNBT();
|
||||
// base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||
//
|
||||
// //Remove unnecessarily saved default values to avoid unstackability
|
||||
// List<String> keysToRemove = new ArrayList<>();
|
||||
// for (String key : data.getKeySet()) {
|
||||
// NBTBase tag = data.getTag(key);
|
||||
// //Remove only ints because they are the most common ones
|
||||
// //Add else if below here to remove more types
|
||||
// if (tag instanceof NBTTagInt) {
|
||||
// if (((NBTTagInt) tag).getInt() == 0) {
|
||||
// keysToRemove.add(key);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// for (String key : keysToRemove) {
|
||||
// data.remove(key);
|
||||
// }
|
||||
//
|
||||
// ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state));
|
||||
// if (!data.isEmpty()) {
|
||||
// stack.setTagCompound(new NBTTagCompound());
|
||||
// stack.getTagCompound().setTag("Data", data);
|
||||
// }
|
||||
//
|
||||
// drops.add(stack);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityBase) {
|
||||
TileEntityBase base = (TileEntityBase) tile;
|
||||
if (!base.stopFromDropping) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
base.writeSyncableNBT(data, TileEntityBase.NBTType.SAVE_BLOCK);
|
||||
|
||||
//Remove unnecessarily saved default values to avoid unstackability
|
||||
List<String> keysToRemove = new ArrayList<>();
|
||||
for (String key : data.getKeySet()) {
|
||||
NBTBase tag = data.getTag(key);
|
||||
//Remove only ints because they are the most common ones
|
||||
//Add else if below here to remove more types
|
||||
if (tag instanceof NBTTagInt) {
|
||||
if (((NBTTagInt) tag).getInt() == 0) {
|
||||
keysToRemove.add(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String key : keysToRemove) {
|
||||
data.removeTag(key);
|
||||
}
|
||||
|
||||
ItemStack stack = new ItemStack(this.getItemDropped(state, tile.getWorld().rand, fortune), 1, this.damageDropped(state));
|
||||
if (!data.isEmpty()) {
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
stack.getTagCompound().setTag("Data", data);
|
||||
}
|
||||
|
||||
drops.add(stack);
|
||||
}
|
||||
} else {
|
||||
super.getDrops(drops, world, pos, state, fortune);
|
||||
}
|
||||
public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid) {
|
||||
return willHarvest || super.removedByPlayer(state, world, pos, player, false, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
return willHarvest || super.removedByPlayer(state, world, pos, player, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) {
|
||||
public void harvestBlock(World worldIn, PlayerEntity player, BlockPos pos, BlockState state, @Nullable TileEntity te, ItemStack stack) {
|
||||
super.harvestBlock(worldIn, player, pos, state, te, stack);
|
||||
worldIn.setBlockToAir(pos);
|
||||
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
public BlockRenderType getRenderType(BlockState state) {
|
||||
return BlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, BlockPos pos, IBlockState state) {
|
||||
if (this.shouldDropInventory(world, pos)) {
|
||||
public void onReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
// todo: this might not work with this sepecific state check
|
||||
if (state != newState && this.shouldDropInventory(world, pos)) {
|
||||
this.dropInventory(world, pos);
|
||||
}
|
||||
|
||||
super.breakBlock(world, pos, state);
|
||||
super.onReplaced(state, world, pos, newState, isMoving);
|
||||
}
|
||||
|
||||
public boolean shouldDropInventory(World world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,55 +1,52 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.FlowingFluidBlock;
|
||||
import net.minecraft.fluid.FlowingFluid;
|
||||
|
||||
public class BlockFluidFlowing extends BlockFluidClassic implements ItemBlockBase.ICustomRarity {
|
||||
@Deprecated
|
||||
public class BlockFluidFlowing extends FlowingFluidBlock {
|
||||
|
||||
private final String name;
|
||||
// private final String name;
|
||||
|
||||
public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName) {
|
||||
super(fluid, material);
|
||||
this.name = unlocalizedName;
|
||||
this.displacements.put(this, false);
|
||||
public BlockFluidFlowing(FlowingFluid fluid, Block.Properties builder) {
|
||||
super(fluid, builder);
|
||||
// this.name = unlocalizedName;
|
||||
// todo: check this
|
||||
// this.displacements.put(this, false);
|
||||
|
||||
this.register();
|
||||
// this.register();
|
||||
}
|
||||
|
||||
private void register() {
|
||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
}
|
||||
// private void register() {
|
||||
// ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
// }
|
||||
|
||||
protected String getBaseName() {
|
||||
return this.name;
|
||||
}
|
||||
// protected String getBaseName() {
|
||||
// return this.name;
|
||||
// }
|
||||
|
||||
protected ItemBlockBase getItemBlock() {
|
||||
return new ItemBlockBase(this);
|
||||
}
|
||||
// protected ItemBlockBase getItemBlock() {
|
||||
// return new ItemBlockBase(this);
|
||||
// }
|
||||
|
||||
public boolean shouldAddCreative() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, BlockPos pos) {
|
||||
return !world.getBlockState(pos).getMaterial().isLiquid() && super.canDisplace(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displaceIfPossible(World world, BlockPos pos) {
|
||||
return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.EPIC;
|
||||
}
|
||||
// todo: reeval canDisplay and displaceIfPossible
|
||||
// @Override
|
||||
// public boolean canDisplace(IBlockAccess world, BlockPos pos) {
|
||||
// return !world.getBlockState(pos).getMaterial().isLiquid() && super.canDisplace(world, pos);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean displaceIfPossible(World world, BlockPos pos) {
|
||||
// return !world.getBlockState(pos).getMaterial().isLiquid() && super.displaceIfPossible(world, pos);
|
||||
// }
|
||||
////
|
||||
// @Override
|
||||
// public EnumRarity getRarity(ItemStack stack) {
|
||||
// return EnumRarity.EPIC;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -10,92 +10,89 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.block.BlockCrops;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.CropsBlock;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.PlantType;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||
import java.util.List;
|
||||
|
||||
private final String name;
|
||||
private final int minDropAmount;
|
||||
private final int addDropAmount;
|
||||
public class BlockPlant extends CropsBlock {// implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||
|
||||
// private final String name;
|
||||
private final int minDropAmount = 1;
|
||||
private final int addDropAmount = 1;
|
||||
public Item seedItem;
|
||||
private Item returnItem;
|
||||
private int returnMeta;
|
||||
|
||||
public BlockPlant(String name, int minDropAmount, int addDropAmount) {
|
||||
this.name = name;
|
||||
this.minDropAmount = minDropAmount;
|
||||
this.addDropAmount = addDropAmount;
|
||||
this.register();
|
||||
public BlockPlant(Properties properties) {
|
||||
super(properties);
|
||||
// this.name = name;
|
||||
// this.minDropAmount = minDropAmount;
|
||||
// this.addDropAmount = addDropAmount;
|
||||
// this.register();
|
||||
}
|
||||
|
||||
// todo: check what this is doing
|
||||
public void doStuff(Item seedItem, Item returnItem, int returnMeta) {
|
||||
this.seedItem = seedItem;
|
||||
this.returnItem = returnItem;
|
||||
this.returnMeta = returnMeta;
|
||||
}
|
||||
|
||||
private void register() {
|
||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
}
|
||||
// private void register() {
|
||||
// ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
// }
|
||||
|
||||
protected String getBaseName() {
|
||||
return this.name;
|
||||
}
|
||||
// protected String getBaseName() {
|
||||
// return this.name;
|
||||
// }
|
||||
|
||||
protected ItemBlockBase getItemBlock() {
|
||||
return new ItemBlockBase(this);
|
||||
}
|
||||
// protected ItemBlockBase getItemBlock() {
|
||||
// return new ItemBlockBase(this);
|
||||
// }
|
||||
|
||||
public boolean shouldAddCreative() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRendering() {
|
||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||
}
|
||||
// @Override
|
||||
// public void registerRendering() {
|
||||
// ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||
// }
|
||||
//
|
||||
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.RARE;
|
||||
public PlantType getPlantType(IBlockReader world, BlockPos pos) {
|
||||
return PlantType.Crop;
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// public int damageDropped(IBlockState state) {
|
||||
// return this.getMetaFromState(state) >= 7 ? this.returnMeta : 0;
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
|
||||
return EnumPlantType.Crop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return this.getMetaFromState(state) >= 7 ? this.returnMeta : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
if (this.getMetaFromState(state) >= 7) {
|
||||
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
if (getAge(state) > 7) {
|
||||
if (!world.isRemote) {
|
||||
List<ItemStack> drops = getDrops(state, (ServerWorld) world, pos, null);
|
||||
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
this.getDrops(drops, world, pos, state, 0);
|
||||
boolean deductedSeedSize = false;
|
||||
for (ItemStack drop : drops) {
|
||||
if (StackUtil.isValid(drop)) {
|
||||
|
@ -109,31 +106,35 @@ public class BlockPlant extends BlockCrops implements ItemBlockBase.ICustomRarit
|
|||
}
|
||||
}
|
||||
|
||||
world.setBlockState(pos, this.getStateFromMeta(0));
|
||||
world.setBlockState(pos, state.with(AGE, 0));
|
||||
}
|
||||
return true;
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
return false;
|
||||
|
||||
return super.onBlockActivated(state, world, pos, player, handIn, hit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getSeed() {
|
||||
protected IItemProvider getSeedsItem() {
|
||||
return this.seedItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(IBlockState state, int fortune, Random random) {
|
||||
return this.getMetaFromState(state) >= 7 ? random.nextInt(this.addDropAmount) + this.minDropAmount : super.quantityDropped(state, fortune, random);
|
||||
}
|
||||
// todo: this is likely handled by loot tables now
|
||||
|
||||
@Override
|
||||
public Item getCrop() {
|
||||
return this.returnItem;
|
||||
}
|
||||
// @Override
|
||||
// public int quantityDropped(IBlockState state, int fortune, Random random) {
|
||||
// return this.getMetaFromState(state) >= 7 ? random.nextInt(this.addDropAmount) + this.minDropAmount : super.quantityDropped(state, fortune, random);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(IBlockState state, Random rand, int par3) {
|
||||
return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
|
||||
}
|
||||
// @Override
|
||||
// public Item getCrop() {
|
||||
// return this.returnItem;
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public Item getItemDropped(IBlockState state, Random rand, int par3) {
|
||||
// return this.getMetaFromState(state) >= 7 ? this.getCrop() : this.getSeed();
|
||||
// }
|
||||
|
||||
}
|
|
@ -1,53 +1,57 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BlockStair extends BlockStairs implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||
|
||||
private final String name;
|
||||
|
||||
public BlockStair(Block block, String name) {
|
||||
this(block.getDefaultState(), name);
|
||||
}
|
||||
|
||||
public BlockStair(IBlockState state, String name) {
|
||||
super(state);
|
||||
this.name = name;
|
||||
this.setLightOpacity(0);
|
||||
|
||||
this.register();
|
||||
}
|
||||
|
||||
private void register() {
|
||||
ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
}
|
||||
|
||||
protected String getBaseName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
protected ItemBlockBase getItemBlock() {
|
||||
return new ItemBlockBase(this);
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRendering() {
|
||||
ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack) {
|
||||
return EnumRarity.COMMON;
|
||||
}
|
||||
}
|
||||
//package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
//
|
||||
//import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
//import de.ellpeck.actuallyadditions.mod.blocks.render.IHasModel;
|
||||
//import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
//import net.minecraft.block.Block;
|
||||
//import net.minecraft.block.BlockStairs;
|
||||
//import net.minecraft.block.BlockState;
|
||||
//import net.minecraft.block.StairsBlock;
|
||||
//import net.minecraft.block.state.IBlockState;
|
||||
//import net.minecraft.item.EnumRarity;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//
|
||||
//@Deprecated
|
||||
//public class BlockStair extends StairsBlock { //BlockStairs implements ItemBlockBase.ICustomRarity, IHasModel {
|
||||
//
|
||||
//// private final String name;
|
||||
//
|
||||
//// public BlockStair(Block block, String name) {
|
||||
////
|
||||
//// this(block.getDefaultState(), name);
|
||||
//// }
|
||||
////
|
||||
//// public BlockStair(BlockState state) {
|
||||
////// super(state);
|
||||
////// this.name = name;
|
||||
////// this.setLightOpacity(0);
|
||||
////
|
||||
////// this.register();
|
||||
//// }
|
||||
//
|
||||
//// private void register() {
|
||||
//// ItemUtil.registerBlock(this, this.getItemBlock(), this.getBaseName(), this.shouldAddCreative());
|
||||
//// }
|
||||
//
|
||||
//// protected String getBaseName() {
|
||||
//// return this.name;
|
||||
//// }
|
||||
//
|
||||
//// protected ItemBlockBase getItemBlock() {
|
||||
//// return new ItemBlockBase(this);
|
||||
//// }
|
||||
//
|
||||
// public boolean shouldAddCreative() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//// @Override
|
||||
//// public void registerRendering() {
|
||||
//// ActuallyAdditions.PROXY.addRenderRegister(new ItemStack(this), this.getRegistryName(), "inventory");
|
||||
//// }
|
||||
//
|
||||
//// @Override
|
||||
//// public EnumRarity getRarity(ItemStack stack) {
|
||||
//// return EnumRarity.COMMON;
|
||||
//// }
|
||||
//}
|
||||
|
|
|
@ -1,41 +1,25 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.IRarity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemBlockBase extends ItemBlock {
|
||||
@Deprecated
|
||||
public class ItemBlockBase extends BlockItem {
|
||||
|
||||
public ItemBlockBase(Block block) {
|
||||
super(block);
|
||||
this.setHasSubtypes(false);
|
||||
this.setMaxDamage(0);
|
||||
public ItemBlockBase(Block block, Item.Properties properties) {
|
||||
super(block, properties);
|
||||
// this.setHasSubtypes(false);
|
||||
// this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey(ItemStack stack) {
|
||||
return this.getTranslationKey();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRarity getForgeRarity(ItemStack stack) {
|
||||
if (this.block instanceof ICustomRarity) {
|
||||
return ((ICustomRarity) this.block).getRarity(stack);
|
||||
} else {
|
||||
return Util.FALLBACK_RARITY;
|
||||
}
|
||||
}
|
||||
|
||||
public interface ICustomRarity {
|
||||
|
||||
IRarity getRarity(ItemStack stack);
|
||||
|
||||
}
|
||||
// @Override
|
||||
// public String getTranslationKey(ItemStack stack) {
|
||||
// return this.getTranslationKey();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int getMetadata(int damage) {
|
||||
// return damage;
|
||||
// }
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||
|
||||
@Deprecated
|
||||
public interface IHasModel {
|
||||
|
||||
public void registerRendering();
|
||||
|
|
|
@ -6,6 +6,7 @@ import de.ellpeck.actuallyadditions.mod.util.VanillaPacketDispatcher;
|
|||
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
|
@ -163,7 +164,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable {
|
|||
}*/
|
||||
}
|
||||
|
||||
public void writeSyncableNBT(NBTTagCompound compound, NBTType type) {
|
||||
public void writeSyncableNBT(CompoundNBT compound, NBTType type) {
|
||||
if (type != NBTType.SAVE_BLOCK) super.writeToNBT(compound);
|
||||
|
||||
if (type == NBTType.SAVE_TILE) {
|
||||
|
@ -177,7 +178,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable {
|
|||
}
|
||||
}
|
||||
|
||||
public void readSyncableNBT(NBTTagCompound compound, NBTType type) {
|
||||
public void readSyncableNBT(CompoundNBT compound, NBTType type) {
|
||||
if (type != NBTType.SAVE_BLOCK) super.readFromNBT(compound);
|
||||
|
||||
if (type == NBTType.SAVE_TILE) {
|
||||
|
|
Loading…
Reference in a new issue