mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-27 01:08:34 +01:00
Removed Item Distributor
This commit is contained in:
parent
4e114c6dbc
commit
7f94823e20
9 changed files with 1 additions and 249 deletions
|
@ -150,7 +150,7 @@ public class ActuallyAdditions{
|
||||||
if(mapping.name != null){
|
if(mapping.name != null){
|
||||||
String name = mapping.name.toLowerCase(Locale.ROOT);
|
String name = mapping.name.toLowerCase(Locale.ROOT);
|
||||||
if(name.startsWith(ModUtil.MOD_ID+":")){
|
if(name.startsWith(ModUtil.MOD_ID+":")){
|
||||||
if(name.contains("paxel") || name.contains("itemspecial") || name.contains("blockbookstand") || name.contains("rarmor") || name.contains("bucket") || name.contains("modulereconstructor") || name.contains("stand")){
|
if(name.contains("paxel") || name.contains("itemspecial") || name.contains("blockbookstand") || name.contains("rarmor") || name.contains("bucket") || name.contains("modulereconstructor") || name.contains("stand") || name.contains("distributor")){
|
||||||
mapping.ignore();
|
mapping.ignore();
|
||||||
ModUtil.LOGGER.info("Missing Mapping "+mapping.name+" is getting ignored. This is intentional.");
|
ModUtil.LOGGER.info("Missing Mapping "+mapping.name+" is getting ignored. This is intentional.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("BlockDistributorItem.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2016 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDistributorItem;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.ScaledResolution;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.EnumRarity;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.util.text.TextFormatting;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public class BlockDistributorItem extends BlockContainerBase implements IHudDisplay{
|
|
||||||
|
|
||||||
public BlockDistributorItem(String name){
|
|
||||||
super(Material.ROCK, name);
|
|
||||||
|
|
||||||
this.setHarvestLevel("pickaxe", 0);
|
|
||||||
this.setHardness(1.75F);
|
|
||||||
this.setResistance(10.0F);
|
|
||||||
this.setSoundType(SoundType.STONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(World worldIn, int meta){
|
|
||||||
return new TileEntityDistributorItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void breakBlock(World world, BlockPos pos, IBlockState state){
|
|
||||||
this.dropInventory(world, pos);
|
|
||||||
super.breakBlock(world, pos, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, ScaledResolution resolution){
|
|
||||||
TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos());
|
|
||||||
if(tile instanceof TileEntityDistributorItem){
|
|
||||||
TileEntityDistributorItem distributor = (TileEntityDistributorItem)tile;
|
|
||||||
ItemStack slot = distributor.getStackInSlot(0);
|
|
||||||
|
|
||||||
String strg;
|
|
||||||
if(!StackUtil.isValid(slot)){
|
|
||||||
strg = StringUtil.localize("info."+ModUtil.MOD_ID+".noItem");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
strg = slot.getItem().getItemStackDisplayName(slot);
|
|
||||||
AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-19, 1F);
|
|
||||||
}
|
|
||||||
minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-15, StringUtil.DECIMAL_COLOR_WHITE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumRarity getRarity(ItemStack stack){
|
|
||||||
return EnumRarity.UNCOMMON;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -104,7 +104,6 @@ public final class InitBlocks{
|
||||||
public static Block blockDisplayStand;
|
public static Block blockDisplayStand;
|
||||||
public static Block blockShockSuppressor;
|
public static Block blockShockSuppressor;
|
||||||
public static Block blockEmpowerer;
|
public static Block blockEmpowerer;
|
||||||
public static Block blockDistributorItem;
|
|
||||||
public static Block blockBioReactor;
|
public static Block blockBioReactor;
|
||||||
public static Block blockTinyTorch;
|
public static Block blockTinyTorch;
|
||||||
public static Block blockFarmer;
|
public static Block blockFarmer;
|
||||||
|
@ -114,7 +113,6 @@ public final class InitBlocks{
|
||||||
|
|
||||||
blockFarmer = new BlockFarmer("blockFarmer");
|
blockFarmer = new BlockFarmer("blockFarmer");
|
||||||
blockBioReactor = new BlockBioReactor("blockBioReactor");
|
blockBioReactor = new BlockBioReactor("blockBioReactor");
|
||||||
blockDistributorItem = new BlockDistributorItem("blockDistributorItem");
|
|
||||||
blockEmpowerer = new BlockEmpowerer("blockEmpowerer");
|
blockEmpowerer = new BlockEmpowerer("blockEmpowerer");
|
||||||
blockTinyTorch = new BlockTinyTorch("blockTinyTorch");
|
blockTinyTorch = new BlockTinyTorch("blockTinyTorch");
|
||||||
blockShockSuppressor = new BlockShockSuppressor("blockShockSuppressor");
|
blockShockSuppressor = new BlockShockSuppressor("blockShockSuppressor");
|
||||||
|
|
|
@ -173,7 +173,6 @@ public final class InitBooklet{
|
||||||
new BookletChapter("phantomRedstoneface", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomRedstoneface), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePhantomRedstoneface).setNoText());
|
new BookletChapter("phantomRedstoneface", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomRedstoneface), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipePhantomRedstoneface).setNoText());
|
||||||
new BookletChapter("phantomBreaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomBreaker), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPhantomPlacer.RANGE), new PageCrafting(2, BlockCrafting.recipePhantomPlacer).setNoText(), new PageCrafting(3, BlockCrafting.recipePhantomBreaker).setNoText());
|
new BookletChapter("phantomBreaker", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockPhantomBreaker), new PageTextOnly(1).addTextReplacement("<range>", TileEntityPhantomPlacer.RANGE), new PageCrafting(2, BlockCrafting.recipePhantomPlacer).setNoText(), new PageCrafting(3, BlockCrafting.recipePhantomBreaker).setNoText());
|
||||||
new BookletChapter("esd", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockInputterAdvanced), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial();
|
new BookletChapter("esd", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockInputterAdvanced), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeESD).setNoText(), new PageCrafting(3, BlockCrafting.recipeAdvancedESD).setNoText()).setSpecial();
|
||||||
new BookletChapter("distributorItem", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockDistributorItem), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeDistributorItem).setNoText()).setSpecial();
|
|
||||||
new BookletChapter("xpSolidifier", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockXPSolidifier), new PageTextOnly(1).addItemToPage(new ItemStack(InitItems.itemSolidifiedExperience)), new PageCrafting(2, BlockCrafting.recipeSolidifier).setNoText()).setImportant();
|
new BookletChapter("xpSolidifier", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockXPSolidifier), new PageTextOnly(1).addItemToPage(new ItemStack(InitItems.itemSolidifiedExperience)), new PageCrafting(2, BlockCrafting.recipeSolidifier).setNoText()).setImportant();
|
||||||
new BookletChapter("greenhouseGlass", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockGreenhouseGlass), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeGlass));
|
new BookletChapter("greenhouseGlass", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockGreenhouseGlass), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeGlass));
|
||||||
new BookletChapter("fishingNet", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockFishingNet), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFisher).setNoText());
|
new BookletChapter("fishingNet", ActuallyAdditionsAPI.entryFunctionalNonRF, new ItemStack(InitBlocks.blockFishingNet), new PageTextOnly(1), new PageCrafting(2, BlockCrafting.recipeFisher).setNoText());
|
||||||
|
|
|
@ -157,7 +157,6 @@ public enum ConfigCrafting{
|
||||||
FILLING_WAND("Handheld Filler", ConfigCategories.ITEMS_CRAFTING),
|
FILLING_WAND("Handheld Filler", ConfigCategories.ITEMS_CRAFTING),
|
||||||
VOID_BAG("Void Bag", ConfigCategories.ITEMS_CRAFTING),
|
VOID_BAG("Void Bag", ConfigCategories.ITEMS_CRAFTING),
|
||||||
EMPOWERER("Empowerer", ConfigCategories.BLOCKS_CRAFTING),
|
EMPOWERER("Empowerer", ConfigCategories.BLOCKS_CRAFTING),
|
||||||
DISTRIBUTOR_ITEM("Item Distributor", ConfigCategories.BLOCKS_CRAFTING),
|
|
||||||
FARMER("Farmer", ConfigCategories.BLOCKS_CRAFTING);
|
FARMER("Farmer", ConfigCategories.BLOCKS_CRAFTING);
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
|
|
|
@ -147,16 +147,6 @@ public final class BlockCrafting{
|
||||||
recipeFireworkBox = RecipeUtil.lastIRecipe();
|
recipeFireworkBox = RecipeUtil.lastIRecipe();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Item Distributor
|
|
||||||
if(ConfigCrafting.DISTRIBUTOR_ITEM.isEnabled()){
|
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockDistributorItem),
|
|
||||||
"WHW", "HCH", "WHW",
|
|
||||||
'W', "plankWood",
|
|
||||||
'H', new ItemStack(Blocks.HOPPER),
|
|
||||||
'C', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal())));
|
|
||||||
recipeDistributorItem = RecipeUtil.lastIRecipe();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Shock Suppressor
|
//Shock Suppressor
|
||||||
if(ConfigCrafting.SHOCK_SUPPRESSOR.isEnabled()){
|
if(ConfigCrafting.SHOCK_SUPPRESSOR.isEnabled()){
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockShockSuppressor),
|
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockShockSuppressor),
|
||||||
|
|
|
@ -82,7 +82,6 @@ public class CreativeTab extends CreativeTabs{
|
||||||
this.add(InitBlocks.blockCoffeeMachine);
|
this.add(InitBlocks.blockCoffeeMachine);
|
||||||
this.add(InitBlocks.blockXPSolidifier);
|
this.add(InitBlocks.blockXPSolidifier);
|
||||||
this.add(InitBlocks.blockDisplayStand);
|
this.add(InitBlocks.blockDisplayStand);
|
||||||
this.add(InitBlocks.blockDistributorItem);
|
|
||||||
|
|
||||||
this.add(InitBlocks.blockFarmer);
|
this.add(InitBlocks.blockFarmer);
|
||||||
this.add(InitBlocks.blockShockSuppressor);
|
this.add(InitBlocks.blockShockSuppressor);
|
||||||
|
|
|
@ -106,7 +106,6 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{
|
||||||
register(TileEntityShockSuppressor.class);
|
register(TileEntityShockSuppressor.class);
|
||||||
register(TileEntityEmpowerer.class);
|
register(TileEntityEmpowerer.class);
|
||||||
register(TileEntityLaserRelayFluids.class);
|
register(TileEntityLaserRelayFluids.class);
|
||||||
register(TileEntityDistributorItem.class);
|
|
||||||
register(TileEntityBioReactor.class);
|
register(TileEntityBioReactor.class);
|
||||||
register(TileEntityFarmer.class);
|
register(TileEntityFarmer.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,154 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("TileEntityDistributorItem.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2016 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
|
||||||
import net.minecraftforge.items.CapabilityItemHandler;
|
|
||||||
import net.minecraftforge.items.IItemHandler;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class TileEntityDistributorItem extends TileEntityInventoryBase{
|
|
||||||
|
|
||||||
private final Map<EnumFacing, IItemHandler> handlersAround = new HashMap<EnumFacing, IItemHandler>();
|
|
||||||
private int putSide;
|
|
||||||
|
|
||||||
public TileEntityDistributorItem(){
|
|
||||||
super(1, "distributorItem");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity(){
|
|
||||||
super.updateEntity();
|
|
||||||
|
|
||||||
if(!this.worldObj.isRemote){
|
|
||||||
boolean shouldMarkDirty = false;
|
|
||||||
|
|
||||||
IItemHandler handlerUp = this.handlersAround.get(EnumFacing.UP);
|
|
||||||
if(handlerUp != null){
|
|
||||||
for(int i = 0; i < handlerUp.getSlots(); i++){
|
|
||||||
|
|
||||||
ItemStack pullable = handlerUp.extractItem(i, 1, true);
|
|
||||||
if(StackUtil.isValid(pullable) && (!StackUtil.isValid(this.slots[0]) || (ItemUtil.canBeStacked(this.slots[0], pullable) && StackUtil.getStackSize(this.slots[0]) < this.slots[0].getMaxStackSize()))){
|
|
||||||
ItemStack pulled = handlerUp.extractItem(i, 1, false);
|
|
||||||
if(StackUtil.isValid(pulled)){
|
|
||||||
if(!StackUtil.isValid(this.slots[0])){
|
|
||||||
this.slots[0] = pulled.copy();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.slots[0] = StackUtil.addStackSize(this.slots[0], StackUtil.getStackSize(pulled));
|
|
||||||
}
|
|
||||||
shouldMarkDirty = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(StackUtil.isValid(this.slots[0]) && StackUtil.getStackSize(this.slots[0]) >= this.slots[0].getMaxStackSize()){
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!this.handlersAround.isEmpty() && (!this.handlersAround.containsKey(EnumFacing.UP) || this.handlersAround.size() >= 2) && StackUtil.isValid(this.slots[0])){
|
|
||||||
EnumFacing[] allFacings = EnumFacing.values();
|
|
||||||
do{
|
|
||||||
this.putSide++;
|
|
||||||
|
|
||||||
if(this.putSide >= 6){
|
|
||||||
this.putSide = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while(allFacings[this.putSide] == EnumFacing.UP || !this.handlersAround.containsKey(allFacings[this.putSide]));
|
|
||||||
|
|
||||||
EnumFacing putFacing = allFacings[this.putSide];
|
|
||||||
IItemHandler handler = this.handlersAround.get(putFacing);
|
|
||||||
if(handler != null){
|
|
||||||
int aroundAmount = this.handlersAround.containsKey(EnumFacing.UP) ? this.handlersAround.size()-1 : this.handlersAround.size();
|
|
||||||
int amount = StackUtil.getStackSize(this.slots[0])/aroundAmount;
|
|
||||||
if(amount <= 0){
|
|
||||||
amount = StackUtil.getStackSize(this.slots[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(amount > 0){
|
|
||||||
ItemStack toInsert = this.slots[0].copy();
|
|
||||||
toInsert = StackUtil.setStackSize(toInsert, amount);
|
|
||||||
|
|
||||||
for(int i = 0; i < handler.getSlots(); i++){
|
|
||||||
toInsert = handler.insertItem(i, toInsert.copy(), false);
|
|
||||||
|
|
||||||
if(!StackUtil.isValid(toInsert)){
|
|
||||||
this.slots[0] = StackUtil.addStackSize(this.slots[0], -amount);
|
|
||||||
shouldMarkDirty = true;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(shouldMarkDirty){
|
|
||||||
this.markDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveDataOnChangeOrWorldStart(){
|
|
||||||
this.handlersAround.clear();
|
|
||||||
|
|
||||||
for(EnumFacing side : EnumFacing.values()){
|
|
||||||
TileEntity tile = this.worldObj.getTileEntity(this.pos.offset(side));
|
|
||||||
if(tile != null && tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite())){
|
|
||||||
IItemHandler cap = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, side.getOpposite());
|
|
||||||
if(cap != null){
|
|
||||||
this.handlersAround.put(side, cap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldSyncSlots(){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void markDirty(){
|
|
||||||
super.markDirty();
|
|
||||||
this.sendUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldSaveDataOnChangeOrWorldStart(){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction){
|
|
||||||
return direction == EnumFacing.UP && this.isItemValidForSlot(index, stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isItemValidForSlot(int index, ItemStack stack){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue