001/* 002 * Trident - A Multithreaded Server Alternative 003 * Copyright 2014 The TridentSDK Team 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package net.tridentsdk.server.data.block; 018 019import net.tridentsdk.base.Block; 020import net.tridentsdk.base.Substance; 021import net.tridentsdk.inventory.InventoryType; 022import net.tridentsdk.inventory.Item; 023import net.tridentsdk.meta.block.FurnaceMeta; 024import net.tridentsdk.meta.component.Meta; 025import net.tridentsdk.meta.component.MetaCollection; 026import net.tridentsdk.server.inventory.TridentInventory; 027 028public class FurnaceMetaImpl implements FurnaceMeta { 029 030 private TridentInventory furnaceInventory; 031 private Item source; 032 private Item fuel; 033 private Item result; 034 private int burnTicks; 035 036 @Override 037 public Item sourceSlot() { 038 return source; 039 } 040 041 @Override 042 public Item fuelSlot() { 043 return fuel; 044 } 045 046 @Override 047 public Item resultSlot() { 048 return result; 049 } 050 051 @Override 052 public int burnTicks() { 053 return burnTicks; 054 } 055 056 @Override 057 public void setSourceSlot(Item source) { 058 this.source = source; 059 } 060 061 @Override 062 public void setFuelSlot(Item fuel) { 063 this.fuel = fuel; 064 } 065 066 @Override 067 public void setResultSlot(Item result) { 068 this.result = result; 069 } 070 071 @Override 072 public void setBurnTicks(int burnTicks) { 073 this.burnTicks = burnTicks; 074 } 075 076 @Override 077 public byte encode() { 078 return 0; 079 } 080 081 @Override 082 public Meta<Block> decode(Block instance, float yaw, byte direction, byte cx, byte cy, byte cz, short damageValue) { 083 furnaceInventory = TridentInventory.create(null, 3, InventoryType.FURNACE); 084 instance.setSubstance(Substance.FURNACE); 085 return this; 086 } 087 088 @Override 089 public Meta<Block> make() { 090 return new FurnaceMetaImpl(); 091 } 092 093 @Override 094 public Substance[] applyTo(MetaCollection collection) { 095 collection.put(FurnaceMeta.class, this); 096 return new Substance[]{Substance.FURNACE}; 097 } 098 099 public TridentInventory furnaceInventory() { 100 return furnaceInventory; 101 } 102 103}