chore: format code
This commit is contained in:
parent
a91efde028
commit
97a3dc12a6
|
@ -0,0 +1,130 @@
|
||||||
|
---
|
||||||
|
AccessModifierOffset: 0
|
||||||
|
AlignAfterOpenBracket: BlockIndent
|
||||||
|
AlignArrayOfStructures: None
|
||||||
|
AlignConsecutiveAssignments: None
|
||||||
|
AlignConsecutiveMacros: None
|
||||||
|
AlignConsecutiveBitFields: None
|
||||||
|
AlignConsecutiveDeclarations: None
|
||||||
|
AlignEscapedNewlines: DontAlign
|
||||||
|
AlignOperands: DontAlign
|
||||||
|
AlignTrailingComments: false
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: Empty
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortEnumsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: Empty
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: true
|
||||||
|
AlwaysBreakTemplateDeclarations: MultiLine
|
||||||
|
AttributeMacros: []
|
||||||
|
BinPackArguments: false
|
||||||
|
BinPackParameters: false
|
||||||
|
BitFieldColonSpacing: After
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: Never
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
AfterExternBlock: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
BeforeLambdaBody: false
|
||||||
|
BeforeWhile: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: false
|
||||||
|
SplitEmptyRecord: false
|
||||||
|
SplitEmptyNamespace: false
|
||||||
|
BreakAfterJavaFieldAnnotations: true
|
||||||
|
#BreakArrays: false
|
||||||
|
BreakBeforeBinaryOperators: All
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BreakBeforeConceptDeclarations: true
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializers: AfterColon
|
||||||
|
BreakInheritanceList: AfterColon
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 90
|
||||||
|
CompactNamespaces: false
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: false
|
||||||
|
DeriveLineEnding: false
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false # wtf
|
||||||
|
EmptyLineAfterAccessModifier: Never
|
||||||
|
EmptyLineBeforeAccessModifier: Always
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
FixNamespaceComments: false
|
||||||
|
ForEachMacros: ["BOOST_FOREACH"]
|
||||||
|
IfMacros: []
|
||||||
|
IncludeBlocks: Regroup
|
||||||
|
IndentAccessModifiers: false
|
||||||
|
IndentCaseBlocks: false
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentExternBlock: Indent
|
||||||
|
IndentGotoLabels: true
|
||||||
|
IndentPPDirectives: BeforeHash
|
||||||
|
#IndentRequiresClause: false
|
||||||
|
IndentWidth: 4
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
#InsertBraces: false
|
||||||
|
InsertTrailingCommas: Wrapped
|
||||||
|
JavaImportGroups: ["java"]
|
||||||
|
JavaScriptQuotes: Double
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
LambdaBodyIndentation: OuterScope
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: All
|
||||||
|
PackConstructorInitializers: NextLine
|
||||||
|
PointerAlignment: Left
|
||||||
|
QualifierAlignment: Left
|
||||||
|
ReferenceAlignment: Left
|
||||||
|
ReflowComments: true
|
||||||
|
#RemoveSemicolon: true
|
||||||
|
#RequiresClausePosition: OwnLine
|
||||||
|
#RequiresExpressionIndentation: OuterScope
|
||||||
|
SeparateDefinitionBlocks: Always
|
||||||
|
SortIncludes: CaseInsensitive
|
||||||
|
SortJavaStaticImport: Before
|
||||||
|
SortUsingDeclarations: true
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: false
|
||||||
|
SpaceAroundPointerQualifiers: After
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCaseColon: false
|
||||||
|
SpaceBeforeCpp11BracedList: false
|
||||||
|
SpaceBeforeCtorInitializerColon: false
|
||||||
|
SpaceBeforeInheritanceColon: false
|
||||||
|
SpaceBeforeParens: ControlStatementsExceptControlMacros
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
|
SpaceInEmptyBlock: false
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesInAngles: Never
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInConditionalStatement: false
|
||||||
|
SpacesInContainerLiterals: false
|
||||||
|
SpacesInLineCommentPrefix:
|
||||||
|
Minimum: 0
|
||||||
|
Maximum: -1
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
Standard: c++20
|
||||||
|
StatementAttributeLikeMacros: []
|
||||||
|
StatementMacros: []
|
||||||
|
TabWidth: 4
|
||||||
|
TypenameMacros: []
|
||||||
|
UseCRLF: false # wtf
|
||||||
|
UseTab: Never
|
||||||
|
WhitespaceSensitiveMacros: ["BOOST_PP_STRINGSIZE"]
|
|
@ -1,5 +1,7 @@
|
||||||
package com.pahimar.ee3;
|
package com.pahimar.ee3;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.exchange.IEnergyValueRegistry;
|
import com.pahimar.ee3.api.exchange.IEnergyValueRegistry;
|
||||||
import com.pahimar.ee3.array.AlchemyArrayRegistry;
|
import com.pahimar.ee3.array.AlchemyArrayRegistry;
|
||||||
import com.pahimar.ee3.blacklist.BlacklistRegistry;
|
import com.pahimar.ee3.blacklist.BlacklistRegistry;
|
||||||
|
@ -23,7 +25,6 @@ import com.pahimar.ee3.util.FluidHelper;
|
||||||
import com.pahimar.ee3.util.LogHelper;
|
import com.pahimar.ee3.util.LogHelper;
|
||||||
import com.pahimar.ee3.util.SerializationHelper;
|
import com.pahimar.ee3.util.SerializationHelper;
|
||||||
import com.pahimar.ee3.util.TileEntityDataHelper;
|
import com.pahimar.ee3.util.TileEntityDataHelper;
|
||||||
|
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import cpw.mods.fml.common.Mod.EventHandler;
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
|
@ -35,33 +36,37 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import moze_intel.projecte.api.ProjectEAPI;
|
import moze_intel.projecte.api.ProjectEAPI;
|
||||||
import moze_intel.projecte.api.proxy.IEMCProxy;
|
import moze_intel.projecte.api.proxy.IEMCProxy;
|
||||||
|
|
||||||
import java.io.File;
|
@Mod(
|
||||||
|
modid = Reference.MOD_ID,
|
||||||
@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, certificateFingerprint = Reference.FINGERPRINT, version = Reference.MOD_VERSION, dependencies = Reference.DEPENDENCIES, guiFactory = Reference.GUI_FACTORY_CLASS)
|
name = Reference.MOD_NAME,
|
||||||
public class EquivalentExchange3
|
certificateFingerprint = Reference.FINGERPRINT,
|
||||||
{
|
version = Reference.MOD_VERSION,
|
||||||
|
dependencies = Reference.DEPENDENCIES,
|
||||||
|
guiFactory = Reference.GUI_FACTORY_CLASS
|
||||||
|
)
|
||||||
|
public class EquivalentExchange3 {
|
||||||
@Instance(Reference.MOD_ID)
|
@Instance(Reference.MOD_ID)
|
||||||
public static EquivalentExchange3 instance;
|
public static EquivalentExchange3 instance;
|
||||||
|
|
||||||
@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
|
@SidedProxy(
|
||||||
|
clientSide = Reference.CLIENT_PROXY_CLASS,
|
||||||
|
serverSide = Reference.SERVER_PROXY_CLASS
|
||||||
|
)
|
||||||
public static IProxy proxy;
|
public static IProxy proxy;
|
||||||
|
|
||||||
public static IEnergyValueRegistry REGISTRY;
|
public static IEnergyValueRegistry REGISTRY;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void invalidFingerprint(FMLFingerprintViolationEvent event) {
|
public void invalidFingerprint(FMLFingerprintViolationEvent event) {
|
||||||
|
|
||||||
if (Reference.FINGERPRINT.equals("@FINGERPRINT@")) {
|
if (Reference.FINGERPRINT.equals("@FINGERPRINT@")) {
|
||||||
LogHelper.info(Messages.NO_FINGERPRINT_MESSAGE);
|
LogHelper.info(Messages.NO_FINGERPRINT_MESSAGE);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
LogHelper.warn(Messages.INVALID_FINGERPRINT_MESSAGE);
|
LogHelper.warn(Messages.INVALID_FINGERPRINT_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onServerStarting(FMLServerStartingEvent event) {
|
public void onServerStarting(FMLServerStartingEvent event) {
|
||||||
|
|
||||||
Files.updateFileReferences();
|
Files.updateFileReferences();
|
||||||
|
|
||||||
SerializationHelper.initModDataDirectories();
|
SerializationHelper.initModDataDirectories();
|
||||||
|
@ -70,7 +75,6 @@ public class EquivalentExchange3
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
|
|
||||||
if (Loader.isModLoaded("ProjectE")) {
|
if (Loader.isModLoaded("ProjectE")) {
|
||||||
IEMCProxy proxy = ProjectEAPI.getEMCProxy();
|
IEMCProxy proxy = ProjectEAPI.getEMCProxy();
|
||||||
REGISTRY = new EMCRegistry(proxy);
|
REGISTRY = new EMCRegistry(proxy);
|
||||||
|
@ -99,7 +103,6 @@ public class EquivalentExchange3
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void init(FMLInitializationEvent event) {
|
public void init(FMLInitializationEvent event) {
|
||||||
|
|
||||||
// Register the GUI Handler
|
// Register the GUI Handler
|
||||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
|
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
|
||||||
|
|
||||||
|
@ -123,12 +126,15 @@ public class EquivalentExchange3
|
||||||
GameRegistry.registerFuelHandler(new FuelHandler());
|
GameRegistry.registerFuelHandler(new FuelHandler());
|
||||||
|
|
||||||
// Register the Waila data provider
|
// Register the Waila data provider
|
||||||
FMLInterModComms.sendMessage("Waila", "register", "com.pahimar.ee3.waila.WailaDataProvider.callbackRegister");
|
FMLInterModComms.sendMessage(
|
||||||
|
"Waila",
|
||||||
|
"register",
|
||||||
|
"com.pahimar.ee3.waila.WailaDataProvider.callbackRegister"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void postInit(FMLPostInitializationEvent event) {
|
public void postInit(FMLPostInitializationEvent event) {
|
||||||
|
|
||||||
Abilities.init();
|
Abilities.init();
|
||||||
|
|
||||||
// Initialize our test files
|
// Initialize our test files
|
||||||
|
@ -138,7 +144,6 @@ public class EquivalentExchange3
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onServerStopping(FMLServerStoppingEvent event) {
|
public void onServerStopping(FMLServerStoppingEvent event) {
|
||||||
|
|
||||||
WorldEventHandler.hasInitilialized = false;
|
WorldEventHandler.hasInitilialized = false;
|
||||||
EnergyValueRegistry.INSTANCE.save();
|
EnergyValueRegistry.INSTANCE.save();
|
||||||
PlayerKnowledgeRegistry.INSTANCE.saveAll();
|
PlayerKnowledgeRegistry.INSTANCE.saveAll();
|
||||||
|
@ -147,7 +152,6 @@ public class EquivalentExchange3
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void handleMissingMappingEvent(FMLMissingMappingsEvent event) {
|
public void handleMissingMappingEvent(FMLMissingMappingsEvent event) {
|
||||||
|
|
||||||
for (FMLMissingMappingsEvent.MissingMapping mapping : event.get()) {
|
for (FMLMissingMappingsEvent.MissingMapping mapping : event.get()) {
|
||||||
if (mapping.type == GameRegistry.Type.ITEM) {
|
if (mapping.type == GameRegistry.Type.ITEM) {
|
||||||
if (mapping.name.equals("EE3:alchemicalTome")) {
|
if (mapping.name.equals("EE3:alchemicalTome")) {
|
||||||
|
@ -157,18 +161,15 @@ public class EquivalentExchange3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnergyValueRegistry getEnergyValueRegistry()
|
public IEnergyValueRegistry getEnergyValueRegistry() {
|
||||||
{
|
|
||||||
return REGISTRY;
|
return REGISTRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecipeRegistry getRecipeRegistry()
|
public RecipeRegistry getRecipeRegistry() {
|
||||||
{
|
|
||||||
return RecipeRegistry.INSTANCE;
|
return RecipeRegistry.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AludelRecipeManager getAludelRecipeManager()
|
public AludelRecipeManager getAludelRecipeManager() {
|
||||||
{
|
|
||||||
return AludelRecipeManager.getInstance();
|
return AludelRecipeManager.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,8 +177,7 @@ public class EquivalentExchange3
|
||||||
return BlacklistRegistry.INSTANCE;
|
return BlacklistRegistry.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlchemyArrayRegistry getAlchemyArrayRegistry()
|
public AlchemyArrayRegistry getAlchemyArrayRegistry() {
|
||||||
{
|
|
||||||
return AlchemyArrayRegistry.getInstance();
|
return AlchemyArrayRegistry.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,13 +185,11 @@ public class EquivalentExchange3
|
||||||
return PlayerKnowledgeRegistry.INSTANCE;
|
return PlayerKnowledgeRegistry.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntityDataHelper getTileEntityDataHelper()
|
public TileEntityDataHelper getTileEntityDataHelper() {
|
||||||
{
|
|
||||||
return TileEntityDataHelper.getInstance();
|
return TileEntityDataHelper.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runEnergyValueTestSuite(File file)
|
public void runEnergyValueTestSuite(File file) {
|
||||||
{
|
|
||||||
runEnergyValueTestSuite(file, false);
|
runEnergyValueTestSuite(file, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,114 +11,88 @@ import net.minecraft.world.Explosion;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
// TODO Switch bare Strings to String constants
|
// TODO Switch bare Strings to String constants
|
||||||
public class AlchemyArray implements Comparable<AlchemyArray>
|
public class AlchemyArray implements Comparable<AlchemyArray> {
|
||||||
{
|
|
||||||
private ResourceLocation texture;
|
private ResourceLocation texture;
|
||||||
private String unlocalizedName;
|
private String unlocalizedName;
|
||||||
private String className;
|
private String className;
|
||||||
private int lightLevel;
|
private int lightLevel;
|
||||||
private int chalkPerBlockCost;
|
private int chalkPerBlockCost;
|
||||||
|
|
||||||
private AlchemyArray()
|
private AlchemyArray() {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
public AlchemyArray(ResourceLocation texture, String unlocalizedName) {
|
||||||
|
|
||||||
public AlchemyArray(ResourceLocation texture, String unlocalizedName)
|
|
||||||
{
|
|
||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
this.unlocalizedName = unlocalizedName;
|
this.unlocalizedName = unlocalizedName;
|
||||||
this.chalkPerBlockCost = 1;
|
this.chalkPerBlockCost = 1;
|
||||||
this.lightLevel = 0;
|
this.lightLevel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResourceLocation getTexture()
|
public ResourceLocation getTexture() {
|
||||||
{
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTexture(ResourceLocation texture)
|
public void setTexture(ResourceLocation texture) {
|
||||||
{
|
|
||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUnlocalizedName()
|
public String getUnlocalizedName() {
|
||||||
{
|
|
||||||
return unlocalizedName;
|
return unlocalizedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUnlocalizedName(String unlocalizedName)
|
public void setUnlocalizedName(String unlocalizedName) {
|
||||||
{
|
|
||||||
this.unlocalizedName = unlocalizedName;
|
this.unlocalizedName = unlocalizedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDisplayName()
|
public String getDisplayName() {
|
||||||
{
|
|
||||||
return StatCollector.translateToLocal(unlocalizedName);
|
return StatCollector.translateToLocal(unlocalizedName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getChalkCostPerBlock()
|
public int getChalkCostPerBlock() {
|
||||||
{
|
|
||||||
return chalkPerBlockCost;
|
return chalkPerBlockCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChalkPerBlockCost(int chalkPerBlockCost)
|
public void setChalkPerBlockCost(int chalkPerBlockCost) {
|
||||||
{
|
|
||||||
this.chalkPerBlockCost = Math.abs(chalkPerBlockCost);
|
this.chalkPerBlockCost = Math.abs(chalkPerBlockCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLightLevel()
|
public int getLightLevel() {
|
||||||
{
|
|
||||||
return lightLevel;
|
return lightLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getClassName()
|
public String getClassName() {
|
||||||
{
|
|
||||||
return className;
|
return className;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound nbtTagCompound)
|
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
||||||
{
|
if (nbtTagCompound != null) {
|
||||||
if (nbtTagCompound != null)
|
if (nbtTagCompound.hasKey("textureDomain")
|
||||||
{
|
&& nbtTagCompound.hasKey("texturePath")) {
|
||||||
if (nbtTagCompound.hasKey("textureDomain") && nbtTagCompound.hasKey("texturePath"))
|
this.texture = new ResourceLocation(
|
||||||
{
|
nbtTagCompound.getString("textureDomain"),
|
||||||
this.texture = new ResourceLocation(nbtTagCompound.getString("textureDomain"), nbtTagCompound.getString("texturePath"));
|
nbtTagCompound.getString("texturePath")
|
||||||
}
|
);
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
this.texture = new ResourceLocation("");
|
this.texture = new ResourceLocation("");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbtTagCompound.hasKey("unlocalizedName"))
|
if (nbtTagCompound.hasKey("unlocalizedName")) {
|
||||||
{
|
|
||||||
this.unlocalizedName = nbtTagCompound.getString("unlocalizedName");
|
this.unlocalizedName = nbtTagCompound.getString("unlocalizedName");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
this.unlocalizedName = "";
|
this.unlocalizedName = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbtTagCompound.hasKey("className"))
|
if (nbtTagCompound.hasKey("className")) {
|
||||||
{
|
|
||||||
this.className = nbtTagCompound.getString("className");
|
this.className = nbtTagCompound.getString("className");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
this.className = "";
|
this.className = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbtTagCompound.hasKey("lightLevel"))
|
if (nbtTagCompound.hasKey("lightLevel")) {
|
||||||
{
|
|
||||||
this.lightLevel = nbtTagCompound.getInteger("lightLevel");
|
this.lightLevel = nbtTagCompound.getInteger("lightLevel");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
this.lightLevel = 0;
|
this.lightLevel = 0;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
this.texture = new ResourceLocation("");
|
this.texture = new ResourceLocation("");
|
||||||
this.unlocalizedName = "";
|
this.unlocalizedName = "";
|
||||||
this.className = "";
|
this.className = "";
|
||||||
|
@ -126,8 +100,7 @@ public class AlchemyArray implements Comparable<AlchemyArray>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound nbtTagCompound)
|
public void writeToNBT(NBTTagCompound nbtTagCompound) {
|
||||||
{
|
|
||||||
nbtTagCompound.setString("textureDomain", texture.getResourceDomain());
|
nbtTagCompound.setString("textureDomain", texture.getResourceDomain());
|
||||||
nbtTagCompound.setString("texturePath", texture.getResourcePath());
|
nbtTagCompound.setString("texturePath", texture.getResourcePath());
|
||||||
nbtTagCompound.setString("unlocalizedName", unlocalizedName);
|
nbtTagCompound.setString("unlocalizedName", unlocalizedName);
|
||||||
|
@ -135,58 +108,102 @@ public class AlchemyArray implements Comparable<AlchemyArray>
|
||||||
nbtTagCompound.setInteger("lightLevel", lightLevel);
|
nbtTagCompound.setInteger("lightLevel", lightLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AlchemyArray readArrayFromNBT(NBTTagCompound nbtTagCompound)
|
public static AlchemyArray readArrayFromNBT(NBTTagCompound nbtTagCompound) {
|
||||||
{
|
|
||||||
AlchemyArray alchemyArray = new AlchemyArray();
|
AlchemyArray alchemyArray = new AlchemyArray();
|
||||||
alchemyArray.readFromNBT(nbtTagCompound);
|
alchemyArray.readFromNBT(nbtTagCompound);
|
||||||
return alchemyArray;
|
return alchemyArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onArrayPlacedBy(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, EntityLivingBase entityLiving, ItemStack itemStack)
|
public void onArrayPlacedBy(
|
||||||
{
|
World world,
|
||||||
|
int eventX,
|
||||||
|
int eventY,
|
||||||
|
int eventZ,
|
||||||
|
int arrayX,
|
||||||
|
int arrayY,
|
||||||
|
int arrayZ,
|
||||||
|
EntityLivingBase entityLiving,
|
||||||
|
ItemStack itemStack
|
||||||
|
) {}
|
||||||
|
|
||||||
}
|
public void onArrayActivated(
|
||||||
|
World world,
|
||||||
|
int eventX,
|
||||||
|
int eventY,
|
||||||
|
int eventZ,
|
||||||
|
int arrayX,
|
||||||
|
int arrayY,
|
||||||
|
int arrayZ,
|
||||||
|
EntityPlayer entityPlayer,
|
||||||
|
int sideHit,
|
||||||
|
float hitX,
|
||||||
|
float hitY,
|
||||||
|
float hitZ
|
||||||
|
) {}
|
||||||
|
|
||||||
public void onArrayActivated(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
|
public void onArrayClicked(
|
||||||
{
|
World world,
|
||||||
|
int eventX,
|
||||||
|
int eventY,
|
||||||
|
int eventZ,
|
||||||
|
int arrayX,
|
||||||
|
int arrayY,
|
||||||
|
int arrayZ,
|
||||||
|
EntityPlayer entityPlayer
|
||||||
|
) {}
|
||||||
|
|
||||||
}
|
public void onArrayDestroyedByExplosion(
|
||||||
|
World world,
|
||||||
|
int eventX,
|
||||||
|
int eventY,
|
||||||
|
int eventZ,
|
||||||
|
int arrayX,
|
||||||
|
int arrayY,
|
||||||
|
int arrayZ,
|
||||||
|
Explosion explosion
|
||||||
|
) {}
|
||||||
|
|
||||||
public void onArrayClicked(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, EntityPlayer entityPlayer)
|
public void onArrayDestroyedByPlayer(
|
||||||
{
|
World world,
|
||||||
|
int eventX,
|
||||||
|
int eventY,
|
||||||
|
int eventZ,
|
||||||
|
int arrayX,
|
||||||
|
int arrayY,
|
||||||
|
int arrayZ,
|
||||||
|
int metaData
|
||||||
|
) {}
|
||||||
|
|
||||||
}
|
public void onEntityCollidedWithArray(
|
||||||
|
World world,
|
||||||
|
int eventX,
|
||||||
|
int eventY,
|
||||||
|
int eventZ,
|
||||||
|
int arrayX,
|
||||||
|
int arrayY,
|
||||||
|
int arrayZ,
|
||||||
|
Entity entity
|
||||||
|
) {}
|
||||||
|
|
||||||
public void onArrayDestroyedByExplosion(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, Explosion explosion)
|
public void onArrayFallenUpon(
|
||||||
{
|
World world,
|
||||||
|
int eventX,
|
||||||
|
int eventY,
|
||||||
|
int eventZ,
|
||||||
|
int arrayX,
|
||||||
|
int arrayY,
|
||||||
|
int arrayZ,
|
||||||
|
Entity entity,
|
||||||
|
float fallDistance
|
||||||
|
) {}
|
||||||
|
|
||||||
}
|
public void onUpdate(World world, int arrayX, int arrayY, int arrayZ, int tickCount) {
|
||||||
|
|
||||||
public void onArrayDestroyedByPlayer(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, int metaData)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onEntityCollidedWithArray(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, Entity entity)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onArrayFallenUpon(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, Entity entity, float fallDistance)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onUpdate(World world, int arrayX, int arrayY, int arrayZ, int tickCount)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object object)
|
public boolean equals(Object object) {
|
||||||
{
|
if (object instanceof AlchemyArray) {
|
||||||
if (object instanceof AlchemyArray)
|
|
||||||
{
|
|
||||||
return this.compareTo((AlchemyArray) object) == 0;
|
return this.compareTo((AlchemyArray) object) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,22 +211,23 @@ public class AlchemyArray implements Comparable<AlchemyArray>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(AlchemyArray alchemyArray)
|
public int compareTo(AlchemyArray alchemyArray) {
|
||||||
{
|
if (this.texture.getResourceDomain().equalsIgnoreCase(
|
||||||
if (this.texture.getResourceDomain().equalsIgnoreCase(alchemyArray.getTexture().getResourceDomain()))
|
alchemyArray.getTexture().getResourceDomain()
|
||||||
{
|
)) {
|
||||||
if (this.texture.getResourcePath().equalsIgnoreCase(alchemyArray.getTexture().getResourcePath()))
|
if (this.texture.getResourcePath().equalsIgnoreCase(
|
||||||
{
|
alchemyArray.getTexture().getResourcePath()
|
||||||
|
)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
} else {
|
||||||
|
return this.texture.getResourcePath().compareToIgnoreCase(
|
||||||
|
alchemyArray.getTexture().getResourcePath()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
{
|
return this.texture.getResourceDomain().compareToIgnoreCase(
|
||||||
return this.texture.getResourcePath().compareToIgnoreCase(alchemyArray.getTexture().getResourcePath());
|
alchemyArray.getTexture().getResourceDomain()
|
||||||
}
|
);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return this.texture.getResourceDomain().compareToIgnoreCase(alchemyArray.getTexture().getResourceDomain());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,41 @@
|
||||||
package com.pahimar.ee3.api.array;
|
package com.pahimar.ee3.api.array;
|
||||||
|
|
||||||
|
import java.util.SortedSet;
|
||||||
|
|
||||||
import com.pahimar.ee3.EquivalentExchange3;
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
|
|
||||||
import java.util.SortedSet;
|
public class AlchemyArrayRegistryProxy {
|
||||||
|
|
||||||
public class AlchemyArrayRegistryProxy
|
|
||||||
{
|
|
||||||
@Mod.Instance("EE3")
|
@Mod.Instance("EE3")
|
||||||
private static Object ee3Mod;
|
private static Object ee3Mod;
|
||||||
|
|
||||||
public static boolean registerAlchemyArray(AlchemyArray alchemyArray)
|
public static boolean registerAlchemyArray(AlchemyArray alchemyArray) {
|
||||||
{
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null)
|
if (ee3Mod != null) {
|
||||||
{
|
return EE3Wrapper.ee3mod.getAlchemyArrayRegistry().registerAlchemyArray(
|
||||||
return EE3Wrapper.ee3mod.getAlchemyArrayRegistry().registerAlchemyArray(alchemyArray);
|
alchemyArray
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SortedSet<AlchemyArray> getRegisteredAlchemyArrays()
|
public static SortedSet<AlchemyArray> getRegisteredAlchemyArrays() {
|
||||||
{
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null)
|
if (ee3Mod != null) {
|
||||||
{
|
return EE3Wrapper.ee3mod.getAlchemyArrayRegistry().getRegisteredAlchemyArrays(
|
||||||
return EE3Wrapper.ee3mod.getAlchemyArrayRegistry().getRegisteredAlchemyArrays();
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EE3Wrapper
|
private static class EE3Wrapper { private static EquivalentExchange3 ee3mod; }
|
||||||
{
|
|
||||||
private static EquivalentExchange3 ee3mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void init()
|
private static void init() {
|
||||||
{
|
if (ee3Mod != null) {
|
||||||
if (ee3Mod != null)
|
|
||||||
{
|
|
||||||
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,16 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public interface ICustomAlchemyArrayRender
|
public interface ICustomAlchemyArrayRender {
|
||||||
{
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public abstract void doCustomRendering(TileEntity tileEntity, double x, double y, double z, int arraySize, ForgeDirection orientation, ForgeDirection rotation, float tick);
|
public abstract void doCustomRendering(
|
||||||
|
TileEntity tileEntity,
|
||||||
|
double x,
|
||||||
|
double y,
|
||||||
|
double z,
|
||||||
|
int arraySize,
|
||||||
|
ForgeDirection orientation,
|
||||||
|
ForgeDirection rotation,
|
||||||
|
float tick
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|array") package com.pahimar.ee3.api.array;
|
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|array")
|
||||||
|
package com.pahimar.ee3.api.array;
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
|
@ -1,13 +1,12 @@
|
||||||
package com.pahimar.ee3.api.blacklist;
|
package com.pahimar.ee3.api.blacklist;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.pahimar.ee3.EquivalentExchange3;
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
import com.pahimar.ee3.exchange.WrappedStack;
|
import com.pahimar.ee3.exchange.WrappedStack;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class BlacklistRegistryProxy {
|
public class BlacklistRegistryProxy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Finis JavaDoc
|
* TODO Finis JavaDoc
|
||||||
*
|
*
|
||||||
|
@ -33,14 +32,12 @@ public class BlacklistRegistryProxy {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Set<WrappedStack> getBlacklist(Blacklist blacklist) {
|
public static Set<WrappedStack> getBlacklist(Blacklist blacklist) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
if (blacklist == Blacklist.KNOWLEDGE) {
|
if (blacklist == Blacklist.KNOWLEDGE) {
|
||||||
return EE3Wrapper.ee3mod.getBlacklistRegistry().getKnowledgeBlacklist();
|
return EE3Wrapper.ee3mod.getBlacklistRegistry().getKnowledgeBlacklist();
|
||||||
}
|
} else if (blacklist == Blacklist.EXCHANGE) {
|
||||||
else if (blacklist == Blacklist.EXCHANGE) {
|
|
||||||
return EE3Wrapper.ee3mod.getBlacklistRegistry().getExchangeBlacklist();
|
return EE3Wrapper.ee3mod.getBlacklistRegistry().getExchangeBlacklist();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +52,6 @@ public class BlacklistRegistryProxy {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean isLearnable(Object object) {
|
public static boolean isLearnable(Object object) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
|
@ -72,7 +68,6 @@ public class BlacklistRegistryProxy {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean isExchangeable(Object object) {
|
public static boolean isExchangeable(Object object) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
|
@ -125,7 +120,6 @@ public class BlacklistRegistryProxy {
|
||||||
* @param blacklist
|
* @param blacklist
|
||||||
*/
|
*/
|
||||||
public static void addToBlacklist(Object object, Blacklist blacklist) {
|
public static void addToBlacklist(Object object, Blacklist blacklist) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
|
@ -140,30 +134,25 @@ public class BlacklistRegistryProxy {
|
||||||
* @param blacklist
|
* @param blacklist
|
||||||
*/
|
*/
|
||||||
public static void removeFromBlacklist(Object object, Blacklist blacklist) {
|
public static void removeFromBlacklist(Object object, Blacklist blacklist) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod.getBlacklistRegistry().removeFromBlacklist(object, blacklist);
|
EE3Wrapper.ee3mod.getBlacklistRegistry().removeFromBlacklist(
|
||||||
|
object, blacklist
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.Instance("EE3")
|
@Mod.Instance("EE3")
|
||||||
private static Object ee3Mod;
|
private static Object ee3Mod;
|
||||||
|
|
||||||
private static class EE3Wrapper {
|
private static class EE3Wrapper { private static EquivalentExchange3 ee3mod; }
|
||||||
private static EquivalentExchange3 ee3mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void init() {
|
private static void init() {
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
BlacklistRegistryProxy.EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
BlacklistRegistryProxy.EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Blacklist {
|
public enum Blacklist { KNOWLEDGE, EXCHANGE }
|
||||||
KNOWLEDGE,
|
|
||||||
EXCHANGE
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|blacklist") package com.pahimar.ee3.api.blacklist;
|
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|blacklist")
|
||||||
|
package com.pahimar.ee3.api.blacklist;
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
|
@ -7,7 +7,6 @@ import cpw.mods.fml.common.eventhandler.Event;
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class AbilityEvent extends Event {
|
public class AbilityEvent extends Event {
|
||||||
|
|
||||||
public final Object object;
|
public final Object object;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,52 +16,48 @@ public class AbilityEvent extends Event {
|
||||||
public AbilityEvent(Object object) {
|
public AbilityEvent(Object object) {
|
||||||
this.object = object;
|
this.object = object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelable()
|
public boolean isCancelable() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated See {@link com.pahimar.ee3.api.event.BlacklistEvent.KnowledgeWhitelistEvent}
|
* @deprecated See {@link
|
||||||
|
* com.pahimar.ee3.api.event.BlacklistEvent.KnowledgeWhitelistEvent}
|
||||||
*/
|
*/
|
||||||
public static class SetLearnableEvent extends AbilityEvent
|
public static class SetLearnableEvent extends AbilityEvent {
|
||||||
{
|
public SetLearnableEvent(Object object) {
|
||||||
public SetLearnableEvent(Object object)
|
|
||||||
{
|
|
||||||
super(object);
|
super(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated See {@link com.pahimar.ee3.api.event.BlacklistEvent.KnowledgeBlacklistEvent}
|
* @deprecated See {@link
|
||||||
|
* com.pahimar.ee3.api.event.BlacklistEvent.KnowledgeBlacklistEvent}
|
||||||
*/
|
*/
|
||||||
public static class SetNotLearnableEvent extends AbilityEvent
|
public static class SetNotLearnableEvent extends AbilityEvent {
|
||||||
{
|
public SetNotLearnableEvent(Object object) {
|
||||||
public SetNotLearnableEvent(Object object)
|
|
||||||
{
|
|
||||||
super(object);
|
super(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated See {@link com.pahimar.ee3.api.event.BlacklistEvent.ExchangeWhitelistEvent}
|
* @deprecated See {@link
|
||||||
|
* com.pahimar.ee3.api.event.BlacklistEvent.ExchangeWhitelistEvent}
|
||||||
*/
|
*/
|
||||||
public static class SetRecoverableEvent extends AbilityEvent
|
public static class SetRecoverableEvent extends AbilityEvent {
|
||||||
{
|
public SetRecoverableEvent(Object object) {
|
||||||
public SetRecoverableEvent(Object object)
|
|
||||||
{
|
|
||||||
super(object);
|
super(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated See {@link com.pahimar.ee3.api.event.BlacklistEvent.ExchangeBlacklistEvent}
|
* @deprecated See {@link
|
||||||
|
* com.pahimar.ee3.api.event.BlacklistEvent.ExchangeBlacklistEvent}
|
||||||
*/
|
*/
|
||||||
public static class SetNotRecoverableEvent extends AbilityEvent
|
public static class SetNotRecoverableEvent extends AbilityEvent {
|
||||||
{
|
public SetNotRecoverableEvent(Object object) {
|
||||||
public SetNotRecoverableEvent(Object object)
|
|
||||||
{
|
|
||||||
super(object);
|
super(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.pahimar.ee3.api.event;
|
||||||
import cpw.mods.fml.common.eventhandler.Event;
|
import cpw.mods.fml.common.eventhandler.Event;
|
||||||
|
|
||||||
public class BlacklistEvent extends Event {
|
public class BlacklistEvent extends Event {
|
||||||
|
|
||||||
public final Object object;
|
public final Object object;
|
||||||
|
|
||||||
public BlacklistEvent(Object object) {
|
public BlacklistEvent(Object object) {
|
||||||
|
@ -16,28 +15,24 @@ public class BlacklistEvent extends Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class KnowledgeBlacklistEvent extends BlacklistEvent {
|
public static class KnowledgeBlacklistEvent extends BlacklistEvent {
|
||||||
|
|
||||||
public KnowledgeBlacklistEvent(Object object) {
|
public KnowledgeBlacklistEvent(Object object) {
|
||||||
super(object);
|
super(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class KnowledgeWhitelistEvent extends BlacklistEvent {
|
public static class KnowledgeWhitelistEvent extends BlacklistEvent {
|
||||||
|
|
||||||
public KnowledgeWhitelistEvent(Object object) {
|
public KnowledgeWhitelistEvent(Object object) {
|
||||||
super(object);
|
super(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ExchangeBlacklistEvent extends BlacklistEvent {
|
public static class ExchangeBlacklistEvent extends BlacklistEvent {
|
||||||
|
|
||||||
public ExchangeBlacklistEvent(Object object) {
|
public ExchangeBlacklistEvent(Object object) {
|
||||||
super(object);
|
super(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ExchangeWhitelistEvent extends BlacklistEvent {
|
public static class ExchangeWhitelistEvent extends BlacklistEvent {
|
||||||
|
|
||||||
public ExchangeWhitelistEvent(Object object) {
|
public ExchangeWhitelistEvent(Object object) {
|
||||||
super(object);
|
super(object);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,10 @@ import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy;
|
||||||
import cpw.mods.fml.common.eventhandler.Event;
|
import cpw.mods.fml.common.eventhandler.Event;
|
||||||
|
|
||||||
public class EnergyValueEvent extends Event {
|
public class EnergyValueEvent extends Event {
|
||||||
|
|
||||||
public final Object object;
|
public final Object object;
|
||||||
public final EnergyValueRegistryProxy.Phase phase;
|
public final EnergyValueRegistryProxy.Phase phase;
|
||||||
|
|
||||||
public EnergyValueEvent(Object object, EnergyValueRegistryProxy.Phase phase) {
|
public EnergyValueEvent(Object object, EnergyValueRegistryProxy.Phase phase) {
|
||||||
|
|
||||||
this.object = object;
|
this.object = object;
|
||||||
this.phase = phase;
|
this.phase = phase;
|
||||||
}
|
}
|
||||||
|
@ -21,19 +19,22 @@ public class EnergyValueEvent extends Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SetEnergyValueEvent extends EnergyValueEvent {
|
public static class SetEnergyValueEvent extends EnergyValueEvent {
|
||||||
|
|
||||||
public final EnergyValue newEnergyValue;
|
public final EnergyValue newEnergyValue;
|
||||||
|
|
||||||
public SetEnergyValueEvent(Object object, EnergyValue newEnergyValue, EnergyValueRegistryProxy.Phase phase) {
|
public SetEnergyValueEvent(
|
||||||
|
Object object,
|
||||||
|
EnergyValue newEnergyValue,
|
||||||
|
EnergyValueRegistryProxy.Phase phase
|
||||||
|
) {
|
||||||
super(object, phase);
|
super(object, phase);
|
||||||
this.newEnergyValue = newEnergyValue;
|
this.newEnergyValue = newEnergyValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class RemoveEnergyValueEvent extends EnergyValueEvent {
|
public static class RemoveEnergyValueEvent extends EnergyValueEvent {
|
||||||
|
public RemoveEnergyValueEvent(
|
||||||
public RemoveEnergyValueEvent(Object object, EnergyValueRegistryProxy.Phase phase) {
|
Object object, EnergyValueRegistryProxy.Phase phase
|
||||||
|
) {
|
||||||
super(object, phase);
|
super(object, phase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,19 +3,16 @@ package com.pahimar.ee3.api.event;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraftforge.event.entity.EntityEvent;
|
import net.minecraftforge.event.entity.EntityEvent;
|
||||||
|
|
||||||
public class EntityTransmutationEvent extends EntityEvent
|
public class EntityTransmutationEvent extends EntityEvent {
|
||||||
{
|
|
||||||
public final Entity newEntity;
|
public final Entity newEntity;
|
||||||
|
|
||||||
public EntityTransmutationEvent(Entity originalEntity, Entity newEntity)
|
public EntityTransmutationEvent(Entity originalEntity, Entity newEntity) {
|
||||||
{
|
|
||||||
super(originalEntity);
|
super(originalEntity);
|
||||||
this.newEntity = newEntity;
|
this.newEntity = newEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelable()
|
public boolean isCancelable() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,74 +1,63 @@
|
||||||
package com.pahimar.ee3.api.event;
|
package com.pahimar.ee3.api.event;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import cpw.mods.fml.common.eventhandler.Event;
|
import cpw.mods.fml.common.eventhandler.Event;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import java.util.UUID;
|
public class PlayerKnowledgeEvent extends Event {
|
||||||
|
|
||||||
public class PlayerKnowledgeEvent extends Event
|
|
||||||
{
|
|
||||||
public final UUID playerUUID;
|
public final UUID playerUUID;
|
||||||
|
|
||||||
private PlayerKnowledgeEvent(EntityPlayer entityPlayer)
|
private PlayerKnowledgeEvent(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
this(entityPlayer.getUniqueID());
|
this(entityPlayer.getUniqueID());
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayerKnowledgeEvent(UUID playerUUID)
|
private PlayerKnowledgeEvent(UUID playerUUID) {
|
||||||
{
|
|
||||||
this.playerUUID = playerUUID;
|
this.playerUUID = playerUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelable()
|
public boolean isCancelable() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PlayerLearnKnowledgeEvent extends PlayerKnowledgeEvent
|
public static class PlayerLearnKnowledgeEvent extends PlayerKnowledgeEvent {
|
||||||
{
|
|
||||||
public final ItemStack itemStack;
|
public final ItemStack itemStack;
|
||||||
|
|
||||||
public PlayerLearnKnowledgeEvent(EntityPlayer entityPlayer, ItemStack itemStack)
|
public PlayerLearnKnowledgeEvent(EntityPlayer entityPlayer, ItemStack itemStack) {
|
||||||
{
|
|
||||||
super(entityPlayer);
|
super(entityPlayer);
|
||||||
this.itemStack = itemStack;
|
this.itemStack = itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerLearnKnowledgeEvent(UUID playerUUID, ItemStack itemStack)
|
public PlayerLearnKnowledgeEvent(UUID playerUUID, ItemStack itemStack) {
|
||||||
{
|
|
||||||
super(playerUUID);
|
super(playerUUID);
|
||||||
this.itemStack = itemStack;
|
this.itemStack = itemStack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PlayerForgetKnowledgeEvent extends PlayerKnowledgeEvent
|
public static class PlayerForgetKnowledgeEvent extends PlayerKnowledgeEvent {
|
||||||
{
|
|
||||||
public final ItemStack itemStack;
|
public final ItemStack itemStack;
|
||||||
|
|
||||||
public PlayerForgetKnowledgeEvent(EntityPlayer entityPlayer, ItemStack itemStack)
|
public PlayerForgetKnowledgeEvent(
|
||||||
{
|
EntityPlayer entityPlayer, ItemStack itemStack
|
||||||
|
) {
|
||||||
super(entityPlayer);
|
super(entityPlayer);
|
||||||
this.itemStack = itemStack;
|
this.itemStack = itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerForgetKnowledgeEvent(UUID playerUUID, ItemStack itemStack)
|
public PlayerForgetKnowledgeEvent(UUID playerUUID, ItemStack itemStack) {
|
||||||
{
|
|
||||||
super(playerUUID);
|
super(playerUUID);
|
||||||
this.itemStack = itemStack;
|
this.itemStack = itemStack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PlayerForgetAllKnowledgeEvent extends PlayerKnowledgeEvent
|
public static class PlayerForgetAllKnowledgeEvent extends PlayerKnowledgeEvent {
|
||||||
{
|
public PlayerForgetAllKnowledgeEvent(EntityPlayer entityPlayer) {
|
||||||
public PlayerForgetAllKnowledgeEvent(EntityPlayer entityPlayer)
|
|
||||||
{
|
|
||||||
super(entityPlayer);
|
super(entityPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerForgetAllKnowledgeEvent(UUID playerUUID)
|
public PlayerForgetAllKnowledgeEvent(UUID playerUUID) {
|
||||||
{
|
|
||||||
super(playerUUID);
|
super(playerUUID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,16 @@ import cpw.mods.fml.common.eventhandler.Event;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class TabletTransmutationEvent extends Event
|
public class TabletTransmutationEvent extends Event {
|
||||||
{
|
|
||||||
public final EntityPlayer entityPlayer;
|
public final EntityPlayer entityPlayer;
|
||||||
public final int x;
|
public final int x;
|
||||||
public final int y;
|
public final int y;
|
||||||
public final int z;
|
public final int z;
|
||||||
public final ItemStack itemStack;
|
public final ItemStack itemStack;
|
||||||
|
|
||||||
public TabletTransmutationEvent(EntityPlayer entityPlayer, int x, int y, int z, ItemStack itemStack)
|
public TabletTransmutationEvent(
|
||||||
{
|
EntityPlayer entityPlayer, int x, int y, int z, ItemStack itemStack
|
||||||
|
) {
|
||||||
this.entityPlayer = entityPlayer;
|
this.entityPlayer = entityPlayer;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
|
@ -22,8 +22,7 @@ public class TabletTransmutationEvent extends Event
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelable()
|
public boolean isCancelable() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,38 +3,29 @@ package com.pahimar.ee3.api.event;
|
||||||
import cpw.mods.fml.common.eventhandler.Event;
|
import cpw.mods.fml.common.eventhandler.Event;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class TemplateKnowledgeEvent extends Event
|
public class TemplateKnowledgeEvent extends Event {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelable()
|
public boolean isCancelable() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TemplateLearnKnowledgeEvent extends TemplateKnowledgeEvent
|
public static class TemplateLearnKnowledgeEvent extends TemplateKnowledgeEvent {
|
||||||
{
|
|
||||||
public final ItemStack itemStack;
|
public final ItemStack itemStack;
|
||||||
|
|
||||||
public TemplateLearnKnowledgeEvent(ItemStack itemStack)
|
public TemplateLearnKnowledgeEvent(ItemStack itemStack) {
|
||||||
{
|
|
||||||
this.itemStack = itemStack;
|
this.itemStack = itemStack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TemplateForgetKnowledgeEvent extends TemplateKnowledgeEvent
|
public static class TemplateForgetKnowledgeEvent extends TemplateKnowledgeEvent {
|
||||||
{
|
|
||||||
public final ItemStack itemStack;
|
public final ItemStack itemStack;
|
||||||
|
|
||||||
public TemplateForgetKnowledgeEvent(ItemStack itemStack)
|
public TemplateForgetKnowledgeEvent(ItemStack itemStack) {
|
||||||
{
|
|
||||||
this.itemStack = itemStack;
|
this.itemStack = itemStack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TemplateForgetAllKnowledgeEvent extends TemplateKnowledgeEvent
|
public static class TemplateForgetAllKnowledgeEvent extends TemplateKnowledgeEvent {
|
||||||
{
|
public TemplateForgetAllKnowledgeEvent() {}
|
||||||
public TemplateForgetAllKnowledgeEvent()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,21 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
|
|
||||||
public class WorldTransmutationEvent extends BlockEvent
|
public class WorldTransmutationEvent extends BlockEvent {
|
||||||
{
|
|
||||||
public final ForgeDirection sideHit;
|
public final ForgeDirection sideHit;
|
||||||
public final EntityPlayer player;
|
public final EntityPlayer player;
|
||||||
public final ItemStack heldItemStack;
|
public final ItemStack heldItemStack;
|
||||||
|
|
||||||
public WorldTransmutationEvent(int x, int y, int z, World world, Block block, int blockMetaData, ForgeDirection sideHit, EntityPlayer entityLiving)
|
public WorldTransmutationEvent(
|
||||||
{
|
int x,
|
||||||
|
int y,
|
||||||
|
int z,
|
||||||
|
World world,
|
||||||
|
Block block,
|
||||||
|
int blockMetaData,
|
||||||
|
ForgeDirection sideHit,
|
||||||
|
EntityPlayer entityLiving
|
||||||
|
) {
|
||||||
super(x, y, z, world, block, blockMetaData);
|
super(x, y, z, world, block, blockMetaData);
|
||||||
this.sideHit = sideHit;
|
this.sideHit = sideHit;
|
||||||
this.player = entityLiving;
|
this.player = entityLiving;
|
||||||
|
@ -22,8 +29,7 @@ public class WorldTransmutationEvent extends BlockEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelable()
|
public boolean isCancelable() {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|event") package com.pahimar.ee3.api.event;
|
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|event")
|
||||||
|
package com.pahimar.ee3.api.event;
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
|
@ -1,19 +1,18 @@
|
||||||
package com.pahimar.ee3.api.exchange;
|
package com.pahimar.ee3.api.exchange;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
import net.minecraft.util.IChatComponent;
|
import net.minecraft.util.IChatComponent;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
|
|
||||||
public final class EnergyValue implements Comparable<EnergyValue> {
|
public final class EnergyValue implements Comparable<EnergyValue> {
|
||||||
|
private static final DecimalFormat DECIMAL_FORMAT
|
||||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("###,###,###,###,###.###");
|
= new DecimalFormat("###,###,###,###,###.###");
|
||||||
private float energyValue;
|
private float energyValue;
|
||||||
|
|
||||||
public EnergyValue()
|
public EnergyValue() {
|
||||||
{
|
|
||||||
this(0);
|
this(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,11 +40,9 @@ public final class EnergyValue implements Comparable<EnergyValue> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(EnergyValue energyValue) {
|
public int compareTo(EnergyValue energyValue) {
|
||||||
|
|
||||||
if (energyValue != null) {
|
if (energyValue != null) {
|
||||||
return Float.compare(this.energyValue, energyValue.getValue());
|
return Float.compare(this.energyValue, energyValue.getValue());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,21 +53,18 @@ public final class EnergyValue implements Comparable<EnergyValue> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
||||||
|
|
||||||
if (nbtTagCompound.hasKey("energyValue")) {
|
if (nbtTagCompound.hasKey("energyValue")) {
|
||||||
this.energyValue = nbtTagCompound.getFloat("energyValue");
|
this.energyValue = nbtTagCompound.getFloat("energyValue");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NBTTagCompound writeEnergyValueToNBT(EnergyValue energyValue) {
|
public static NBTTagCompound writeEnergyValueToNBT(EnergyValue energyValue) {
|
||||||
|
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
energyValue.writeToNBT(nbtTagCompound);
|
energyValue.writeToNBT(nbtTagCompound);
|
||||||
return nbtTagCompound;
|
return nbtTagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnergyValue loadEnergyValueFromNBT(NBTTagCompound nbtTagCompound) {
|
public static EnergyValue loadEnergyValueFromNBT(NBTTagCompound nbtTagCompound) {
|
||||||
|
|
||||||
if (nbtTagCompound.hasKey("energyValue")) {
|
if (nbtTagCompound.hasKey("energyValue")) {
|
||||||
float energyValue = nbtTagCompound.getFloat("energyValue");
|
float energyValue = nbtTagCompound.getFloat("energyValue");
|
||||||
return new EnergyValue(energyValue);
|
return new EnergyValue(energyValue);
|
||||||
|
@ -80,11 +74,13 @@ public final class EnergyValue implements Comparable<EnergyValue> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnergyValue factor(EnergyValue energyValue, Number factor) {
|
public static EnergyValue factor(EnergyValue energyValue, Number factor) {
|
||||||
|
|
||||||
if ((Float.compare(factor.floatValue(), 0f) != 0) && (energyValue != null)) {
|
if ((Float.compare(factor.floatValue(), 0f) != 0) && (energyValue != null)) {
|
||||||
return new EnergyValue(new BigDecimal(energyValue.getValue() * 1f / factor.floatValue()).setScale(3, BigDecimal.ROUND_HALF_EVEN).floatValue());
|
return new EnergyValue(
|
||||||
}
|
new BigDecimal(energyValue.getValue() * 1f / factor.floatValue())
|
||||||
else {
|
.setScale(3, BigDecimal.ROUND_HALF_EVEN)
|
||||||
|
.floatValue()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,19 @@
|
||||||
package com.pahimar.ee3.api.exchange;
|
package com.pahimar.ee3.api.exchange;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import com.pahimar.ee3.EquivalentExchange3;
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
|
|
||||||
import java.io.File;
|
public class EnergyValueMappingsTester {
|
||||||
|
public static void runTest(File file) {
|
||||||
public class EnergyValueMappingsTester
|
|
||||||
{
|
|
||||||
public static void runTest(File file)
|
|
||||||
{
|
|
||||||
runTest(file, false);
|
runTest(file, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void runTest(File file, boolean strict)
|
public static void runTest(File file, boolean strict) {
|
||||||
{
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null)
|
if (ee3Mod != null) {
|
||||||
{
|
|
||||||
EE3Wrapper.ee3mod.runEnergyValueTestSuite(file, strict);
|
EE3Wrapper.ee3mod.runEnergyValueTestSuite(file, strict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,15 +21,10 @@ public class EnergyValueMappingsTester
|
||||||
@Mod.Instance("EE3")
|
@Mod.Instance("EE3")
|
||||||
private static Object ee3Mod;
|
private static Object ee3Mod;
|
||||||
|
|
||||||
private static class EE3Wrapper
|
private static class EE3Wrapper { private static EquivalentExchange3 ee3mod; }
|
||||||
{
|
|
||||||
private static EquivalentExchange3 ee3mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void init()
|
private static void init() {
|
||||||
{
|
if (ee3Mod != null) {
|
||||||
if (ee3Mod != null)
|
|
||||||
{
|
|
||||||
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
package com.pahimar.ee3.api.exchange;
|
package com.pahimar.ee3.api.exchange;
|
||||||
|
|
||||||
import com.pahimar.ee3.EquivalentExchange3;
|
|
||||||
import com.pahimar.ee3.exchange.WrappedStack;
|
|
||||||
import cpw.mods.fml.common.Mod;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public final class EnergyValueRegistryProxy {
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
|
import com.pahimar.ee3.exchange.WrappedStack;
|
||||||
|
import cpw.mods.fml.common.Mod;
|
||||||
|
|
||||||
|
public final class EnergyValueRegistryProxy {
|
||||||
@Mod.Instance("EE3")
|
@Mod.Instance("EE3")
|
||||||
private static Object ee3Mod;
|
private static Object ee3Mod;
|
||||||
|
|
||||||
|
@ -34,17 +33,17 @@ public final class EnergyValueRegistryProxy {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasEnergyValue(Object object)
|
public static boolean hasEnergyValue(Object object) {
|
||||||
{
|
|
||||||
return hasEnergyValue(object, false);
|
return hasEnergyValue(object, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasEnergyValue(Object object, boolean strict) {
|
public static boolean hasEnergyValue(Object object, boolean strict) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
return EE3Wrapper.ee3mod.getEnergyValueRegistry().hasEnergyValue(object, strict);
|
return EE3Wrapper.ee3mod.getEnergyValueRegistry().hasEnergyValue(
|
||||||
|
object, strict
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -55,11 +54,12 @@ public final class EnergyValueRegistryProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnergyValue getEnergyValue(Object object, boolean strict) {
|
public static EnergyValue getEnergyValue(Object object, boolean strict) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getEnergyValue(object, strict);
|
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getEnergyValue(
|
||||||
|
object, strict
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -70,11 +70,12 @@ public final class EnergyValueRegistryProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnergyValue getEnergyValueForStack(Object object, boolean strict) {
|
public static EnergyValue getEnergyValueForStack(Object object, boolean strict) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getEnergyValueForStack(object, strict);
|
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getEnergyValueForStack(
|
||||||
|
object, strict
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -87,11 +88,12 @@ public final class EnergyValueRegistryProxy {
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static List getStacksInRange(EnergyValue start, EnergyValue finish) {
|
public static List getStacksInRange(EnergyValue start, EnergyValue finish) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
return new ArrayList<>(EE3Wrapper.ee3mod.getEnergyValueRegistry().getStacksInRange(start, finish));
|
return new ArrayList<>(
|
||||||
|
EE3Wrapper.ee3mod.getEnergyValueRegistry().getStacksInRange(start, finish)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Collections.EMPTY_LIST;
|
return Collections.EMPTY_LIST;
|
||||||
|
@ -137,7 +139,8 @@ public final class EnergyValueRegistryProxy {
|
||||||
* @param energyValue
|
* @param energyValue
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addPreCalculationEnergyValue(Object object, EnergyValue energyValue) {
|
public static void
|
||||||
|
addPreCalculationEnergyValue(Object object, EnergyValue energyValue) {
|
||||||
setEnergyValue(object, energyValue, Phase.PRE_CALCULATION);
|
setEnergyValue(object, energyValue, Phase.PRE_CALCULATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +162,8 @@ public final class EnergyValueRegistryProxy {
|
||||||
* @param energyValue
|
* @param energyValue
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addPostAssignedEnergyValue(Object object, EnergyValue energyValue) {
|
public static void
|
||||||
|
addPostAssignedEnergyValue(Object object, EnergyValue energyValue) {
|
||||||
setEnergyValue(object, energyValue);
|
setEnergyValue(object, energyValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +185,8 @@ public final class EnergyValueRegistryProxy {
|
||||||
* @param energyValue
|
* @param energyValue
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addPostCalculationEnergyValue(Object object, EnergyValue energyValue) {
|
public static void
|
||||||
|
addPostCalculationEnergyValue(Object object, EnergyValue energyValue) {
|
||||||
setEnergyValue(object, energyValue);
|
setEnergyValue(object, energyValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,25 +199,23 @@ public final class EnergyValueRegistryProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setEnergyValue(Object object, Number energyValue, Phase phase) {
|
public static void setEnergyValue(Object object, Number energyValue, Phase phase) {
|
||||||
|
|
||||||
setEnergyValue(object, new EnergyValue(energyValue), phase);
|
setEnergyValue(object, new EnergyValue(energyValue), phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setEnergyValue(Object object, EnergyValue energyValue, Phase phase) {
|
public static void
|
||||||
|
setEnergyValue(Object object, EnergyValue energyValue, Phase phase) {
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod.getEnergyValueRegistry().setEnergyValue(object, energyValue, phase);
|
EE3Wrapper.ee3mod.getEnergyValueRegistry().setEnergyValue(
|
||||||
|
object, energyValue, phase
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EE3Wrapper {
|
private static class EE3Wrapper { private static EquivalentExchange3 ee3mod; }
|
||||||
private static EquivalentExchange3 ee3mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void init() {
|
private static void init() {
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,5 @@ package com.pahimar.ee3.api.exchange;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public interface IEnergyValueProvider {
|
public interface IEnergyValueProvider {
|
||||||
|
|
||||||
EnergyValue getEnergyValue(ItemStack itemStack);
|
EnergyValue getEnergyValue(ItemStack itemStack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,9 @@ package com.pahimar.ee3.api.exchange;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy.Phase;
|
import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy.Phase;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public interface IEnergyValueRegistry {
|
public interface IEnergyValueRegistry {
|
||||||
|
|
||||||
boolean hasEnergyValue(Object object, boolean strict);
|
boolean hasEnergyValue(Object object, boolean strict);
|
||||||
|
|
||||||
EnergyValue getEnergyValue(Object object, boolean strict);
|
EnergyValue getEnergyValue(Object object, boolean strict);
|
||||||
|
@ -17,5 +15,4 @@ public interface IEnergyValueRegistry {
|
||||||
Set<ItemStack> getStacksInRange(EnergyValue start, EnergyValue finish);
|
Set<ItemStack> getStacksInRange(EnergyValue start, EnergyValue finish);
|
||||||
|
|
||||||
void setEnergyValue(Object object, EnergyValue energyValue, Phase phase);
|
void setEnergyValue(Object object, EnergyValue energyValue, Phase phase);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,10 @@ package com.pahimar.ee3.api.exchange;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.pahimar.ee3.knowledge.PlayerKnowledge;
|
import com.pahimar.ee3.knowledge.PlayerKnowledge;
|
||||||
|
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public interface ITransmutationContainer extends IInventory {
|
public interface ITransmutationContainer extends IInventory {
|
||||||
|
|
||||||
int getXCoord();
|
int getXCoord();
|
||||||
|
|
||||||
int getYCoord();
|
int getYCoord();
|
||||||
|
@ -24,5 +22,4 @@ public interface ITransmutationContainer extends IInventory {
|
||||||
void updateEnergyValueFromInventory();
|
void updateEnergyValueFromInventory();
|
||||||
|
|
||||||
void handlePlayerKnowledgeUpdate(PlayerKnowledge playerKnowledge);
|
void handlePlayerKnowledgeUpdate(PlayerKnowledge playerKnowledge);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public final class RecipeRegistryProxy {
|
public final class RecipeRegistryProxy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
|
@ -18,7 +17,9 @@ public final class RecipeRegistryProxy {
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addRecipe(Object recipeOutput, List<?> recipeInputList) {
|
public static void addRecipe(Object recipeOutput, List<?> recipeInputList) {
|
||||||
com.pahimar.ee3.api.recipe.RecipeRegistryProxy.addRecipe(recipeOutput, recipeInputList);
|
com.pahimar.ee3.api.recipe.RecipeRegistryProxy.addRecipe(
|
||||||
|
recipeOutput, recipeInputList
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|exchange") package com.pahimar.ee3.api.exchange;
|
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|exchange")
|
||||||
|
package com.pahimar.ee3.api.exchange;
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
|
@ -4,7 +4,6 @@ import com.pahimar.ee3.api.blacklist.BlacklistRegistryProxy;
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public final class AbilityRegistryProxy {
|
public final class AbilityRegistryProxy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated See {@link BlacklistRegistryProxy#isLearnable(Object)}
|
* @deprecated See {@link BlacklistRegistryProxy#isLearnable(Object)}
|
||||||
*/
|
*/
|
||||||
|
@ -61,9 +60,5 @@ public final class AbilityRegistryProxy {
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Abilities {
|
public enum Abilities { NOT_LEARNABLE, NOT_RECOVERABLE, ALL }
|
||||||
NOT_LEARNABLE,
|
|
||||||
NOT_RECOVERABLE,
|
|
||||||
ALL
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
package com.pahimar.ee3.api.knowledge;
|
package com.pahimar.ee3.api.knowledge;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.pahimar.ee3.EquivalentExchange3;
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class PlayerKnowledgeRegistryProxy {
|
public class PlayerKnowledgeRegistryProxy {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Finish JavaDoc
|
* TODO Finish JavaDoc
|
||||||
*
|
*
|
||||||
|
@ -19,11 +18,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean doesPlayerKnow(EntityPlayer entityPlayer, Object object) {
|
public static boolean doesPlayerKnow(EntityPlayer entityPlayer, Object object) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
return EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().doesPlayerKnow(entityPlayer, object);
|
return EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().doesPlayerKnow(
|
||||||
|
entityPlayer, object
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -37,11 +37,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean doesPlayerKnow(String playerName, Object object) {
|
public static boolean doesPlayerKnow(String playerName, Object object) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
return EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().doesPlayerKnow(playerName, object);
|
return EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().doesPlayerKnow(
|
||||||
|
playerName, object
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -55,11 +56,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean canPlayerLearn(EntityPlayer entityPlayer, Object object) {
|
public static boolean canPlayerLearn(EntityPlayer entityPlayer, Object object) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
return EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().canPlayerLearn(entityPlayer, object);
|
return EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().canPlayerLearn(
|
||||||
|
entityPlayer, object
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -73,11 +75,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean canPlayerLearn(String playerName, Object object) {
|
public static boolean canPlayerLearn(String playerName, Object object) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
return EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().canPlayerLearn(playerName, object);
|
return EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().canPlayerLearn(
|
||||||
|
playerName, object
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -90,11 +93,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Set<ItemStack> getKnownItemStacks(EntityPlayer entityPlayer) {
|
public static Set<ItemStack> getKnownItemStacks(EntityPlayer entityPlayer) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
return EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().getKnownItemStacks(entityPlayer);
|
return EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().getKnownItemStacks(
|
||||||
|
entityPlayer
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Collections.EMPTY_SET;
|
return Collections.EMPTY_SET;
|
||||||
|
@ -107,11 +111,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static Set<ItemStack> getKnownItemStacks(String playerName) {
|
public static Set<ItemStack> getKnownItemStacks(String playerName) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
return EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().getKnownItemStacks(playerName);
|
return EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().getKnownItemStacks(
|
||||||
|
playerName
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Collections.EMPTY_SET;
|
return Collections.EMPTY_SET;
|
||||||
|
@ -124,11 +129,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @param object
|
* @param object
|
||||||
*/
|
*/
|
||||||
public static void teachPlayer(EntityPlayer entityPlayer, Object object) {
|
public static void teachPlayer(EntityPlayer entityPlayer, Object object) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().teachPlayer(entityPlayer, object);
|
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().teachPlayer(
|
||||||
|
entityPlayer, object
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,11 +145,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @param object
|
* @param object
|
||||||
*/
|
*/
|
||||||
public static void teachPlayer(String playerName, Object object) {
|
public static void teachPlayer(String playerName, Object object) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().teachPlayer(playerName, object);
|
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().teachPlayer(
|
||||||
|
playerName, object
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,11 +161,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @param objects
|
* @param objects
|
||||||
*/
|
*/
|
||||||
public static void teachPlayer(EntityPlayer entityPlayer, Collection<?> objects) {
|
public static void teachPlayer(EntityPlayer entityPlayer, Collection<?> objects) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().teachPlayer(entityPlayer, objects);
|
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().teachPlayer(
|
||||||
|
entityPlayer, objects
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,11 +177,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @param objects
|
* @param objects
|
||||||
*/
|
*/
|
||||||
public static void teachPlayer(String playerName, Collection<?> objects) {
|
public static void teachPlayer(String playerName, Collection<?> objects) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().teachPlayer(playerName, objects);
|
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().teachPlayer(
|
||||||
|
playerName, objects
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,11 +193,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @param object
|
* @param object
|
||||||
*/
|
*/
|
||||||
public static void makePlayerForget(EntityPlayer entityPlayer, Object object) {
|
public static void makePlayerForget(EntityPlayer entityPlayer, Object object) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().makePlayerForget(entityPlayer, object);
|
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().makePlayerForget(
|
||||||
|
entityPlayer, object
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,11 +209,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @param object
|
* @param object
|
||||||
*/
|
*/
|
||||||
public static void makePlayerForget(String playerName, Object object) {
|
public static void makePlayerForget(String playerName, Object object) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().makePlayerForget(playerName, object);
|
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().makePlayerForget(
|
||||||
|
playerName, object
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,12 +224,14 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @param entityPlayer
|
* @param entityPlayer
|
||||||
* @param objects
|
* @param objects
|
||||||
*/
|
*/
|
||||||
public static void makePlayerForget(EntityPlayer entityPlayer, Collection<?> objects) {
|
public static void
|
||||||
|
makePlayerForget(EntityPlayer entityPlayer, Collection<?> objects) {
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().makePlayerForget(entityPlayer, objects);
|
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().makePlayerForget(
|
||||||
|
entityPlayer, objects
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,11 +242,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @param objects
|
* @param objects
|
||||||
*/
|
*/
|
||||||
public static void makePlayerForget(String playerName, Collection<?> objects) {
|
public static void makePlayerForget(String playerName, Collection<?> objects) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().makePlayerForget(playerName, objects);
|
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().makePlayerForget(
|
||||||
|
playerName, objects
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,11 +257,12 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @param entityPlayer
|
* @param entityPlayer
|
||||||
*/
|
*/
|
||||||
public static void makePlayerForgetAll(EntityPlayer entityPlayer) {
|
public static void makePlayerForgetAll(EntityPlayer entityPlayer) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().makePlayerForgetAll(entityPlayer);
|
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().makePlayerForgetAll(
|
||||||
|
entityPlayer
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,23 +272,20 @@ public class PlayerKnowledgeRegistryProxy {
|
||||||
* @param playerName
|
* @param playerName
|
||||||
*/
|
*/
|
||||||
public static void makePlayerForgetAll(String playerName) {
|
public static void makePlayerForgetAll(String playerName) {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().makePlayerForgetAll(playerName);
|
EE3Wrapper.ee3mod.getPlayerKnowledgeRegistry().makePlayerForgetAll(playerName
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.Instance("EE3")
|
@Mod.Instance("EE3")
|
||||||
private static Object ee3Mod;
|
private static Object ee3Mod;
|
||||||
|
|
||||||
private static class EE3Wrapper {
|
private static class EE3Wrapper { private static EquivalentExchange3 ee3mod; }
|
||||||
private static EquivalentExchange3 ee3mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void init() {
|
private static void init() {
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
PlayerKnowledgeRegistryProxy.EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
PlayerKnowledgeRegistryProxy.EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
package com.pahimar.ee3.api.knowledge;
|
package com.pahimar.ee3.api.knowledge;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated as of API 0.4.0; use {@link PlayerKnowledgeRegistryProxy} instead
|
* @deprecated as of API 0.4.0; use {@link PlayerKnowledgeRegistryProxy} instead
|
||||||
* @see PlayerKnowledgeRegistryProxy
|
* @see PlayerKnowledgeRegistryProxy
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public class TransmutationKnowledgeRegistryProxy {
|
public class TransmutationKnowledgeRegistryProxy {
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static boolean doesPlayerKnow(EntityPlayer entityPlayer, ItemStack itemStack) {
|
public static boolean doesPlayerKnow(EntityPlayer entityPlayer, ItemStack itemStack) {
|
||||||
return PlayerKnowledgeRegistryProxy.doesPlayerKnow(entityPlayer, itemStack);
|
return PlayerKnowledgeRegistryProxy.doesPlayerKnow(entityPlayer, itemStack);
|
||||||
|
@ -45,22 +44,28 @@ public class TransmutationKnowledgeRegistryProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static Set<ItemStack> getPlayerKnownTransmutationsFilteredStartsWith(EntityPlayer entityPlayer, String filterString) {
|
public static Set<ItemStack> getPlayerKnownTransmutationsFilteredStartsWith(
|
||||||
|
EntityPlayer entityPlayer, String filterString
|
||||||
|
) {
|
||||||
return PlayerKnowledgeRegistryProxy.getKnownItemStacks(entityPlayer);
|
return PlayerKnowledgeRegistryProxy.getKnownItemStacks(entityPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static Set<ItemStack> getPlayerKnownTransmutationsFilteredStartsWith(UUID playerUUID, String filterString) {
|
public static Set<ItemStack>
|
||||||
|
getPlayerKnownTransmutationsFilteredStartsWith(UUID playerUUID, String filterString) {
|
||||||
return Collections.EMPTY_SET;
|
return Collections.EMPTY_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static Set<ItemStack> getPlayerKnownTransmutationsFilteredContains(EntityPlayer entityPlayer, String filterString) {
|
public static Set<ItemStack> getPlayerKnownTransmutationsFilteredContains(
|
||||||
|
EntityPlayer entityPlayer, String filterString
|
||||||
|
) {
|
||||||
return PlayerKnowledgeRegistryProxy.getKnownItemStacks(entityPlayer);
|
return PlayerKnowledgeRegistryProxy.getKnownItemStacks(entityPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static Set<ItemStack> getPlayerKnownTransmutationsFilteredContains(UUID playerUUID, String filterString) {
|
public static Set<ItemStack>
|
||||||
|
getPlayerKnownTransmutationsFilteredContains(UUID playerUUID, String filterString) {
|
||||||
return Collections.EMPTY_SET;
|
return Collections.EMPTY_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,12 +110,14 @@ public class TransmutationKnowledgeRegistryProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static Set<ItemStack> getTemplateKnownTransmutationsFilteredStartsWith(String filterString) {
|
public static Set<ItemStack>
|
||||||
|
getTemplateKnownTransmutationsFilteredStartsWith(String filterString) {
|
||||||
return Collections.EMPTY_SET;
|
return Collections.EMPTY_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static Set<ItemStack> getTemplateKnownTransmutationsFilteredContains(String filterString) {
|
public static Set<ItemStack>
|
||||||
|
getTemplateKnownTransmutationsFilteredContains(String filterString) {
|
||||||
return Collections.EMPTY_SET;
|
return Collections.EMPTY_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|knowledge") package com.pahimar.ee3.api.knowledge;
|
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|knowledge")
|
||||||
|
package com.pahimar.ee3.api.knowledge;
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
|
@ -1,3 +1,4 @@
|
||||||
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|core") package com.pahimar.ee3.api;
|
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|core")
|
||||||
|
package com.pahimar.ee3.api;
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
|
@ -4,44 +4,40 @@ import com.pahimar.ee3.EquivalentExchange3;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
// TODO Clean this up and make it more nice for modders. Consider this very volatile for the time being
|
// TODO Clean this up and make it more nice for modders. Consider this very volatile for
|
||||||
public class AludelRecipeProxy
|
// the time being
|
||||||
{
|
public class AludelRecipeProxy {
|
||||||
@Mod.Instance("EE3")
|
@Mod.Instance("EE3")
|
||||||
private static Object ee3Mod;
|
private static Object ee3Mod;
|
||||||
|
|
||||||
public void addRecipe(ItemStack recipeOutput, ItemStack recipeInputStack, ItemStack recipeInputDust)
|
public void addRecipe(
|
||||||
{
|
ItemStack recipeOutput, ItemStack recipeInputStack, ItemStack recipeInputDust
|
||||||
|
) {
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null)
|
if (ee3Mod != null) {
|
||||||
{
|
EE3Wrapper.ee3mod.getAludelRecipeManager().addRecipe(
|
||||||
EE3Wrapper.ee3mod.getAludelRecipeManager().addRecipe(recipeOutput, recipeInputStack, recipeInputDust);
|
recipeOutput, recipeInputStack, recipeInputDust
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getResult(ItemStack recipeInputStack, ItemStack recipeInputDust)
|
public ItemStack getResult(ItemStack recipeInputStack, ItemStack recipeInputDust) {
|
||||||
{
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null)
|
if (ee3Mod != null) {
|
||||||
{
|
return EE3Wrapper.ee3mod.getAludelRecipeManager().getResult(
|
||||||
return EE3Wrapper.ee3mod.getAludelRecipeManager().getResult(recipeInputStack, recipeInputDust);
|
recipeInputStack, recipeInputDust
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class EE3Wrapper { private static EquivalentExchange3 ee3mod; }
|
||||||
|
|
||||||
private static class EE3Wrapper
|
private static void init() {
|
||||||
{
|
if (ee3Mod != null) {
|
||||||
private static EquivalentExchange3 ee3mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void init()
|
|
||||||
{
|
|
||||||
if (ee3Mod != null)
|
|
||||||
{
|
|
||||||
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,33 @@
|
||||||
package com.pahimar.ee3.api.recipe;
|
package com.pahimar.ee3.api.recipe;
|
||||||
|
|
||||||
import com.pahimar.ee3.EquivalentExchange3;
|
|
||||||
import cpw.mods.fml.common.Mod;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public final class RecipeRegistryProxy {
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
|
import cpw.mods.fml.common.Mod;
|
||||||
|
|
||||||
public static void addRecipe(Object recipeOutput, Object ... recipeInputs) { // TODO 1.9, List -> Collection
|
public final class RecipeRegistryProxy {
|
||||||
|
public static void addRecipe(
|
||||||
|
Object recipeOutput, Object... recipeInputs
|
||||||
|
) { // TODO 1.9, List -> Collection
|
||||||
addRecipe(recipeOutput, Arrays.asList(recipeInputs));
|
addRecipe(recipeOutput, Arrays.asList(recipeInputs));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addRecipe(Object recipeOutput, List<?> recipeInputList) { // TODO 1.9, List -> Collection
|
public static void addRecipe(
|
||||||
|
Object recipeOutput, List<?> recipeInputList
|
||||||
|
) { // TODO 1.9, List -> Collection
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
// NOOP if EquivalentExchange3 is not present
|
// NOOP if EquivalentExchange3 is not present
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod.getRecipeRegistry().addRecipe(recipeOutput, recipeInputList);
|
EE3Wrapper.ee3mod.getRecipeRegistry().addRecipe(
|
||||||
|
recipeOutput, recipeInputList
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dumpRecipeRegistryToLog() {
|
public static void dumpRecipeRegistryToLog() {
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
// NOOP if EquivalentExchange3 is not present
|
// NOOP if EquivalentExchange3 is not present
|
||||||
|
@ -35,12 +39,9 @@ public final class RecipeRegistryProxy {
|
||||||
@Mod.Instance("EE3")
|
@Mod.Instance("EE3")
|
||||||
private static Object ee3Mod;
|
private static Object ee3Mod;
|
||||||
|
|
||||||
private static class EE3Wrapper {
|
private static class EE3Wrapper { private static EquivalentExchange3 ee3mod; }
|
||||||
private static EquivalentExchange3 ee3mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void init() {
|
private static void init() {
|
||||||
|
|
||||||
if (ee3Mod != null) {
|
if (ee3Mod != null) {
|
||||||
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|recipe") package com.pahimar.ee3.api.recipe;
|
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|recipe")
|
||||||
|
package com.pahimar.ee3.api.recipe;
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
|
@ -1,98 +1,94 @@
|
||||||
package com.pahimar.ee3.api.util;
|
package com.pahimar.ee3.api.util;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.pahimar.ee3.EquivalentExchange3;
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.UUID;
|
public class TileEntityDataProxy {
|
||||||
|
|
||||||
public class TileEntityDataProxy
|
|
||||||
{
|
|
||||||
@Mod.Instance("EE3")
|
@Mod.Instance("EE3")
|
||||||
private static Object ee3Mod;
|
private static Object ee3Mod;
|
||||||
|
|
||||||
public static Class getTileEntityClass(World world, int xCoord, int yCoord, int zCoord)
|
public static Class
|
||||||
{
|
getTileEntityClass(World world, int xCoord, int yCoord, int zCoord) {
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null)
|
if (ee3Mod != null) {
|
||||||
{
|
return EE3Wrapper.ee3mod.getTileEntityDataHelper().getTileEntityClass(
|
||||||
return EE3Wrapper.ee3mod.getTileEntityDataHelper().getTileEntityClass(world, xCoord, yCoord, zCoord);
|
world, xCoord, yCoord, zCoord
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ForgeDirection getOrientation(World world, int xCoord, int yCoord, int zCoord)
|
public static ForgeDirection
|
||||||
{
|
getOrientation(World world, int xCoord, int yCoord, int zCoord) {
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null)
|
if (ee3Mod != null) {
|
||||||
{
|
return EE3Wrapper.ee3mod.getTileEntityDataHelper().getOrientation(
|
||||||
return EE3Wrapper.ee3mod.getTileEntityDataHelper().getOrientation(world, xCoord, yCoord, zCoord);
|
world, xCoord, yCoord, zCoord
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static short getState(World world, int xCoord, int yCoord, int zCoord)
|
public static short getState(World world, int xCoord, int yCoord, int zCoord) {
|
||||||
{
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null)
|
if (ee3Mod != null) {
|
||||||
{
|
return EE3Wrapper.ee3mod.getTileEntityDataHelper().getState(
|
||||||
return EE3Wrapper.ee3mod.getTileEntityDataHelper().getState(world, xCoord, yCoord, zCoord);
|
world, xCoord, yCoord, zCoord
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Short.MIN_VALUE;
|
return Short.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getCustomName(World world, int xCoord, int yCoord, int zCoord)
|
public static String getCustomName(World world, int xCoord, int yCoord, int zCoord) {
|
||||||
{
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null)
|
if (ee3Mod != null) {
|
||||||
{
|
return EE3Wrapper.ee3mod.getTileEntityDataHelper().getCustomName(
|
||||||
return EE3Wrapper.ee3mod.getTileEntityDataHelper().getCustomName(world, xCoord, yCoord, zCoord);
|
world, xCoord, yCoord, zCoord
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UUID getOwnerUUID(World world, int xCoord, int yCoord, int zCoord)
|
public static UUID getOwnerUUID(World world, int xCoord, int yCoord, int zCoord) {
|
||||||
{
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null)
|
if (ee3Mod != null) {
|
||||||
{
|
return EE3Wrapper.ee3mod.getTileEntityDataHelper().getOwnerUUID(
|
||||||
return EE3Wrapper.ee3mod.getTileEntityDataHelper().getOwnerUUID(world, xCoord, yCoord, zCoord);
|
world, xCoord, yCoord, zCoord
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getOwnerName(World world, int xCoord, int yCoord, int zCoord)
|
public static String getOwnerName(World world, int xCoord, int yCoord, int zCoord) {
|
||||||
{
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (ee3Mod != null)
|
if (ee3Mod != null) {
|
||||||
{
|
return EE3Wrapper.ee3mod.getTileEntityDataHelper().getOwnerName(
|
||||||
return EE3Wrapper.ee3mod.getTileEntityDataHelper().getOwnerName(world, xCoord, yCoord, zCoord);
|
world, xCoord, yCoord, zCoord
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EE3Wrapper
|
private static class EE3Wrapper { private static EquivalentExchange3 ee3mod; }
|
||||||
{
|
|
||||||
private static EquivalentExchange3 ee3mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void init()
|
private static void init() {
|
||||||
{
|
if (ee3Mod != null) {
|
||||||
if (ee3Mod != null)
|
|
||||||
{
|
|
||||||
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|util") package com.pahimar.ee3.api.util;
|
@API(owner = "EE3", apiVersion = "@API_VERSION@", provides = "EE3-API|util")
|
||||||
|
package com.pahimar.ee3.api.util;
|
||||||
|
|
||||||
import cpw.mods.fml.common.API;
|
import cpw.mods.fml.common.API;
|
|
@ -3,10 +3,8 @@ package com.pahimar.ee3.array;
|
||||||
import com.pahimar.ee3.api.array.AlchemyArray;
|
import com.pahimar.ee3.api.array.AlchemyArray;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public abstract class AlchemyArrayEE extends AlchemyArray
|
public abstract class AlchemyArrayEE extends AlchemyArray {
|
||||||
{
|
public AlchemyArrayEE(ResourceLocation texture, String unlocalizedName) {
|
||||||
public AlchemyArrayEE(ResourceLocation texture, String unlocalizedName)
|
|
||||||
{
|
|
||||||
super(texture, unlocalizedName);
|
super(texture, unlocalizedName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.pahimar.ee3.array;
|
package com.pahimar.ee3.array;
|
||||||
|
|
||||||
|
import java.util.SortedSet;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSortedSet;
|
import com.google.common.collect.ImmutableSortedSet;
|
||||||
import com.pahimar.ee3.api.array.AlchemyArray;
|
import com.pahimar.ee3.api.array.AlchemyArray;
|
||||||
import com.pahimar.ee3.util.LoaderHelper;
|
import com.pahimar.ee3.util.LoaderHelper;
|
||||||
|
@ -8,23 +11,16 @@ import cpw.mods.fml.common.Loader;
|
||||||
import org.apache.logging.log4j.Marker;
|
import org.apache.logging.log4j.Marker;
|
||||||
import org.apache.logging.log4j.MarkerManager;
|
import org.apache.logging.log4j.MarkerManager;
|
||||||
|
|
||||||
import java.util.SortedSet;
|
public class AlchemyArrayRegistry {
|
||||||
import java.util.TreeSet;
|
public static final Marker ALCHEMY_ARRAY_MARKER
|
||||||
|
= MarkerManager.getMarker("EE3_ALCHEMY_ARRAY", LogHelper.MOD_MARKER);
|
||||||
public class AlchemyArrayRegistry
|
|
||||||
{
|
|
||||||
public static final Marker ALCHEMY_ARRAY_MARKER = MarkerManager.getMarker("EE3_ALCHEMY_ARRAY", LogHelper.MOD_MARKER);
|
|
||||||
private static AlchemyArrayRegistry alchemyArrayRegistry = null;
|
private static AlchemyArrayRegistry alchemyArrayRegistry = null;
|
||||||
private SortedSet<AlchemyArray> registeredAlchemyArrays;
|
private SortedSet<AlchemyArray> registeredAlchemyArrays;
|
||||||
|
|
||||||
private AlchemyArrayRegistry()
|
private AlchemyArrayRegistry() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AlchemyArrayRegistry getInstance()
|
public static AlchemyArrayRegistry getInstance() {
|
||||||
{
|
if (alchemyArrayRegistry == null) {
|
||||||
if (alchemyArrayRegistry == null)
|
|
||||||
{
|
|
||||||
alchemyArrayRegistry = new AlchemyArrayRegistry();
|
alchemyArrayRegistry = new AlchemyArrayRegistry();
|
||||||
alchemyArrayRegistry.init();
|
alchemyArrayRegistry.init();
|
||||||
}
|
}
|
||||||
|
@ -32,20 +28,16 @@ public class AlchemyArrayRegistry
|
||||||
return alchemyArrayRegistry;
|
return alchemyArrayRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init()
|
private void init() {
|
||||||
{
|
|
||||||
registeredAlchemyArrays = new TreeSet<AlchemyArray>();
|
registeredAlchemyArrays = new TreeSet<AlchemyArray>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlchemyArray getAlchemyArray(int index)
|
public AlchemyArray getAlchemyArray(int index) {
|
||||||
{
|
if (registeredAlchemyArrays != null) {
|
||||||
if (registeredAlchemyArrays != null)
|
|
||||||
{
|
|
||||||
AlchemyArray[] alchemyArrays = new AlchemyArray[0];
|
AlchemyArray[] alchemyArrays = new AlchemyArray[0];
|
||||||
alchemyArrays = registeredAlchemyArrays.toArray(alchemyArrays);
|
alchemyArrays = registeredAlchemyArrays.toArray(alchemyArrays);
|
||||||
|
|
||||||
if (index < alchemyArrays.length)
|
if (index < alchemyArrays.length) {
|
||||||
{
|
|
||||||
return alchemyArrays[index];
|
return alchemyArrays[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,16 +45,19 @@ public class AlchemyArrayRegistry
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortedSet<AlchemyArray> getRegisteredAlchemyArrays()
|
public SortedSet<AlchemyArray> getRegisteredAlchemyArrays() {
|
||||||
{
|
|
||||||
return ImmutableSortedSet.copyOf(registeredAlchemyArrays);
|
return ImmutableSortedSet.copyOf(registeredAlchemyArrays);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean registerAlchemyArray(AlchemyArray alchemyArray)
|
public boolean registerAlchemyArray(AlchemyArray alchemyArray) {
|
||||||
{
|
if (!registeredAlchemyArrays.contains(alchemyArray)) {
|
||||||
if (!registeredAlchemyArrays.contains(alchemyArray))
|
LogHelper.trace(
|
||||||
{
|
ALCHEMY_ARRAY_MARKER,
|
||||||
LogHelper.trace(ALCHEMY_ARRAY_MARKER, "[{}]: Mod with ID '{}' added alchemy array {}", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), alchemyArray);
|
"[{}]: Mod with ID '{}' added alchemy array {}",
|
||||||
|
LoaderHelper.getLoaderState(),
|
||||||
|
Loader.instance().activeModContainer().getModId(),
|
||||||
|
alchemyArray
|
||||||
|
);
|
||||||
return registeredAlchemyArrays.add(alchemyArray);
|
return registeredAlchemyArrays.add(alchemyArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.pahimar.ee3.array;
|
package com.pahimar.ee3.array;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.pahimar.ee3.init.ModBlocks;
|
import com.pahimar.ee3.init.ModBlocks;
|
||||||
import com.pahimar.ee3.reference.Names;
|
import com.pahimar.ee3.reference.Names;
|
||||||
import com.pahimar.ee3.reference.Particles;
|
import com.pahimar.ee3.reference.Particles;
|
||||||
|
@ -21,60 +23,145 @@ import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.Random;
|
public class AlchemyArrayTransmutation extends AlchemyArrayEE implements IInventory {
|
||||||
|
|
||||||
public class AlchemyArrayTransmutation extends AlchemyArrayEE implements IInventory
|
|
||||||
{
|
|
||||||
private ItemStack[] inventory = new ItemStack[25];
|
private ItemStack[] inventory = new ItemStack[25];
|
||||||
|
|
||||||
public AlchemyArrayTransmutation()
|
public AlchemyArrayTransmutation() {
|
||||||
{
|
super(
|
||||||
super(Textures.AlchemyArray.TRANSMUTATION_ALCHEMY_ARRAY, Names.AlchemyArrays.TRANSMUTATION_ALCHEMY_ARRAY);
|
Textures.AlchemyArray.TRANSMUTATION_ALCHEMY_ARRAY,
|
||||||
|
Names.AlchemyArrays.TRANSMUTATION_ALCHEMY_ARRAY
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityCollidedWithArray(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, Entity entity)
|
public void onEntityCollidedWithArray(
|
||||||
{
|
World world,
|
||||||
|
int eventX,
|
||||||
|
int eventY,
|
||||||
|
int eventZ,
|
||||||
|
int arrayX,
|
||||||
|
int arrayY,
|
||||||
|
int arrayZ,
|
||||||
|
Entity entity
|
||||||
|
) {
|
||||||
LogHelper.info(entity);
|
LogHelper.info(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onArrayActivated(World world, int eventX, int eventY, int eventZ, int arrayX, int arrayY, int arrayZ, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
|
public void onArrayActivated(
|
||||||
{
|
World world,
|
||||||
|
int eventX,
|
||||||
|
int eventY,
|
||||||
|
int eventZ,
|
||||||
|
int arrayX,
|
||||||
|
int arrayY,
|
||||||
|
int arrayZ,
|
||||||
|
EntityPlayer entityPlayer,
|
||||||
|
int sideHit,
|
||||||
|
float hitX,
|
||||||
|
float hitY,
|
||||||
|
float hitZ
|
||||||
|
) {
|
||||||
// TODO Come back to this later to resolve inventory issues
|
// TODO Come back to this later to resolve inventory issues
|
||||||
// if (!entityPlayer.isSneaking())
|
// if (!entityPlayer.isSneaking())
|
||||||
// {
|
// {
|
||||||
// entityPlayer.openGui(EquivalentExchange3.instance, GUIs.TRANSMUTATION_ARRAY.ordinal(), world, arrayX, arrayY, arrayZ);
|
// entityPlayer.openGui(EquivalentExchange3.instance,
|
||||||
|
// GUIs.TRANSMUTATION_ARRAY.ordinal(), world, arrayX, arrayY, arrayZ);
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (!world.isRemote && entityPlayer.isSneaking())
|
if (!world.isRemote && entityPlayer.isSneaking()) {
|
||||||
{
|
|
||||||
boolean successFlag = false;
|
boolean successFlag = false;
|
||||||
|
|
||||||
if (world.getTileEntity(arrayX, arrayY, arrayZ) instanceof TileEntityAlchemyArray)
|
if (world.getTileEntity(arrayX, arrayY, arrayZ)
|
||||||
{
|
instanceof TileEntityAlchemyArray) {
|
||||||
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(arrayX, arrayY, arrayZ);
|
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray
|
||||||
|
) world.getTileEntity(arrayX, arrayY, arrayZ);
|
||||||
|
|
||||||
// First, see if we can make a Transmutation Tablet
|
// First, see if we can make a Transmutation Tablet
|
||||||
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP && tileEntityAlchemyArray.getSize() == 2 && areBlocksValidForTransmutationTablet(world, arrayX, arrayY, arrayZ))
|
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP
|
||||||
{
|
&& tileEntityAlchemyArray.getSize() == 2
|
||||||
world.setBlock(arrayX - 1, arrayY - 1, arrayZ - 1, ModBlocks.ashInfusedStoneSlab, 1, 3);
|
&& areBlocksValidForTransmutationTablet(
|
||||||
world.setBlock(arrayX, arrayY - 1, arrayZ - 1, ModBlocks.ashInfusedStoneSlab, 2, 3);
|
world, arrayX, arrayY, arrayZ
|
||||||
world.setBlock(arrayX + 1, arrayY - 1, arrayZ - 1, ModBlocks.ashInfusedStoneSlab, 3, 3);
|
)) {
|
||||||
|
world.setBlock(
|
||||||
|
arrayX - 1,
|
||||||
|
arrayY - 1,
|
||||||
|
arrayZ - 1,
|
||||||
|
ModBlocks.ashInfusedStoneSlab,
|
||||||
|
1,
|
||||||
|
3
|
||||||
|
);
|
||||||
|
world.setBlock(
|
||||||
|
arrayX,
|
||||||
|
arrayY - 1,
|
||||||
|
arrayZ - 1,
|
||||||
|
ModBlocks.ashInfusedStoneSlab,
|
||||||
|
2,
|
||||||
|
3
|
||||||
|
);
|
||||||
|
world.setBlock(
|
||||||
|
arrayX + 1,
|
||||||
|
arrayY - 1,
|
||||||
|
arrayZ - 1,
|
||||||
|
ModBlocks.ashInfusedStoneSlab,
|
||||||
|
3,
|
||||||
|
3
|
||||||
|
);
|
||||||
|
|
||||||
world.setBlock(arrayX - 1, arrayY - 1, arrayZ, ModBlocks.ashInfusedStoneSlab, 4, 3);
|
world.setBlock(
|
||||||
world.setBlock(arrayX, arrayY - 1, arrayZ, ModBlocks.transmutationTablet, 0, 3);
|
arrayX - 1,
|
||||||
world.setBlock(arrayX + 1, arrayY - 1, arrayZ, ModBlocks.ashInfusedStoneSlab, 5, 3);
|
arrayY - 1,
|
||||||
|
arrayZ,
|
||||||
|
ModBlocks.ashInfusedStoneSlab,
|
||||||
|
4,
|
||||||
|
3
|
||||||
|
);
|
||||||
|
world.setBlock(
|
||||||
|
arrayX, arrayY - 1, arrayZ, ModBlocks.transmutationTablet, 0, 3
|
||||||
|
);
|
||||||
|
world.setBlock(
|
||||||
|
arrayX + 1,
|
||||||
|
arrayY - 1,
|
||||||
|
arrayZ,
|
||||||
|
ModBlocks.ashInfusedStoneSlab,
|
||||||
|
5,
|
||||||
|
3
|
||||||
|
);
|
||||||
|
|
||||||
world.setBlock(arrayX - 1, arrayY - 1, arrayZ + 1, ModBlocks.ashInfusedStoneSlab, 6, 3);
|
world.setBlock(
|
||||||
world.setBlock(arrayX, arrayY - 1, arrayZ + 1, ModBlocks.ashInfusedStoneSlab, 7, 3);
|
arrayX - 1,
|
||||||
world.setBlock(arrayX + 1, arrayY - 1, arrayZ + 1, ModBlocks.ashInfusedStoneSlab, 8, 3);
|
arrayY - 1,
|
||||||
|
arrayZ + 1,
|
||||||
|
ModBlocks.ashInfusedStoneSlab,
|
||||||
|
6,
|
||||||
|
3
|
||||||
|
);
|
||||||
|
world.setBlock(
|
||||||
|
arrayX,
|
||||||
|
arrayY - 1,
|
||||||
|
arrayZ + 1,
|
||||||
|
ModBlocks.ashInfusedStoneSlab,
|
||||||
|
7,
|
||||||
|
3
|
||||||
|
);
|
||||||
|
world.setBlock(
|
||||||
|
arrayX + 1,
|
||||||
|
arrayY - 1,
|
||||||
|
arrayZ + 1,
|
||||||
|
ModBlocks.ashInfusedStoneSlab,
|
||||||
|
8,
|
||||||
|
3
|
||||||
|
);
|
||||||
|
|
||||||
if (world.getTileEntity(arrayX, arrayY - 1, arrayZ) instanceof TileEntityTransmutationTablet)
|
if (world.getTileEntity(arrayX, arrayY - 1, arrayZ)
|
||||||
{
|
instanceof TileEntityTransmutationTablet) {
|
||||||
((TileEntityTransmutationTablet) world.getTileEntity(arrayX, arrayY - 1, arrayZ)).setOrientation(tileEntityAlchemyArray.getOrientation());
|
((TileEntityTransmutationTablet
|
||||||
((TileEntityTransmutationTablet) world.getTileEntity(arrayX, arrayY - 1, arrayZ)).setRotation(tileEntityAlchemyArray.getRotation());
|
) world.getTileEntity(arrayX, arrayY - 1, arrayZ))
|
||||||
|
.setOrientation(tileEntityAlchemyArray.getOrientation());
|
||||||
|
((TileEntityTransmutationTablet
|
||||||
|
) world.getTileEntity(arrayX, arrayY - 1, arrayZ))
|
||||||
|
.setRotation(tileEntityAlchemyArray.getRotation());
|
||||||
}
|
}
|
||||||
|
|
||||||
ejectInventory(world, arrayX, arrayY, arrayZ);
|
ejectInventory(world, arrayX, arrayY, arrayZ);
|
||||||
|
@ -82,31 +169,56 @@ public class AlchemyArrayTransmutation extends AlchemyArrayEE implements IInvent
|
||||||
successFlag = true;
|
successFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (successFlag)
|
if (successFlag) {
|
||||||
{
|
CommonSoundHelper.playSoundAtLocation(
|
||||||
CommonSoundHelper.playSoundAtLocation(world.provider.dimensionId, arrayX, arrayY, arrayZ, Sounds.TRANSMUTE, 1f, 1f);
|
world.provider.dimensionId,
|
||||||
|
arrayX,
|
||||||
|
arrayY,
|
||||||
|
arrayZ,
|
||||||
|
Sounds.TRANSMUTE,
|
||||||
|
1f,
|
||||||
|
1f
|
||||||
|
);
|
||||||
|
|
||||||
if (tileEntityAlchemyArray.getSize() == 1)
|
if (tileEntityAlchemyArray.getSize() == 1) {
|
||||||
{
|
CommonParticleHelper.spawnParticleAtLocation(
|
||||||
CommonParticleHelper.spawnParticleAtLocation(Particles.LARGE_SMOKE, world.provider.dimensionId, arrayX + 0.5d, arrayY, arrayZ + 0.5d, 0d, 0.1d, 0d);
|
Particles.LARGE_SMOKE,
|
||||||
}
|
world.provider.dimensionId,
|
||||||
else if (tileEntityAlchemyArray.getSize() == 2)
|
arrayX + 0.5d,
|
||||||
{
|
arrayY,
|
||||||
for (int i = -1; i <= 1; i++)
|
arrayZ + 0.5d,
|
||||||
{
|
0d,
|
||||||
for (int j = -1; j <= 1; j++)
|
0.1d,
|
||||||
{
|
0d
|
||||||
CommonParticleHelper.spawnParticleAtLocation(Particles.LARGE_SMOKE, world.provider.dimensionId, arrayX + i + 0.5d, arrayY, arrayZ + j + 0.5d, 0d, 0.1d, 0d);
|
);
|
||||||
|
} else if (tileEntityAlchemyArray.getSize() == 2) {
|
||||||
|
for (int i = -1; i <= 1; i++) {
|
||||||
|
for (int j = -1; j <= 1; j++) {
|
||||||
|
CommonParticleHelper.spawnParticleAtLocation(
|
||||||
|
Particles.LARGE_SMOKE,
|
||||||
|
world.provider.dimensionId,
|
||||||
|
arrayX + i + 0.5d,
|
||||||
|
arrayY,
|
||||||
|
arrayZ + j + 0.5d,
|
||||||
|
0d,
|
||||||
|
0.1d,
|
||||||
|
0d
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (tileEntityAlchemyArray.getSize() == 3) {
|
||||||
else if (tileEntityAlchemyArray.getSize() == 3)
|
for (int i = -2; i <= 2; i++) {
|
||||||
{
|
for (int j = -2; j <= 2; j++) {
|
||||||
for (int i = -2; i <= 2; i++)
|
CommonParticleHelper.spawnParticleAtLocation(
|
||||||
{
|
Particles.LARGE_SMOKE,
|
||||||
for (int j = -2; j <= 2; j++)
|
world.provider.dimensionId,
|
||||||
{
|
arrayX + i + 0.5d,
|
||||||
CommonParticleHelper.spawnParticleAtLocation(Particles.LARGE_SMOKE, world.provider.dimensionId, arrayX + i + 0.5d, arrayY, arrayZ + j + 0.5d, 0d, 0.1d, 0d);
|
arrayY,
|
||||||
|
arrayZ + j + 0.5d,
|
||||||
|
0d,
|
||||||
|
0.1d,
|
||||||
|
0d
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,16 +227,15 @@ public class AlchemyArrayTransmutation extends AlchemyArrayEE implements IInvent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean areBlocksValidForTransmutationTablet(World world, int arrayX, int arrayY, int arrayZ)
|
private boolean areBlocksValidForTransmutationTablet(
|
||||||
{
|
World world, int arrayX, int arrayY, int arrayZ
|
||||||
|
) {
|
||||||
boolean areBlocksValid = true;
|
boolean areBlocksValid = true;
|
||||||
|
|
||||||
for (int i = -1; i <= 1; i++)
|
for (int i = -1; i <= 1; i++) {
|
||||||
{
|
for (int j = -1; j <= 1; j++) {
|
||||||
for (int j = -1; j <= 1; j++)
|
if (world.getBlock(arrayX + i, arrayY - 1, arrayZ + j)
|
||||||
{
|
!= ModBlocks.ashInfusedStone) {
|
||||||
if (world.getBlock(arrayX + i, arrayY - 1, arrayZ + j) != ModBlocks.ashInfusedStone)
|
|
||||||
{
|
|
||||||
areBlocksValid = false;
|
areBlocksValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,16 +245,13 @@ public class AlchemyArrayTransmutation extends AlchemyArrayEE implements IInvent
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSizeInventory()
|
public int getSizeInventory() {
|
||||||
{
|
|
||||||
return inventory.length;
|
return inventory.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getStackInSlot(int slotIndex)
|
public ItemStack getStackInSlot(int slotIndex) {
|
||||||
{
|
if (slotIndex < getSizeInventory()) {
|
||||||
if (slotIndex < getSizeInventory())
|
|
||||||
{
|
|
||||||
return inventory[slotIndex];
|
return inventory[slotIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,20 +259,14 @@ public class AlchemyArrayTransmutation extends AlchemyArrayEE implements IInvent
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack decrStackSize(int slotIndex, int decrementAmount)
|
public ItemStack decrStackSize(int slotIndex, int decrementAmount) {
|
||||||
{
|
|
||||||
ItemStack itemStack = getStackInSlot(slotIndex);
|
ItemStack itemStack = getStackInSlot(slotIndex);
|
||||||
if (itemStack != null)
|
if (itemStack != null) {
|
||||||
{
|
if (itemStack.stackSize <= decrementAmount) {
|
||||||
if (itemStack.stackSize <= decrementAmount)
|
|
||||||
{
|
|
||||||
setInventorySlotContents(slotIndex, null);
|
setInventorySlotContents(slotIndex, null);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
itemStack = itemStack.splitStack(decrementAmount);
|
itemStack = itemStack.splitStack(decrementAmount);
|
||||||
if (itemStack.stackSize == 0)
|
if (itemStack.stackSize == 0) {
|
||||||
{
|
|
||||||
setInventorySlotContents(slotIndex, null);
|
setInventorySlotContents(slotIndex, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,76 +276,62 @@ public class AlchemyArrayTransmutation extends AlchemyArrayEE implements IInvent
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getStackInSlotOnClosing(int slotIndex)
|
public ItemStack getStackInSlotOnClosing(int slotIndex) {
|
||||||
{
|
|
||||||
ItemStack itemStack = getStackInSlot(slotIndex);
|
ItemStack itemStack = getStackInSlot(slotIndex);
|
||||||
if (itemStack != null)
|
if (itemStack != null) {
|
||||||
{
|
|
||||||
setInventorySlotContents(slotIndex, null);
|
setInventorySlotContents(slotIndex, null);
|
||||||
}
|
}
|
||||||
return itemStack;
|
return itemStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int slotIndex, ItemStack itemStack)
|
public void setInventorySlotContents(int slotIndex, ItemStack itemStack) {
|
||||||
{
|
if (slotIndex < getSizeInventory()) {
|
||||||
if (slotIndex < getSizeInventory())
|
|
||||||
{
|
|
||||||
inventory[slotIndex] = itemStack;
|
inventory[slotIndex] = itemStack;
|
||||||
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit())
|
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
|
||||||
{
|
|
||||||
itemStack.stackSize = getInventoryStackLimit();
|
itemStack.stackSize = getInventoryStackLimit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInventoryName()
|
public String getInventoryName() {
|
||||||
{
|
|
||||||
return Names.AlchemyArrays.TRANSMUTATION_ALCHEMY_ARRAY;
|
return Names.AlchemyArrays.TRANSMUTATION_ALCHEMY_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCustomInventoryName()
|
public boolean hasCustomInventoryName() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInventoryStackLimit()
|
public int getInventoryStackLimit() {
|
||||||
{
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void markDirty()
|
public void markDirty() {
|
||||||
{
|
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isUseableByPlayer(EntityPlayer entityPlayer)
|
public boolean isUseableByPlayer(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openInventory()
|
public void openInventory() {
|
||||||
{
|
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeInventory()
|
public void closeInventory() {
|
||||||
{
|
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack)
|
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
|
||||||
{
|
if (slotIndex < getSizeInventory()) {
|
||||||
if (slotIndex < getSizeInventory())
|
|
||||||
{
|
|
||||||
return itemStack.getItem() instanceof ItemBlock;
|
return itemStack.getItem() instanceof ItemBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,35 +339,29 @@ public class AlchemyArrayTransmutation extends AlchemyArrayEE implements IInvent
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbtTagCompound)
|
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(nbtTagCompound);
|
super.readFromNBT(nbtTagCompound);
|
||||||
|
|
||||||
// Read in the ItemStacks in the inventory from NBT
|
// Read in the ItemStacks in the inventory from NBT
|
||||||
NBTTagList tagList = nbtTagCompound.getTagList(Names.NBT.ITEMS, 10);
|
NBTTagList tagList = nbtTagCompound.getTagList(Names.NBT.ITEMS, 10);
|
||||||
inventory = new ItemStack[this.getSizeInventory()];
|
inventory = new ItemStack[this.getSizeInventory()];
|
||||||
for (int i = 0; i < tagList.tagCount(); ++i)
|
for (int i = 0; i < tagList.tagCount(); ++i) {
|
||||||
{
|
|
||||||
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
|
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
|
||||||
byte slotIndex = tagCompound.getByte("Slot");
|
byte slotIndex = tagCompound.getByte("Slot");
|
||||||
if (slotIndex >= 0 && slotIndex < inventory.length)
|
if (slotIndex >= 0 && slotIndex < inventory.length) {
|
||||||
{
|
|
||||||
inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
|
inventory[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound nbtTagCompound)
|
public void writeToNBT(NBTTagCompound nbtTagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(nbtTagCompound);
|
super.writeToNBT(nbtTagCompound);
|
||||||
|
|
||||||
// Write the ItemStacks in the inventory to NBT
|
// Write the ItemStacks in the inventory to NBT
|
||||||
NBTTagList tagList = new NBTTagList();
|
NBTTagList tagList = new NBTTagList();
|
||||||
for (int currentIndex = 0; currentIndex < getSizeInventory(); ++currentIndex)
|
for (int currentIndex = 0; currentIndex < getSizeInventory(); ++currentIndex) {
|
||||||
{
|
if (getStackInSlot(currentIndex) != null) {
|
||||||
if (getStackInSlot(currentIndex) != null)
|
|
||||||
{
|
|
||||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||||
tagCompound.setByte("Slot", (byte) currentIndex);
|
tagCompound.setByte("Slot", (byte) currentIndex);
|
||||||
getStackInSlot(currentIndex).writeToNBT(tagCompound);
|
getStackInSlot(currentIndex).writeToNBT(tagCompound);
|
||||||
|
@ -289,25 +371,24 @@ public class AlchemyArrayTransmutation extends AlchemyArrayEE implements IInvent
|
||||||
nbtTagCompound.setTag(Names.NBT.ITEMS, tagList);
|
nbtTagCompound.setTag(Names.NBT.ITEMS, tagList);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void ejectInventory(World world, int x, int y, int z)
|
protected void ejectInventory(World world, int x, int y, int z) {
|
||||||
{
|
for (int i = 0; i < getSizeInventory(); i++) {
|
||||||
for (int i = 0; i < getSizeInventory(); i++)
|
|
||||||
{
|
|
||||||
ItemStack itemStack = getStackInSlot(i);
|
ItemStack itemStack = getStackInSlot(i);
|
||||||
|
|
||||||
if (itemStack != null && itemStack.stackSize > 0)
|
if (itemStack != null && itemStack.stackSize > 0) {
|
||||||
{
|
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
|
|
||||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
|
|
||||||
EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, itemStack.copy());
|
EntityItem entityItem
|
||||||
|
= new EntityItem(world, x + dX, y + dY, z + dZ, itemStack.copy());
|
||||||
|
|
||||||
if (itemStack.hasTagCompound())
|
if (itemStack.hasTagCompound()) {
|
||||||
{
|
entityItem.getEntityItem().setTagCompound(
|
||||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
(NBTTagCompound) itemStack.getTagCompound().copy()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
float factor = 0.05F;
|
float factor = 0.05F;
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
package com.pahimar.ee3.blacklist;
|
package com.pahimar.ee3.blacklist;
|
||||||
|
|
||||||
|
import static com.pahimar.ee3.api.blacklist.BlacklistRegistryProxy.Blacklist;
|
||||||
|
import static com.pahimar.ee3.api.event.BlacklistEvent.*;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy;
|
import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy;
|
||||||
import com.pahimar.ee3.exchange.OreStack;
|
import com.pahimar.ee3.exchange.OreStack;
|
||||||
import com.pahimar.ee3.exchange.WrappedStack;
|
import com.pahimar.ee3.exchange.WrappedStack;
|
||||||
|
@ -13,28 +23,24 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
import org.apache.logging.log4j.Marker;
|
import org.apache.logging.log4j.Marker;
|
||||||
import org.apache.logging.log4j.MarkerManager;
|
import org.apache.logging.log4j.MarkerManager;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static com.pahimar.ee3.api.blacklist.BlacklistRegistryProxy.Blacklist;
|
|
||||||
import static com.pahimar.ee3.api.event.BlacklistEvent.*;
|
|
||||||
|
|
||||||
// TODO Logging
|
// TODO Logging
|
||||||
public class BlacklistRegistry {
|
public class BlacklistRegistry {
|
||||||
|
|
||||||
public static final BlacklistRegistry INSTANCE = new BlacklistRegistry();
|
public static final BlacklistRegistry INSTANCE = new BlacklistRegistry();
|
||||||
|
|
||||||
private static final Marker BLACKLIST_MARKER = MarkerManager.getMarker("EE3_BLACKLIST", LogHelper.MOD_MARKER);
|
private static final Marker BLACKLIST_MARKER
|
||||||
private static final Marker KNOWLEDGE_MARKER = MarkerManager.getMarker("EE3_KNOWLEDGE", BLACKLIST_MARKER);
|
= MarkerManager.getMarker("EE3_BLACKLIST", LogHelper.MOD_MARKER);
|
||||||
private static final Marker KNOWLEDGE_BLACKLIST_MARKER = MarkerManager.getMarker("EE3_KNOWLEDGE_BLACKLIST", KNOWLEDGE_MARKER);
|
private static final Marker KNOWLEDGE_MARKER
|
||||||
private static final Marker KNOWLEDGE_WHITELIST_MARKER = MarkerManager.getMarker("EE3_KNOWLEDGE_WHITELIST", KNOWLEDGE_MARKER);
|
= MarkerManager.getMarker("EE3_KNOWLEDGE", BLACKLIST_MARKER);
|
||||||
private static final Marker EXCHANGE_MARKER = MarkerManager.getMarker("EE3_EXCHANGE", BLACKLIST_MARKER);
|
private static final Marker KNOWLEDGE_BLACKLIST_MARKER
|
||||||
private static final Marker EXCHANGE_BLACKLIST_MARKER = MarkerManager.getMarker("EE3_EXCHANGE_BLACKLIST", EXCHANGE_MARKER);
|
= MarkerManager.getMarker("EE3_KNOWLEDGE_BLACKLIST", KNOWLEDGE_MARKER);
|
||||||
private static final Marker EXCHANGE_WHITELIST_MARKER = MarkerManager.getMarker("EE3_EXCHANGE_WHITELIST", EXCHANGE_MARKER);
|
private static final Marker KNOWLEDGE_WHITELIST_MARKER
|
||||||
|
= MarkerManager.getMarker("EE3_KNOWLEDGE_WHITELIST", KNOWLEDGE_MARKER);
|
||||||
|
private static final Marker EXCHANGE_MARKER
|
||||||
|
= MarkerManager.getMarker("EE3_EXCHANGE", BLACKLIST_MARKER);
|
||||||
|
private static final Marker EXCHANGE_BLACKLIST_MARKER
|
||||||
|
= MarkerManager.getMarker("EE3_EXCHANGE_BLACKLIST", EXCHANGE_MARKER);
|
||||||
|
private static final Marker EXCHANGE_WHITELIST_MARKER
|
||||||
|
= MarkerManager.getMarker("EE3_EXCHANGE_WHITELIST", EXCHANGE_MARKER);
|
||||||
|
|
||||||
private final Set<WrappedStack> knowledgeBlacklist, exchangeBlacklist;
|
private final Set<WrappedStack> knowledgeBlacklist, exchangeBlacklist;
|
||||||
public static File knowledgeBlacklistFile, exchangeBlacklistFile;
|
public static File knowledgeBlacklistFile, exchangeBlacklistFile;
|
||||||
|
@ -44,7 +50,6 @@ public class BlacklistRegistry {
|
||||||
* TODO Finish JavaDoc
|
* TODO Finish JavaDoc
|
||||||
*/
|
*/
|
||||||
private BlacklistRegistry() {
|
private BlacklistRegistry() {
|
||||||
|
|
||||||
knowledgeBlacklist = new TreeSet<>();
|
knowledgeBlacklist = new TreeSet<>();
|
||||||
exchangeBlacklist = new TreeSet<>();
|
exchangeBlacklist = new TreeSet<>();
|
||||||
shouldSave = true;
|
shouldSave = true;
|
||||||
|
@ -75,24 +80,22 @@ public class BlacklistRegistry {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isLearnable(Object object) {
|
public boolean isLearnable(Object object) {
|
||||||
|
|
||||||
if (WrappedStack.canBeWrapped(object)) {
|
if (WrappedStack.canBeWrapped(object)) {
|
||||||
|
|
||||||
WrappedStack wrappedObject = WrappedStack.wrap(object, 1);
|
WrappedStack wrappedObject = WrappedStack.wrap(object, 1);
|
||||||
|
|
||||||
if (object instanceof ItemStack && ((ItemStack) object).isItemDamaged()) {
|
if (object instanceof ItemStack && ((ItemStack) object).isItemDamaged()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (EnergyValueRegistryProxy.hasEnergyValue(wrappedObject)) {
|
if (EnergyValueRegistryProxy.hasEnergyValue(wrappedObject)) {
|
||||||
|
|
||||||
if (knowledgeBlacklist.contains(wrappedObject)) {
|
if (knowledgeBlacklist.contains(wrappedObject)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (object instanceof ItemStack) {
|
||||||
else if (object instanceof ItemStack){
|
Collection<String> oreNames
|
||||||
Collection<String> oreNames = OreDictionaryHelper.getOreNames((ItemStack) object);
|
= OreDictionaryHelper.getOreNames((ItemStack) object);
|
||||||
for (String oreName : oreNames) {
|
for (String oreName : oreNames) {
|
||||||
if (knowledgeBlacklist.contains(WrappedStack.wrap(new OreStack(oreName)))) {
|
if (knowledgeBlacklist.contains(
|
||||||
|
WrappedStack.wrap(new OreStack(oreName))
|
||||||
|
)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,20 +116,19 @@ public class BlacklistRegistry {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isExchangeable(Object object) {
|
public boolean isExchangeable(Object object) {
|
||||||
|
|
||||||
if (WrappedStack.canBeWrapped(object)) {
|
if (WrappedStack.canBeWrapped(object)) {
|
||||||
|
|
||||||
WrappedStack wrappedObject = WrappedStack.wrap(object, 1);
|
WrappedStack wrappedObject = WrappedStack.wrap(object, 1);
|
||||||
|
|
||||||
if (EnergyValueRegistryProxy.hasEnergyValue(wrappedObject)) {
|
if (EnergyValueRegistryProxy.hasEnergyValue(wrappedObject)) {
|
||||||
|
|
||||||
if (exchangeBlacklist.contains(wrappedObject)) {
|
if (exchangeBlacklist.contains(wrappedObject)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (object instanceof ItemStack) {
|
||||||
else if (object instanceof ItemStack){
|
Collection<String> oreNames
|
||||||
Collection<String> oreNames = OreDictionaryHelper.getOreNames((ItemStack) object);
|
= OreDictionaryHelper.getOreNames((ItemStack) object);
|
||||||
for (String oreName : oreNames) {
|
for (String oreName : oreNames) {
|
||||||
if (exchangeBlacklist.contains(WrappedStack.wrap(new OreStack(oreName)))) {
|
if (exchangeBlacklist.contains(
|
||||||
|
WrappedStack.wrap(new OreStack(oreName))
|
||||||
|
)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,21 +148,34 @@ public class BlacklistRegistry {
|
||||||
* @param blacklist
|
* @param blacklist
|
||||||
*/
|
*/
|
||||||
public void addToBlacklist(Object object, Blacklist blacklist) {
|
public void addToBlacklist(Object object, Blacklist blacklist) {
|
||||||
|
|
||||||
if (WrappedStack.canBeWrapped(object)) {
|
if (WrappedStack.canBeWrapped(object)) {
|
||||||
|
|
||||||
WrappedStack wrappedStack = WrappedStack.wrap(object, 1);
|
WrappedStack wrappedStack = WrappedStack.wrap(object, 1);
|
||||||
|
|
||||||
if (blacklist == Blacklist.KNOWLEDGE) {
|
if (blacklist == Blacklist.KNOWLEDGE) {
|
||||||
if (wrappedStack != null && !MinecraftForge.EVENT_BUS.post(new KnowledgeBlacklistEvent(object))) {
|
if (wrappedStack != null
|
||||||
LogHelper.trace(KNOWLEDGE_BLACKLIST_MARKER, "[{}] Mod with ID '{}' added object {} to the player knowledge blacklist", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), wrappedStack);
|
&& !MinecraftForge.EVENT_BUS.post(new KnowledgeBlacklistEvent(object)
|
||||||
|
)) {
|
||||||
|
LogHelper.trace(
|
||||||
|
KNOWLEDGE_BLACKLIST_MARKER,
|
||||||
|
"[{}] Mod with ID '{}' added object {} to the player knowledge blacklist",
|
||||||
|
LoaderHelper.getLoaderState(),
|
||||||
|
Loader.instance().activeModContainer().getModId(),
|
||||||
|
wrappedStack
|
||||||
|
);
|
||||||
knowledgeBlacklist.add(WrappedStack.wrap(object, 1));
|
knowledgeBlacklist.add(WrappedStack.wrap(object, 1));
|
||||||
save(blacklist);
|
save(blacklist);
|
||||||
}
|
}
|
||||||
}
|
} else if (blacklist == Blacklist.EXCHANGE) {
|
||||||
else if (blacklist == Blacklist.EXCHANGE) {
|
if (wrappedStack != null
|
||||||
if (wrappedStack != null && !MinecraftForge.EVENT_BUS.post(new ExchangeBlacklistEvent(object))) {
|
&& !MinecraftForge.EVENT_BUS.post(new ExchangeBlacklistEvent(object)
|
||||||
LogHelper.trace(EXCHANGE_BLACKLIST_MARKER, "[{}] Mod with ID '{}' added object {} to the exchange blacklist", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), wrappedStack);
|
)) {
|
||||||
|
LogHelper.trace(
|
||||||
|
EXCHANGE_BLACKLIST_MARKER,
|
||||||
|
"[{}] Mod with ID '{}' added object {} to the exchange blacklist",
|
||||||
|
LoaderHelper.getLoaderState(),
|
||||||
|
Loader.instance().activeModContainer().getModId(),
|
||||||
|
wrappedStack
|
||||||
|
);
|
||||||
exchangeBlacklist.add(WrappedStack.wrap(object, 1));
|
exchangeBlacklist.add(WrappedStack.wrap(object, 1));
|
||||||
save(blacklist);
|
save(blacklist);
|
||||||
}
|
}
|
||||||
|
@ -175,21 +190,34 @@ public class BlacklistRegistry {
|
||||||
* @param blacklist
|
* @param blacklist
|
||||||
*/
|
*/
|
||||||
public void removeFromBlacklist(Object object, Blacklist blacklist) {
|
public void removeFromBlacklist(Object object, Blacklist blacklist) {
|
||||||
|
|
||||||
if (WrappedStack.canBeWrapped(object)) {
|
if (WrappedStack.canBeWrapped(object)) {
|
||||||
|
|
||||||
WrappedStack wrappedStack = WrappedStack.wrap(object, 1);
|
WrappedStack wrappedStack = WrappedStack.wrap(object, 1);
|
||||||
|
|
||||||
if (blacklist == Blacklist.KNOWLEDGE) {
|
if (blacklist == Blacklist.KNOWLEDGE) {
|
||||||
if (wrappedStack != null && !MinecraftForge.EVENT_BUS.post(new KnowledgeWhitelistEvent(object))) {
|
if (wrappedStack != null
|
||||||
LogHelper.trace(KNOWLEDGE_WHITELIST_MARKER, "[{}] Mod with ID '{}' removed object {} from the player knowledge blacklist", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), wrappedStack);
|
&& !MinecraftForge.EVENT_BUS.post(new KnowledgeWhitelistEvent(object)
|
||||||
|
)) {
|
||||||
|
LogHelper.trace(
|
||||||
|
KNOWLEDGE_WHITELIST_MARKER,
|
||||||
|
"[{}] Mod with ID '{}' removed object {} from the player knowledge blacklist",
|
||||||
|
LoaderHelper.getLoaderState(),
|
||||||
|
Loader.instance().activeModContainer().getModId(),
|
||||||
|
wrappedStack
|
||||||
|
);
|
||||||
knowledgeBlacklist.remove(wrappedStack);
|
knowledgeBlacklist.remove(wrappedStack);
|
||||||
save(blacklist);
|
save(blacklist);
|
||||||
}
|
}
|
||||||
}
|
} else if (blacklist == Blacklist.EXCHANGE) {
|
||||||
else if (blacklist == Blacklist.EXCHANGE) {
|
if (wrappedStack != null
|
||||||
if (wrappedStack != null && !MinecraftForge.EVENT_BUS.post(new ExchangeWhitelistEvent(object))) {
|
&& !MinecraftForge.EVENT_BUS.post(new ExchangeWhitelistEvent(object)
|
||||||
LogHelper.trace(EXCHANGE_WHITELIST_MARKER, "[{}] Mod with ID '{}' removed object {} from the exchange blacklist", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), wrappedStack);
|
)) {
|
||||||
|
LogHelper.trace(
|
||||||
|
EXCHANGE_WHITELIST_MARKER,
|
||||||
|
"[{}] Mod with ID '{}' removed object {} from the exchange blacklist",
|
||||||
|
LoaderHelper.getLoaderState(),
|
||||||
|
Loader.instance().activeModContainer().getModId(),
|
||||||
|
wrappedStack
|
||||||
|
);
|
||||||
exchangeBlacklist.remove(wrappedStack);
|
exchangeBlacklist.remove(wrappedStack);
|
||||||
save(blacklist);
|
save(blacklist);
|
||||||
}
|
}
|
||||||
|
@ -210,17 +238,22 @@ public class BlacklistRegistry {
|
||||||
* TODO Finish JavaDoc
|
* TODO Finish JavaDoc
|
||||||
*/
|
*/
|
||||||
public void load() {
|
public void load() {
|
||||||
|
|
||||||
if (knowledgeBlacklistFile != null) {
|
if (knowledgeBlacklistFile != null) {
|
||||||
Set<WrappedStack> knowledgeBlacklistSet = SerializationHelper.readSetFromFile(knowledgeBlacklistFile);
|
Set<WrappedStack> knowledgeBlacklistSet
|
||||||
|
= SerializationHelper.readSetFromFile(knowledgeBlacklistFile);
|
||||||
knowledgeBlacklist.clear();
|
knowledgeBlacklist.clear();
|
||||||
knowledgeBlacklist.addAll(knowledgeBlacklistSet.stream().filter(wrappedStack -> wrappedStack != null).collect(Collectors.toList()));
|
knowledgeBlacklist.addAll(knowledgeBlacklistSet.stream()
|
||||||
|
.filter(wrappedStack -> wrappedStack != null)
|
||||||
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exchangeBlacklistFile != null) {
|
if (exchangeBlacklistFile != null) {
|
||||||
Set<WrappedStack> exchangeBlacklistSet = SerializationHelper.readSetFromFile(exchangeBlacklistFile);
|
Set<WrappedStack> exchangeBlacklistSet
|
||||||
|
= SerializationHelper.readSetFromFile(exchangeBlacklistFile);
|
||||||
exchangeBlacklist.clear();
|
exchangeBlacklist.clear();
|
||||||
exchangeBlacklist.addAll(exchangeBlacklistSet.stream().filter(wrappedStack -> wrappedStack != null).collect(Collectors.toList()));
|
exchangeBlacklist.addAll(exchangeBlacklistSet.stream()
|
||||||
|
.filter(wrappedStack -> wrappedStack != null)
|
||||||
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,20 +264,29 @@ public class BlacklistRegistry {
|
||||||
* @param blacklist
|
* @param blacklist
|
||||||
*/
|
*/
|
||||||
public void load(Set<WrappedStack> blacklistSet, Blacklist blacklist) {
|
public void load(Set<WrappedStack> blacklistSet, Blacklist blacklist) {
|
||||||
|
|
||||||
if (blacklist != null && blacklistSet != null) {
|
if (blacklist != null && blacklistSet != null) {
|
||||||
|
|
||||||
setShouldSave(false);
|
setShouldSave(false);
|
||||||
|
|
||||||
if (blacklist == Blacklist.KNOWLEDGE) {
|
if (blacklist == Blacklist.KNOWLEDGE) {
|
||||||
LogHelper.info("Received {} player knowledge blacklist entries from server", blacklistSet.size());
|
LogHelper.info(
|
||||||
|
"Received {} player knowledge blacklist entries from server",
|
||||||
|
blacklistSet.size()
|
||||||
|
);
|
||||||
knowledgeBlacklist.clear();
|
knowledgeBlacklist.clear();
|
||||||
knowledgeBlacklist.addAll(blacklistSet.stream().filter(wrappedStack -> wrappedStack != null).collect(Collectors.toList()));
|
knowledgeBlacklist.addAll(
|
||||||
}
|
blacklistSet.stream()
|
||||||
else if (blacklist == Blacklist.EXCHANGE) {
|
.filter(wrappedStack -> wrappedStack != null)
|
||||||
LogHelper.info("Received {} exchange blacklist entries from server", blacklistSet.size());
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
} else if (blacklist == Blacklist.EXCHANGE) {
|
||||||
|
LogHelper.info(
|
||||||
|
"Received {} exchange blacklist entries from server",
|
||||||
|
blacklistSet.size()
|
||||||
|
);
|
||||||
exchangeBlacklist.clear();
|
exchangeBlacklist.clear();
|
||||||
exchangeBlacklist.addAll(blacklistSet.stream().filter(wrappedStack -> wrappedStack != null).collect(Collectors.toList()));
|
exchangeBlacklist.addAll(blacklistSet.stream()
|
||||||
|
.filter(wrappedStack -> wrappedStack != null)
|
||||||
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -255,13 +297,17 @@ public class BlacklistRegistry {
|
||||||
* @param blacklist
|
* @param blacklist
|
||||||
*/
|
*/
|
||||||
public void save(Blacklist blacklist) {
|
public void save(Blacklist blacklist) {
|
||||||
|
|
||||||
if (shouldSave) {
|
if (shouldSave) {
|
||||||
if (blacklist == Blacklist.KNOWLEDGE && knowledgeBlacklistFile != null) {
|
if (blacklist == Blacklist.KNOWLEDGE && knowledgeBlacklistFile != null) {
|
||||||
SerializationHelper.writeJsonFile(knowledgeBlacklistFile, SerializationHelper.GSON.toJson(knowledgeBlacklist));
|
SerializationHelper.writeJsonFile(
|
||||||
}
|
knowledgeBlacklistFile,
|
||||||
else if (blacklist == Blacklist.EXCHANGE && exchangeBlacklistFile != null) {
|
SerializationHelper.GSON.toJson(knowledgeBlacklist)
|
||||||
SerializationHelper.writeJsonFile(exchangeBlacklistFile, SerializationHelper.GSON.toJson(exchangeBlacklist));
|
);
|
||||||
|
} else if (blacklist == Blacklist.EXCHANGE && exchangeBlacklistFile != null) {
|
||||||
|
SerializationHelper.writeJsonFile(
|
||||||
|
exchangeBlacklistFile,
|
||||||
|
SerializationHelper.GSON.toJson(exchangeBlacklist)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,11 +316,20 @@ public class BlacklistRegistry {
|
||||||
* TODO Finish JavaDoc
|
* TODO Finish JavaDoc
|
||||||
*/
|
*/
|
||||||
public void saveAll() {
|
public void saveAll() {
|
||||||
|
if (shouldSave && knowledgeBlacklistFile != null
|
||||||
if (shouldSave && knowledgeBlacklistFile != null && exchangeBlacklistFile != null) {
|
&& exchangeBlacklistFile != null) {
|
||||||
LogHelper.trace(BLACKLIST_MARKER, "Saving all blacklists to disk", exchangeBlacklistFile.getAbsolutePath());
|
LogHelper.trace(
|
||||||
SerializationHelper.writeJsonFile(knowledgeBlacklistFile, SerializationHelper.GSON.toJson(knowledgeBlacklist));
|
BLACKLIST_MARKER,
|
||||||
SerializationHelper.writeJsonFile(exchangeBlacklistFile, SerializationHelper.GSON.toJson(exchangeBlacklist));
|
"Saving all blacklists to disk",
|
||||||
|
exchangeBlacklistFile.getAbsolutePath()
|
||||||
|
);
|
||||||
|
SerializationHelper.writeJsonFile(
|
||||||
|
knowledgeBlacklistFile,
|
||||||
|
SerializationHelper.GSON.toJson(knowledgeBlacklist)
|
||||||
|
);
|
||||||
|
SerializationHelper.writeJsonFile(
|
||||||
|
exchangeBlacklistFile, SerializationHelper.GSON.toJson(exchangeBlacklist)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.pahimar.ee3.block;
|
package com.pahimar.ee3.block;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.pahimar.ee3.EquivalentExchange3;
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
import com.pahimar.ee3.reference.GUIs;
|
import com.pahimar.ee3.reference.GUIs;
|
||||||
import com.pahimar.ee3.reference.Names;
|
import com.pahimar.ee3.reference.Names;
|
||||||
|
@ -19,12 +21,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.List;
|
public class BlockAlchemicalChest extends BlockTileEntityEE {
|
||||||
|
public BlockAlchemicalChest() {
|
||||||
public class BlockAlchemicalChest extends BlockTileEntityEE
|
|
||||||
{
|
|
||||||
public BlockAlchemicalChest()
|
|
||||||
{
|
|
||||||
super(Material.wood);
|
super(Material.wood);
|
||||||
this.setHardness(2.5f);
|
this.setHardness(2.5f);
|
||||||
this.setBlockName(Names.Blocks.ALCHEMICAL_CHEST);
|
this.setBlockName(Names.Blocks.ALCHEMICAL_CHEST);
|
||||||
|
@ -32,18 +30,12 @@ public class BlockAlchemicalChest extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int metaData)
|
public TileEntity createNewTileEntity(World world, int metaData) {
|
||||||
{
|
if (metaData == 0) {
|
||||||
if (metaData == 0)
|
|
||||||
{
|
|
||||||
return new TileEntityAlchemicalChestSmall();
|
return new TileEntityAlchemicalChestSmall();
|
||||||
}
|
} else if (metaData == 1) {
|
||||||
else if (metaData == 1)
|
|
||||||
{
|
|
||||||
return new TileEntityAlchemicalChestMedium();
|
return new TileEntityAlchemicalChestMedium();
|
||||||
}
|
} else if (metaData == 2) {
|
||||||
else if (metaData == 2)
|
|
||||||
{
|
|
||||||
return new TileEntityAlchemicalChestLarge();
|
return new TileEntityAlchemicalChestLarge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,41 +43,51 @@ public class BlockAlchemicalChest extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int metaData)
|
public int damageDropped(int metaData) {
|
||||||
{
|
|
||||||
return metaData;
|
return metaData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock()
|
public boolean renderAsNormalBlock() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube()
|
public boolean isOpaqueCube() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType()
|
public int getRenderType() {
|
||||||
{
|
|
||||||
return RenderIds.alchemicalChest;
|
return RenderIds.alchemicalChest;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
public boolean onBlockActivated(
|
||||||
{
|
World world,
|
||||||
if ((player.isSneaking() && player.getCurrentEquippedItem() != null) || world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN))
|
int x,
|
||||||
{
|
int y,
|
||||||
|
int z,
|
||||||
|
EntityPlayer player,
|
||||||
|
int par6,
|
||||||
|
float par7,
|
||||||
|
float par8,
|
||||||
|
float par9
|
||||||
|
) {
|
||||||
|
if ((player.isSneaking() && player.getCurrentEquippedItem() != null)
|
||||||
|
|| world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else
|
if (!world.isRemote
|
||||||
{
|
&& world.getTileEntity(x, y, z) instanceof TileEntityAlchemicalChest) {
|
||||||
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityAlchemicalChest)
|
player.openGui(
|
||||||
{
|
EquivalentExchange3.instance,
|
||||||
player.openGui(EquivalentExchange3.instance, GUIs.ALCHEMICAL_CHEST.ordinal(), world, x, y, z);
|
GUIs.ALCHEMICAL_CHEST.ordinal(),
|
||||||
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -94,10 +96,8 @@ public class BlockAlchemicalChest extends BlockTileEntityEE
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list)
|
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||||
{
|
for (int meta = 0; meta < 3; meta++) {
|
||||||
for (int meta = 0; meta < 3; meta++)
|
|
||||||
{
|
|
||||||
list.add(new ItemStack(item, 1, meta));
|
list.add(new ItemStack(item, 1, meta));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.pahimar.ee3.block;
|
package com.pahimar.ee3.block;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.pahimar.ee3.reference.Names;
|
import com.pahimar.ee3.reference.Names;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
@ -11,16 +14,11 @@ import net.minecraft.util.IIcon;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.List;
|
public class BlockAlchemicalFuel extends BlockEE {
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
public class BlockAlchemicalFuel extends BlockEE
|
|
||||||
{
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon[] blockTop, blockSide;
|
private IIcon[] blockTop, blockSide;
|
||||||
|
|
||||||
public BlockAlchemicalFuel()
|
public BlockAlchemicalFuel() {
|
||||||
{
|
|
||||||
super();
|
super();
|
||||||
this.setBlockName(Names.Blocks.ALCHEMICAL_FUEL);
|
this.setBlockName(Names.Blocks.ALCHEMICAL_FUEL);
|
||||||
this.setHardness(5.0f);
|
this.setHardness(5.0f);
|
||||||
|
@ -28,53 +26,54 @@ public class BlockAlchemicalFuel extends BlockEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int par1, Random random, int par2)
|
public Item getItemDropped(int par1, Random random, int par2) {
|
||||||
{
|
|
||||||
return Item.getItemFromBlock(this);
|
return Item.getItemFromBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list)
|
public void getSubBlocks(Item item, CreativeTabs creativeTabs, List list) {
|
||||||
{
|
for (int meta = 0; meta < Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length; meta++) {
|
||||||
for (int meta = 0; meta < Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length; meta++)
|
|
||||||
{
|
|
||||||
list.add(new ItemStack(item, 1, meta));
|
list.add(new ItemStack(item, 1, meta));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int metaData)
|
public int damageDropped(int metaData) {
|
||||||
{
|
|
||||||
return metaData;
|
return metaData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister)
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
{
|
|
||||||
this.blockTop = new IIcon[Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length];
|
this.blockTop = new IIcon[Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length];
|
||||||
this.blockSide = new IIcon[Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length];
|
this.blockSide = new IIcon[Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length];
|
||||||
|
|
||||||
for (int i = 0; i < Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length; i++)
|
for (int i = 0; i < Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length; i++) {
|
||||||
{
|
blockTop[i] = iconRegister.registerIcon(String.format(
|
||||||
blockTop[i] = iconRegister.registerIcon(String.format("%s.%s_top", getUnwrappedUnlocalizedName(this.getUnlocalizedName()), Names.Items.ALCHEMICAL_FUEL_SUBTYPES[i]));
|
"%s.%s_top",
|
||||||
blockSide[i] = iconRegister.registerIcon(String.format("%s.%s_side", getUnwrappedUnlocalizedName(this.getUnlocalizedName()), Names.Items.ALCHEMICAL_FUEL_SUBTYPES[i]));
|
getUnwrappedUnlocalizedName(this.getUnlocalizedName()),
|
||||||
|
Names.Items.ALCHEMICAL_FUEL_SUBTYPES[i]
|
||||||
|
));
|
||||||
|
blockSide[i] = iconRegister.registerIcon(String.format(
|
||||||
|
"%s.%s_side",
|
||||||
|
getUnwrappedUnlocalizedName(this.getUnlocalizedName()),
|
||||||
|
Names.Items.ALCHEMICAL_FUEL_SUBTYPES[i]
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metaData)
|
public IIcon getIcon(int side, int metaData) {
|
||||||
{
|
metaData = MathHelper.clamp_int(
|
||||||
metaData = MathHelper.clamp_int(metaData, 0, Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length - 1);
|
metaData, 0, Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length - 1
|
||||||
|
);
|
||||||
|
|
||||||
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP || ForgeDirection.getOrientation(side) == ForgeDirection.DOWN)
|
if (ForgeDirection.getOrientation(side) == ForgeDirection.UP
|
||||||
{
|
|| ForgeDirection.getOrientation(side) == ForgeDirection.DOWN) {
|
||||||
return blockTop[metaData];
|
return blockTop[metaData];
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return blockSide[metaData];
|
return blockSide[metaData];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.pahimar.ee3.block;
|
package com.pahimar.ee3.block;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.array.AlchemyArray;
|
import com.pahimar.ee3.api.array.AlchemyArray;
|
||||||
import com.pahimar.ee3.array.AlchemyArrayRegistry;
|
import com.pahimar.ee3.array.AlchemyArrayRegistry;
|
||||||
import com.pahimar.ee3.reference.Names;
|
import com.pahimar.ee3.reference.Names;
|
||||||
|
@ -25,41 +27,33 @@ import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockAlchemyArray extends BlockTileEntityEE {
|
||||||
|
public BlockAlchemyArray() {
|
||||||
public class BlockAlchemyArray extends BlockTileEntityEE
|
|
||||||
{
|
|
||||||
public BlockAlchemyArray()
|
|
||||||
{
|
|
||||||
super(Material.circuits);
|
super(Material.circuits);
|
||||||
this.setCreativeTab(null);
|
this.setCreativeTab(null);
|
||||||
this.setBlockName(Names.Blocks.ALCHEMY_ARRAY);
|
this.setBlockName(Names.Blocks.ALCHEMY_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock()
|
public boolean renderAsNormalBlock() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube()
|
public boolean isOpaqueCube() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType()
|
public int getRenderType() {
|
||||||
{
|
|
||||||
return RenderIds.alchemyArray;
|
return RenderIds.alchemyArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||||
{
|
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
|
TileEntityAlchemyArray tileEntityAlchemyArray
|
||||||
{
|
= (TileEntityAlchemyArray) world.getTileEntity(x, y, z);
|
||||||
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
return tileEntityAlchemyArray.getLightLevel();
|
return tileEntityAlchemyArray.getLightLevel();
|
||||||
}
|
}
|
||||||
|
@ -68,56 +62,46 @@ public class BlockAlchemyArray extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int par1, Random random, int par2)
|
public Item getItemDropped(int par1, Random random, int par2) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z)
|
public void
|
||||||
{
|
setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z) {
|
||||||
if (iBlockAccess.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
|
if (iBlockAccess.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray) {
|
||||||
{
|
TileEntityAlchemyArray tileEntityAlchemyArray
|
||||||
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) iBlockAccess.getTileEntity(x, y, z);
|
= (TileEntityAlchemyArray) iBlockAccess.getTileEntity(x, y, z);
|
||||||
|
|
||||||
switch (tileEntityAlchemyArray.getOrientation())
|
switch (tileEntityAlchemyArray.getOrientation()) {
|
||||||
{
|
case DOWN: {
|
||||||
case DOWN:
|
|
||||||
{
|
|
||||||
this.setBlockBounds(0f, 1f, 0f, 1f, 1 - 0.0625f, 1f);
|
this.setBlockBounds(0f, 1f, 0f, 1f, 1 - 0.0625f, 1f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UP:
|
case UP: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.0625f, 1f);
|
this.setBlockBounds(0f, 0f, 0f, 1f, 0.0625f, 1f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NORTH:
|
case NORTH: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0f, 0f, 1 - 0.0625f, 1f, 1f, 1f);
|
this.setBlockBounds(0f, 0f, 1 - 0.0625f, 1f, 1f, 1f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SOUTH:
|
case SOUTH: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0f, 0f, 0f, 1f, 1f, 0.0625f);
|
this.setBlockBounds(0f, 0f, 0f, 1f, 1f, 0.0625f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EAST:
|
case EAST: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0f, 0f, 0f, 0.0625f, 1f, 1f);
|
this.setBlockBounds(0f, 0f, 0f, 0.0625f, 1f, 1f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WEST:
|
case WEST: {
|
||||||
{
|
|
||||||
this.setBlockBounds(1f, 0f, 0f, 1 - 0.0625f, 1f, 1f);
|
this.setBlockBounds(1f, 0f, 0f, 1 - 0.0625f, 1f, 1f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UNKNOWN:
|
case UNKNOWN: {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.0625f, 1f);
|
this.setBlockBounds(0f, 0f, 0f, 1f, 0.0625f, 1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,50 +109,55 @@ public class BlockAlchemyArray extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockAt(World world, int x, int y, int z)
|
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
|
||||||
{
|
return world.getBlock(x, y, z).isReplaceable(world, x, y, z)
|
||||||
return world.getBlock(x, y, z).isReplaceable(world, x, y, z) && (world.isSideSolid(x - 1, y, z, ForgeDirection.EAST) ||
|
&& (world.isSideSolid(x - 1, y, z, ForgeDirection.EAST)
|
||||||
world.isSideSolid(x + 1, y, z, ForgeDirection.WEST) ||
|
|| world.isSideSolid(x + 1, y, z, ForgeDirection.WEST)
|
||||||
world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH) ||
|
|| world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH)
|
||||||
world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH) ||
|
|| world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH)
|
||||||
world.isSideSolid(x, y - 1, z, ForgeDirection.UP) ||
|
|| world.isSideSolid(x, y - 1, z, ForgeDirection.UP)
|
||||||
world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN));
|
|| world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int sideHit)
|
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int sideHit) {
|
||||||
{
|
|
||||||
ForgeDirection side = ForgeDirection.getOrientation(sideHit);
|
ForgeDirection side = ForgeDirection.getOrientation(sideHit);
|
||||||
return world.getBlock(x, y, z).isReplaceable(world, x, y, z) && ((side == ForgeDirection.DOWN && world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) ||
|
return world.getBlock(x, y, z).isReplaceable(world, x, y, z)
|
||||||
(side == ForgeDirection.UP && world.isSideSolid(x, y - 1, z, ForgeDirection.UP)) ||
|
&& ((side == ForgeDirection.DOWN
|
||||||
(side == ForgeDirection.NORTH && world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH)) ||
|
&& world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN))
|
||||||
(side == ForgeDirection.SOUTH && world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH)) ||
|
|| (side == ForgeDirection.UP
|
||||||
(side == ForgeDirection.WEST && world.isSideSolid(x + 1, y, z, ForgeDirection.WEST)) ||
|
&& world.isSideSolid(x, y - 1, z, ForgeDirection.UP))
|
||||||
(side == ForgeDirection.EAST && world.isSideSolid(x - 1, y, z, ForgeDirection.EAST)));
|
|| (side == ForgeDirection.NORTH
|
||||||
|
&& world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH))
|
||||||
|
|| (side == ForgeDirection.SOUTH
|
||||||
|
&& world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH))
|
||||||
|
|| (side == ForgeDirection.WEST
|
||||||
|
&& world.isSideSolid(x + 1, y, z, ForgeDirection.WEST))
|
||||||
|
|| (side == ForgeDirection.EAST
|
||||||
|
&& world.isSideSolid(x - 1, y, z, ForgeDirection.EAST)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side)
|
public boolean
|
||||||
{
|
isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
|
public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
{
|
if (!world.isRemote
|
||||||
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
|
&& world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray) {
|
||||||
{
|
TileEntityAlchemyArray tileEntityAlchemyArray
|
||||||
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(x, y, z);
|
= (TileEntityAlchemyArray) world.getTileEntity(x, y, z);
|
||||||
boolean invalidateAlchemyArray = false;
|
boolean invalidateAlchemyArray = false;
|
||||||
|
|
||||||
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP && !world.isSideSolid(x, y - 1, z, ForgeDirection.UP, true))
|
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP
|
||||||
{
|
&& !world.isSideSolid(x, y - 1, z, ForgeDirection.UP, true)) {
|
||||||
invalidateAlchemyArray = true;
|
invalidateAlchemyArray = true;
|
||||||
}
|
}
|
||||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.DOWN && !world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, true))
|
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.DOWN && !world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, true))
|
||||||
|
@ -192,8 +181,7 @@ public class BlockAlchemyArray extends BlockTileEntityEE
|
||||||
invalidateAlchemyArray = true;
|
invalidateAlchemyArray = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invalidateAlchemyArray)
|
if (invalidateAlchemyArray) {
|
||||||
{
|
|
||||||
tileEntityAlchemyArray.invalidate();
|
tileEntityAlchemyArray.invalidate();
|
||||||
world.setBlockToAir(x, y, z);
|
world.setBlockToAir(x, y, z);
|
||||||
}
|
}
|
||||||
|
@ -201,95 +189,137 @@ public class BlockAlchemyArray extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData)
|
public int onBlockPlaced(
|
||||||
{
|
World world,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int z,
|
||||||
|
int sideHit,
|
||||||
|
float hitX,
|
||||||
|
float hitY,
|
||||||
|
float hitZ,
|
||||||
|
int metaData
|
||||||
|
) {
|
||||||
return sideHit;
|
return sideHit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
|
public void onBlockPlacedBy(
|
||||||
{
|
World world,
|
||||||
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray && entityLiving instanceof EntityPlayer)
|
int x,
|
||||||
{
|
int y,
|
||||||
NBTTagCompound customEntityData = EntityHelper.getCustomEntityData(entityLiving);
|
int z,
|
||||||
|
EntityLivingBase entityLiving,
|
||||||
|
ItemStack itemStack
|
||||||
|
) {
|
||||||
|
if (!world.isRemote
|
||||||
|
&& world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray
|
||||||
|
&& entityLiving instanceof EntityPlayer) {
|
||||||
|
NBTTagCompound customEntityData
|
||||||
|
= EntityHelper.getCustomEntityData(entityLiving);
|
||||||
ChalkSettings chalkSettings = new ChalkSettings();
|
ChalkSettings chalkSettings = new ChalkSettings();
|
||||||
chalkSettings.readFromNBT(customEntityData);
|
chalkSettings.readFromNBT(customEntityData);
|
||||||
AlchemyArray alchemyArray = AlchemyArrayRegistry.getInstance().getAlchemyArray(chalkSettings.getIndex());
|
AlchemyArray alchemyArray
|
||||||
|
= AlchemyArrayRegistry.getInstance().getAlchemyArray(
|
||||||
|
chalkSettings.getIndex()
|
||||||
|
);
|
||||||
|
|
||||||
if (alchemyArray != null)
|
if (alchemyArray != null) {
|
||||||
{
|
|
||||||
// Set adjusted rotation
|
// Set adjusted rotation
|
||||||
int facing = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
int facing = MathHelper.floor_double(
|
||||||
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z), 3);
|
entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D
|
||||||
((TileEntityEE) world.getTileEntity(x, y, z)).setOrientation(world.getBlockMetadata(x, y, z));
|
)
|
||||||
((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).setRotation(chalkSettings.getRotation(), facing);
|
& 3;
|
||||||
((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).setAlchemyArray(alchemyArray, chalkSettings.getSize());
|
world.setBlockMetadataWithNotify(
|
||||||
CommonSoundHelper.playSoundAtPlayer((EntityPlayer) entityLiving, Sounds.Chalk.getRandomChalkSound(), 1f, 1f);
|
x, y, z, world.getBlockMetadata(x, y, z), 3
|
||||||
|
);
|
||||||
|
((TileEntityEE) world.getTileEntity(x, y, z))
|
||||||
|
.setOrientation(world.getBlockMetadata(x, y, z));
|
||||||
|
((TileEntityAlchemyArray) world.getTileEntity(x, y, z))
|
||||||
|
.setRotation(chalkSettings.getRotation(), facing);
|
||||||
|
((TileEntityAlchemyArray) world.getTileEntity(x, y, z))
|
||||||
|
.setAlchemyArray(alchemyArray, chalkSettings.getSize());
|
||||||
|
CommonSoundHelper.playSoundAtPlayer(
|
||||||
|
(EntityPlayer) entityLiving,
|
||||||
|
Sounds.Chalk.getRandomChalkSound(),
|
||||||
|
1f,
|
||||||
|
1f
|
||||||
|
);
|
||||||
|
|
||||||
((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
|
((TileEntityAlchemyArray) world.getTileEntity(x, y, z))
|
||||||
|
.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(
|
||||||
{
|
World world,
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
|
int x,
|
||||||
{
|
int y,
|
||||||
((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).onBlockActivated(world, x, y, z, entityPlayer, sideHit, hitX, hitY, hitZ);
|
int z,
|
||||||
|
EntityPlayer entityPlayer,
|
||||||
|
int sideHit,
|
||||||
|
float hitX,
|
||||||
|
float hitY,
|
||||||
|
float hitZ
|
||||||
|
) {
|
||||||
|
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray) {
|
||||||
|
((TileEntityAlchemyArray) world.getTileEntity(x, y, z))
|
||||||
|
.onBlockActivated(
|
||||||
|
world, x, y, z, entityPlayer, sideHit, hitX, hitY, hitZ
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer entityPlayer)
|
public void
|
||||||
{
|
onBlockClicked(World world, int x, int y, int z, EntityPlayer entityPlayer) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
|
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray) {
|
||||||
{
|
((TileEntityAlchemyArray) world.getTileEntity(x, y, z))
|
||||||
((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).onBlockClicked(world, x, y, z, entityPlayer);
|
.onBlockClicked(world, x, y, z, entityPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion)
|
public void
|
||||||
{
|
onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
|
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray) {
|
||||||
{
|
((TileEntityAlchemyArray) world.getTileEntity(x, y, z))
|
||||||
((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).onBlockDestroyedByExplosion(world, x, y, z, explosion);
|
.onBlockDestroyedByExplosion(world, x, y, z, explosion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int metaData)
|
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int metaData) {
|
||||||
{
|
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
|
((TileEntityAlchemyArray) world.getTileEntity(x, y, z))
|
||||||
{
|
.onBlockDestroyedByPlayer(world, x, y, z, metaData);
|
||||||
((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).onBlockDestroyedByPlayer(world, x, y, z, metaData);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
|
public void
|
||||||
{
|
onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
|
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray) {
|
||||||
{
|
((TileEntityAlchemyArray) world.getTileEntity(x, y, z))
|
||||||
((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).onEntityCollidedWithBlock(world, x, y, z, entity);
|
.onEntityCollidedWithBlock(world, x, y, z, entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFallenUpon(World world, int x, int y, int z, Entity entity, float fallDistance)
|
public void
|
||||||
{
|
onFallenUpon(World world, int x, int y, int z, Entity entity, float fallDistance) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray)
|
if (world.getTileEntity(x, y, z) instanceof TileEntityAlchemyArray) {
|
||||||
{
|
((TileEntityAlchemyArray) world.getTileEntity(x, y, z))
|
||||||
((TileEntityAlchemyArray) world.getTileEntity(x, y, z)).onFallenUpon(world, x, y, z, entity, fallDistance);
|
.onFallenUpon(world, x, y, z, entity, fallDistance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int metaData)
|
public TileEntity createNewTileEntity(World world, int metaData) {
|
||||||
{
|
|
||||||
return new TileEntityAlchemyArray();
|
return new TileEntityAlchemyArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.pahimar.ee3.block;
|
package com.pahimar.ee3.block;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.pahimar.ee3.EquivalentExchange3;
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
import com.pahimar.ee3.init.ModBlocks;
|
import com.pahimar.ee3.init.ModBlocks;
|
||||||
import com.pahimar.ee3.reference.GUIs;
|
import com.pahimar.ee3.reference.GUIs;
|
||||||
|
@ -19,12 +21,8 @@ import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockAludel extends BlockTileEntityEE {
|
||||||
|
public BlockAludel() {
|
||||||
public class BlockAludel extends BlockTileEntityEE
|
|
||||||
{
|
|
||||||
public BlockAludel()
|
|
||||||
{
|
|
||||||
super(Material.anvil);
|
super(Material.anvil);
|
||||||
this.setHardness(5.0f);
|
this.setHardness(5.0f);
|
||||||
this.setBlockName(Names.Blocks.ALUDEL);
|
this.setBlockName(Names.Blocks.ALUDEL);
|
||||||
|
@ -32,93 +30,165 @@ public class BlockAludel extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int metaData)
|
public TileEntity createNewTileEntity(World world, int metaData) {
|
||||||
{
|
|
||||||
return new TileEntityAludel();
|
return new TileEntityAludel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock()
|
public boolean renderAsNormalBlock() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType()
|
public int getRenderType() {
|
||||||
{
|
|
||||||
return RenderIds.aludel;
|
return RenderIds.aludel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube()
|
public boolean isOpaqueCube() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||||
{
|
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if (tile instanceof TileEntityAludel)
|
if (tile instanceof TileEntityAludel) {
|
||||||
{
|
if (((TileEntityAludel) tile).getState() == 1) {
|
||||||
if (((TileEntityAludel) tile).getState() == 1)
|
switch (((TileEntityAludel) tile).getOrientation()) {
|
||||||
{
|
|
||||||
switch (((TileEntityAludel) tile).getOrientation())
|
|
||||||
{
|
|
||||||
case NORTH:
|
case NORTH:
|
||||||
world.spawnParticle(Particles.FLAME, (double) x + 0.5F, (double) y + 0.33F, (double) z + 0.175F, 0.0D, 0.0D, 0.0D);
|
world.spawnParticle(
|
||||||
|
Particles.FLAME,
|
||||||
|
(double) x + 0.5F,
|
||||||
|
(double) y + 0.33F,
|
||||||
|
(double) z + 0.175F,
|
||||||
|
0.0D,
|
||||||
|
0.0D,
|
||||||
|
0.0D
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
world.spawnParticle(Particles.FLAME, (double) x + 0.5F, (double) y + 0.33F, (double) z + 0.825F, 0.0D, 0.0D, 0.0D);
|
world.spawnParticle(
|
||||||
|
Particles.FLAME,
|
||||||
|
(double) x + 0.5F,
|
||||||
|
(double) y + 0.33F,
|
||||||
|
(double) z + 0.825F,
|
||||||
|
0.0D,
|
||||||
|
0.0D,
|
||||||
|
0.0D
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
world.spawnParticle(Particles.FLAME, (double) x + 0.175F, (double) y + 0.33F, (double) z + 0.5F, 0.0D, 0.0D, 0.0D);
|
world.spawnParticle(
|
||||||
|
Particles.FLAME,
|
||||||
|
(double) x + 0.175F,
|
||||||
|
(double) y + 0.33F,
|
||||||
|
(double) z + 0.5F,
|
||||||
|
0.0D,
|
||||||
|
0.0D,
|
||||||
|
0.0D
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
world.spawnParticle(Particles.FLAME, (double) x + 0.825F, (double) y + 0.33F, (double) z + 0.5F, 0.0D, 0.0D, 0.0D);
|
world.spawnParticle(
|
||||||
|
Particles.FLAME,
|
||||||
|
(double) x + 0.825F,
|
||||||
|
(double) y + 0.33F,
|
||||||
|
(double) z + 0.5F,
|
||||||
|
0.0D,
|
||||||
|
0.0D,
|
||||||
|
0.0D
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.5F, (double) y + 0.7F, (double) z + 0.0F, 0.0D, 0.05D, 0.0D);
|
world.spawnParticle(
|
||||||
world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.5F, (double) y + 0.7F, (double) z + 1.0F, 0.0D, 0.05D, 0.0D);
|
Particles.NORMAL_SMOKE,
|
||||||
world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.0F, (double) y + 0.7F, (double) z + 0.5F, 0.0D, 0.05D, 0.0D);
|
(double) x + 0.5F,
|
||||||
world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 1.0F, (double) y + 0.7F, (double) z + 0.5F, 0.0D, 0.05D, 0.0D);
|
(double) y + 0.7F,
|
||||||
|
(double) z + 0.0F,
|
||||||
|
0.0D,
|
||||||
|
0.05D,
|
||||||
|
0.0D
|
||||||
|
);
|
||||||
|
world.spawnParticle(
|
||||||
|
Particles.NORMAL_SMOKE,
|
||||||
|
(double) x + 0.5F,
|
||||||
|
(double) y + 0.7F,
|
||||||
|
(double) z + 1.0F,
|
||||||
|
0.0D,
|
||||||
|
0.05D,
|
||||||
|
0.0D
|
||||||
|
);
|
||||||
|
world.spawnParticle(
|
||||||
|
Particles.NORMAL_SMOKE,
|
||||||
|
(double) x + 0.0F,
|
||||||
|
(double) y + 0.7F,
|
||||||
|
(double) z + 0.5F,
|
||||||
|
0.0D,
|
||||||
|
0.05D,
|
||||||
|
0.0D
|
||||||
|
);
|
||||||
|
world.spawnParticle(
|
||||||
|
Particles.NORMAL_SMOKE,
|
||||||
|
(double) x + 1.0F,
|
||||||
|
(double) y + 0.7F,
|
||||||
|
(double) z + 0.5F,
|
||||||
|
0.0D,
|
||||||
|
0.05D,
|
||||||
|
0.0D
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
{
|
TileEntityAludel tileEntityAludel
|
||||||
TileEntityAludel tileEntityAludel = (TileEntityAludel) world.getTileEntity(x, y, z);
|
= (TileEntityAludel) world.getTileEntity(x, y, z);
|
||||||
tileEntityAludel.hasGlassBell = world.getTileEntity(x, y + 1, z) instanceof TileEntityGlassBell;
|
tileEntityAludel.hasGlassBell
|
||||||
|
= world.getTileEntity(x, y + 1, z) instanceof TileEntityGlassBell;
|
||||||
|
|
||||||
super.onNeighborBlockChange(world, x, y, z, block);
|
super.onNeighborBlockChange(world, x, y, z, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int faceHit, float par7, float par8, float par9)
|
public boolean onBlockActivated(
|
||||||
{
|
World world,
|
||||||
if (player.isSneaking())
|
int x,
|
||||||
{
|
int y,
|
||||||
|
int z,
|
||||||
|
EntityPlayer player,
|
||||||
|
int faceHit,
|
||||||
|
float par7,
|
||||||
|
float par8,
|
||||||
|
float par9
|
||||||
|
) {
|
||||||
|
if (player.isSneaking()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else
|
if (!world.isRemote) {
|
||||||
{
|
if (world.getTileEntity(x, y, z) instanceof TileEntityAludel
|
||||||
if (!world.isRemote)
|
&& world.getTileEntity(x, y + 1, z) instanceof TileEntityGlassBell) {
|
||||||
{
|
player.openGui(
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityAludel && world.getTileEntity(x, y + 1, z) instanceof TileEntityGlassBell)
|
EquivalentExchange3.instance,
|
||||||
{
|
GUIs.ALUDEL.ordinal(),
|
||||||
player.openGui(EquivalentExchange3.instance, GUIs.ALUDEL.ordinal(), world, x, y, z);
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityAludel && ModBlocks.glassBell.canPlaceBlockAt(world, x, y + 1, z) && faceHit == ForgeDirection.UP.ordinal())
|
if (world.getTileEntity(x, y, z) instanceof TileEntityAludel
|
||||||
{
|
&& ModBlocks.glassBell.canPlaceBlockAt(world, x, y + 1, z)
|
||||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemBlock && ((ItemBlock) player.getHeldItem().getItem()).field_150939_a == ModBlocks.glassBell)
|
&& faceHit == ForgeDirection.UP.ordinal()) {
|
||||||
{
|
if (player.getHeldItem() != null
|
||||||
|
&& player.getHeldItem().getItem() instanceof ItemBlock
|
||||||
|
&& ((ItemBlock) player.getHeldItem().getItem()).field_150939_a
|
||||||
|
== ModBlocks.glassBell) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,12 +198,9 @@ public class BlockAludel extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||||
{
|
if (world.getTileEntity(x, y, z) instanceof TileEntityAludel) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityAludel)
|
if (((TileEntityAludel) world.getTileEntity(x, y, z)).getState() == 1) {
|
||||||
{
|
|
||||||
if (((TileEntityAludel) world.getTileEntity(x, y, z)).getState() == 1)
|
|
||||||
{
|
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,12 +209,11 @@ public class BlockAludel extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||||
{
|
if (world.getTileEntity(x, y + 1, z) instanceof TileEntityGlassBell) {
|
||||||
if (world.getTileEntity(x, y + 1, z) instanceof TileEntityGlassBell)
|
|
||||||
{
|
|
||||||
world.markBlockForUpdate(x, y + 1, z);
|
world.markBlockForUpdate(x, y + 1, z);
|
||||||
// NAME UPDATE - this.worldObj.updateAllLightTypes(this.xCoord, this.yCoord, this.zCoord);
|
// NAME UPDATE - this.worldObj.updateAllLightTypes(this.xCoord, this.yCoord,
|
||||||
|
// this.zCoord);
|
||||||
world.func_147451_t(x, y + 1, z);
|
world.func_147451_t(x, y + 1, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,25 +221,37 @@ public class BlockAludel extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
|
public void onBlockPlacedBy(
|
||||||
{
|
World world,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int z,
|
||||||
|
EntityLivingBase entityLiving,
|
||||||
|
ItemStack itemStack
|
||||||
|
) {
|
||||||
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
|
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
|
||||||
|
|
||||||
if (world.getTileEntity(x, y + 1, z) instanceof TileEntityGlassBell)
|
if (world.getTileEntity(x, y + 1, z) instanceof TileEntityGlassBell) {
|
||||||
{
|
TileEntityGlassBell tileEntityGlassBell
|
||||||
TileEntityGlassBell tileEntityGlassBell = (TileEntityGlassBell) world.getTileEntity(x, y + 1, z);
|
= (TileEntityGlassBell) world.getTileEntity(x, y + 1, z);
|
||||||
|
|
||||||
tileEntityGlassBell.setOrientation(ForgeDirection.UP);
|
tileEntityGlassBell.setOrientation(ForgeDirection.UP);
|
||||||
|
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityAludel)
|
if (world.getTileEntity(x, y, z) instanceof TileEntityAludel) {
|
||||||
{
|
TileEntityAludel tileEntityAludel
|
||||||
TileEntityAludel tileEntityAludel = (TileEntityAludel) world.getTileEntity(x, y, z);
|
= (TileEntityAludel) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
ItemStack itemStackGlassBell = tileEntityGlassBell.getStackInSlot(TileEntityGlassBell.DISPLAY_SLOT_INVENTORY_INDEX);
|
ItemStack itemStackGlassBell = tileEntityGlassBell.getStackInSlot(
|
||||||
|
TileEntityGlassBell.DISPLAY_SLOT_INVENTORY_INDEX
|
||||||
|
);
|
||||||
|
|
||||||
tileEntityGlassBell.setInventorySlotContents(TileEntityGlassBell.DISPLAY_SLOT_INVENTORY_INDEX, null);
|
tileEntityGlassBell.setInventorySlotContents(
|
||||||
|
TileEntityGlassBell.DISPLAY_SLOT_INVENTORY_INDEX, null
|
||||||
|
);
|
||||||
|
|
||||||
tileEntityAludel.setInventorySlotContents(TileEntityAludel.INPUT_INVENTORY_INDEX, itemStackGlassBell);
|
tileEntityAludel.setInventorySlotContents(
|
||||||
|
TileEntityAludel.INPUT_INVENTORY_INDEX, itemStackGlassBell
|
||||||
|
);
|
||||||
|
|
||||||
tileEntityAludel.hasGlassBell = true;
|
tileEntityAludel.hasGlassBell = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,8 @@ package com.pahimar.ee3.block;
|
||||||
import com.pahimar.ee3.reference.Names;
|
import com.pahimar.ee3.reference.Names;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
|
||||||
public class BlockAshInfusedStone extends BlockEE
|
public class BlockAshInfusedStone extends BlockEE {
|
||||||
{
|
public BlockAshInfusedStone() {
|
||||||
public BlockAshInfusedStone()
|
|
||||||
{
|
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
this.setBlockName(Names.Blocks.ASH_INFUSED_STONE);
|
this.setBlockName(Names.Blocks.ASH_INFUSED_STONE);
|
||||||
this.setHardness(1.5f);
|
this.setHardness(1.5f);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.pahimar.ee3.block;
|
package com.pahimar.ee3.block;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.pahimar.ee3.creativetab.CreativeTab;
|
import com.pahimar.ee3.creativetab.CreativeTab;
|
||||||
import com.pahimar.ee3.init.ModBlocks;
|
import com.pahimar.ee3.init.ModBlocks;
|
||||||
import com.pahimar.ee3.reference.Names;
|
import com.pahimar.ee3.reference.Names;
|
||||||
|
@ -19,15 +21,12 @@ import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.List;
|
public class BlockAshInfusedStoneSlab extends BlockSlab {
|
||||||
|
|
||||||
public class BlockAshInfusedStoneSlab extends BlockSlab
|
|
||||||
{
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
protected IIcon blockIcon, sideVariant1, sideVariant2, topVariant1, topVariant2, topVariant3, topVariant4;
|
protected IIcon blockIcon, sideVariant1, sideVariant2, topVariant1, topVariant2,
|
||||||
|
topVariant3, topVariant4;
|
||||||
|
|
||||||
public BlockAshInfusedStoneSlab()
|
public BlockAshInfusedStoneSlab() {
|
||||||
{
|
|
||||||
super(false, Material.rock);
|
super(false, Material.rock);
|
||||||
this.setCreativeTab(CreativeTab.EE3_TAB);
|
this.setCreativeTab(CreativeTab.EE3_TAB);
|
||||||
this.setHardness(2.0f);
|
this.setHardness(2.0f);
|
||||||
|
@ -35,65 +34,72 @@ public class BlockAshInfusedStoneSlab extends BlockSlab
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z)
|
public void
|
||||||
{
|
setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z) {
|
||||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLightOpacity()
|
public int getLightOpacity() {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the
|
* Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the
|
||||||
* mask.) Parameters: World, X, Y, Z, mask, list, colliding entity
|
* list if they intersect the mask.) Parameters: World, X, Y, Z, mask, list, colliding
|
||||||
|
* entity
|
||||||
*/
|
*/
|
||||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisAlignedBB, List list, Entity entity)
|
public void addCollisionBoxesToList(
|
||||||
{
|
World world,
|
||||||
if (isAssociatedWithValidTablet(world, x, y, z))
|
int x,
|
||||||
{
|
int y,
|
||||||
|
int z,
|
||||||
|
AxisAlignedBB axisAlignedBB,
|
||||||
|
List list,
|
||||||
|
Entity entity
|
||||||
|
) {
|
||||||
|
if (isAssociatedWithValidTablet(world, x, y, z)) {
|
||||||
int metaData = world.getBlockMetadata(x, y, z);
|
int metaData = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
if (metaData == 1)
|
if (metaData == 1) {
|
||||||
{
|
|
||||||
this.setBlockBounds(0.5F, 0.0F, 0.5F, 1.0F, 0.625F, 1.0F);
|
this.setBlockBounds(0.5F, 0.0F, 0.5F, 1.0F, 0.625F, 1.0F);
|
||||||
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
|
super.addCollisionBoxesToList(
|
||||||
}
|
world, x, y, z, axisAlignedBB, list, entity
|
||||||
else if (metaData == 2)
|
);
|
||||||
{
|
} else if (metaData == 2) {
|
||||||
this.setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.625F, 1.0F);
|
this.setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.625F, 1.0F);
|
||||||
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
|
super.addCollisionBoxesToList(
|
||||||
}
|
world, x, y, z, axisAlignedBB, list, entity
|
||||||
else if (metaData == 3)
|
);
|
||||||
{
|
} else if (metaData == 3) {
|
||||||
this.setBlockBounds(0.0F, 0.0F, 1.0F, 0.5F, 0.625F, 0.5F);
|
this.setBlockBounds(0.0F, 0.0F, 1.0F, 0.5F, 0.625F, 0.5F);
|
||||||
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
|
super.addCollisionBoxesToList(
|
||||||
}
|
world, x, y, z, axisAlignedBB, list, entity
|
||||||
else if (metaData == 4)
|
);
|
||||||
{
|
} else if (metaData == 4) {
|
||||||
this.setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F);
|
this.setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F);
|
||||||
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
|
super.addCollisionBoxesToList(
|
||||||
}
|
world, x, y, z, axisAlignedBB, list, entity
|
||||||
else if (metaData == 5)
|
);
|
||||||
{
|
} else if (metaData == 5) {
|
||||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.625F, 1.0F);
|
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.625F, 1.0F);
|
||||||
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
|
super.addCollisionBoxesToList(
|
||||||
}
|
world, x, y, z, axisAlignedBB, list, entity
|
||||||
else if (metaData == 6)
|
);
|
||||||
{
|
} else if (metaData == 6) {
|
||||||
this.setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 0.625F, 0.5F);
|
this.setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 0.625F, 0.5F);
|
||||||
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
|
super.addCollisionBoxesToList(
|
||||||
}
|
world, x, y, z, axisAlignedBB, list, entity
|
||||||
else if (metaData == 7)
|
);
|
||||||
{
|
} else if (metaData == 7) {
|
||||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 0.5F);
|
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 0.5F);
|
||||||
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
|
super.addCollisionBoxesToList(
|
||||||
}
|
world, x, y, z, axisAlignedBB, list, entity
|
||||||
else if (metaData == 8)
|
);
|
||||||
{
|
} else if (metaData == 8) {
|
||||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.625F, 0.5F);
|
this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.625F, 0.5F);
|
||||||
super.addCollisionBoxesToList(world, x, y, z, axisAlignedBB, list, entity);
|
super.addCollisionBoxesToList(
|
||||||
|
world, x, y, z, axisAlignedBB, list, entity
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,54 +108,58 @@ public class BlockAshInfusedStoneSlab extends BlockSlab
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(
|
||||||
{
|
World world,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int z,
|
||||||
|
EntityPlayer entityPlayer,
|
||||||
|
int sideHit,
|
||||||
|
float hitX,
|
||||||
|
float hitY,
|
||||||
|
float hitZ
|
||||||
|
) {
|
||||||
int metaData = world.getBlockMetadata(x, y, z);
|
int metaData = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
int shiftedX = x;
|
int shiftedX = x;
|
||||||
int shiftedZ = z;
|
int shiftedZ = z;
|
||||||
if (metaData != 0)
|
if (metaData != 0) {
|
||||||
{
|
if (metaData == 1) {
|
||||||
if (metaData == 1)
|
|
||||||
{
|
|
||||||
shiftedX++;
|
shiftedX++;
|
||||||
shiftedZ++;
|
shiftedZ++;
|
||||||
}
|
} else if (metaData == 2) {
|
||||||
else if (metaData == 2)
|
|
||||||
{
|
|
||||||
shiftedZ++;
|
shiftedZ++;
|
||||||
}
|
} else if (metaData == 3) {
|
||||||
else if (metaData == 3)
|
|
||||||
{
|
|
||||||
shiftedX--;
|
shiftedX--;
|
||||||
shiftedZ++;
|
shiftedZ++;
|
||||||
}
|
} else if (metaData == 4) {
|
||||||
else if (metaData == 4)
|
|
||||||
{
|
|
||||||
shiftedX++;
|
shiftedX++;
|
||||||
}
|
} else if (metaData == 5) {
|
||||||
else if (metaData == 5)
|
|
||||||
{
|
|
||||||
shiftedX--;
|
shiftedX--;
|
||||||
}
|
} else if (metaData == 6) {
|
||||||
else if (metaData == 6)
|
|
||||||
{
|
|
||||||
shiftedX++;
|
shiftedX++;
|
||||||
shiftedZ--;
|
shiftedZ--;
|
||||||
}
|
} else if (metaData == 7) {
|
||||||
else if (metaData == 7)
|
|
||||||
{
|
|
||||||
shiftedZ--;
|
shiftedZ--;
|
||||||
}
|
} else if (metaData == 8) {
|
||||||
else if (metaData == 8)
|
|
||||||
{
|
|
||||||
shiftedX--;
|
shiftedX--;
|
||||||
shiftedZ--;
|
shiftedZ--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getTileEntity(shiftedX, y, shiftedZ) instanceof TileEntityTransmutationTablet)
|
if (world.getTileEntity(shiftedX, y, shiftedZ)
|
||||||
{
|
instanceof TileEntityTransmutationTablet) {
|
||||||
world.getBlock(shiftedX, y, shiftedZ).onBlockActivated(world, shiftedX, y, shiftedZ, entityPlayer, sideHit, hitX, hitY, hitZ);
|
world.getBlock(shiftedX, y, shiftedZ)
|
||||||
|
.onBlockActivated(
|
||||||
|
world,
|
||||||
|
shiftedX,
|
||||||
|
y,
|
||||||
|
shiftedZ,
|
||||||
|
entityPlayer,
|
||||||
|
sideHit,
|
||||||
|
hitX,
|
||||||
|
hitY,
|
||||||
|
hitZ
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,59 +169,63 @@ public class BlockAshInfusedStoneSlab extends BlockSlab
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister)
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
{
|
blockIcon = iconRegister.registerIcon(
|
||||||
blockIcon = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName())));
|
String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()))
|
||||||
sideVariant1 = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_side1"));
|
);
|
||||||
sideVariant2 = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_side2"));
|
sideVariant1 = iconRegister.registerIcon(String.format(
|
||||||
topVariant1 = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_top1"));
|
"%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_side1"
|
||||||
topVariant2 = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_top2"));
|
));
|
||||||
topVariant3 = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_top3"));
|
sideVariant2 = iconRegister.registerIcon(String.format(
|
||||||
topVariant4 = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_top4"));
|
"%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_side2"
|
||||||
|
));
|
||||||
|
topVariant1 = iconRegister.registerIcon(String.format(
|
||||||
|
"%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_top1"
|
||||||
|
));
|
||||||
|
topVariant2 = iconRegister.registerIcon(String.format(
|
||||||
|
"%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_top2"
|
||||||
|
));
|
||||||
|
topVariant3 = iconRegister.registerIcon(String.format(
|
||||||
|
"%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_top3"
|
||||||
|
));
|
||||||
|
topVariant4 = iconRegister.registerIcon(String.format(
|
||||||
|
"%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()) + "_top4"
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName()
|
public String getUnlocalizedName() {
|
||||||
{
|
return String.format(
|
||||||
return String.format("tile.%s%s", Textures.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
|
"tile.%s%s",
|
||||||
|
Textures.RESOURCE_PREFIX,
|
||||||
|
getUnwrappedUnlocalizedName(super.getUnlocalizedName())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getUnwrappedUnlocalizedName(String unlocalizedName)
|
protected String getUnwrappedUnlocalizedName(String unlocalizedName) {
|
||||||
{
|
|
||||||
return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
|
return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int meta)
|
public IIcon getIcon(int side, int meta) {
|
||||||
{
|
|
||||||
ForgeDirection forgeDirection = ForgeDirection.getOrientation(side);
|
ForgeDirection forgeDirection = ForgeDirection.getOrientation(side);
|
||||||
if (forgeDirection == ForgeDirection.SOUTH || forgeDirection == ForgeDirection.NORTH || forgeDirection == ForgeDirection.EAST || forgeDirection == ForgeDirection.WEST)
|
if (forgeDirection == ForgeDirection.SOUTH
|
||||||
{
|
|| forgeDirection == ForgeDirection.NORTH
|
||||||
if (meta == 1 || meta == 3 || meta == 6 || meta == 8)
|
|| forgeDirection == ForgeDirection.EAST
|
||||||
{
|
|| forgeDirection == ForgeDirection.WEST) {
|
||||||
|
if (meta == 1 || meta == 3 || meta == 6 || meta == 8) {
|
||||||
return this.sideVariant1;
|
return this.sideVariant1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return this.sideVariant2;
|
return this.sideVariant2;
|
||||||
}
|
}
|
||||||
}
|
} else if (forgeDirection == ForgeDirection.UP) {
|
||||||
else if (forgeDirection == ForgeDirection.UP)
|
if (meta == 1) {
|
||||||
{
|
|
||||||
if (meta == 1)
|
|
||||||
{
|
|
||||||
return this.topVariant1;
|
return this.topVariant1;
|
||||||
}
|
} else if (meta == 3) {
|
||||||
else if (meta == 3)
|
|
||||||
{
|
|
||||||
return this.topVariant4;
|
return this.topVariant4;
|
||||||
}
|
} else if (meta == 6) {
|
||||||
else if (meta == 6)
|
|
||||||
{
|
|
||||||
return this.topVariant2;
|
return this.topVariant2;
|
||||||
}
|
} else if (meta == 8) {
|
||||||
else if (meta == 8)
|
|
||||||
{
|
|
||||||
return this.topVariant3;
|
return this.topVariant3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,59 +234,41 @@ public class BlockAshInfusedStoneSlab extends BlockSlab
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String func_150002_b(int meta)
|
public String func_150002_b(int meta) {
|
||||||
{
|
|
||||||
return getUnlocalizedName();
|
return getUnlocalizedName();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAssociatedWithValidTablet(World world, int x, int y, int z)
|
private boolean isAssociatedWithValidTablet(World world, int x, int y, int z) {
|
||||||
{
|
|
||||||
int metaData = world.getBlockMetadata(x, y, z);
|
int metaData = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
if (metaData != 0)
|
if (metaData != 0) {
|
||||||
{
|
|
||||||
int shiftedX = x;
|
int shiftedX = x;
|
||||||
int shiftedZ = z;
|
int shiftedZ = z;
|
||||||
|
|
||||||
if (metaData == 1)
|
if (metaData == 1) {
|
||||||
{
|
|
||||||
shiftedX++;
|
shiftedX++;
|
||||||
shiftedZ++;
|
shiftedZ++;
|
||||||
}
|
} else if (metaData == 2) {
|
||||||
else if (metaData == 2)
|
|
||||||
{
|
|
||||||
shiftedZ++;
|
shiftedZ++;
|
||||||
}
|
} else if (metaData == 3) {
|
||||||
else if (metaData == 3)
|
|
||||||
{
|
|
||||||
shiftedX--;
|
shiftedX--;
|
||||||
shiftedZ++;
|
shiftedZ++;
|
||||||
}
|
} else if (metaData == 4) {
|
||||||
else if (metaData == 4)
|
|
||||||
{
|
|
||||||
shiftedX++;
|
shiftedX++;
|
||||||
}
|
} else if (metaData == 5) {
|
||||||
else if (metaData == 5)
|
|
||||||
{
|
|
||||||
shiftedZ--;
|
shiftedZ--;
|
||||||
}
|
} else if (metaData == 6) {
|
||||||
else if (metaData == 6)
|
|
||||||
{
|
|
||||||
shiftedX++;
|
shiftedX++;
|
||||||
shiftedZ--;
|
shiftedZ--;
|
||||||
}
|
} else if (metaData == 7) {
|
||||||
else if (metaData == 7)
|
|
||||||
{
|
|
||||||
shiftedZ--;
|
shiftedZ--;
|
||||||
}
|
} else if (metaData == 8) {
|
||||||
else if (metaData == 8)
|
|
||||||
{
|
|
||||||
shiftedX--;
|
shiftedX--;
|
||||||
shiftedZ--;
|
shiftedZ--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getTileEntity(shiftedX, y, shiftedZ) instanceof TileEntityTransmutationTablet)
|
if (world.getTileEntity(shiftedX, y, shiftedZ)
|
||||||
{
|
instanceof TileEntityTransmutationTablet) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,14 +278,12 @@ public class BlockAshInfusedStoneSlab extends BlockSlab
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public Item getItem(World world, int x, int y, int z)
|
public Item getItem(World world, int x, int y, int z) {
|
||||||
{
|
|
||||||
return Item.getItemFromBlock(ModBlocks.ashInfusedStoneSlab);
|
return Item.getItemFromBlock(ModBlocks.ashInfusedStoneSlab);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDamageValue(World world, int x, int y, int z)
|
public int getDamageValue(World world, int x, int y, int z) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.pahimar.ee3.block;
|
package com.pahimar.ee3.block;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.pahimar.ee3.EquivalentExchange3;
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
import com.pahimar.ee3.reference.GUIs;
|
import com.pahimar.ee3.reference.GUIs;
|
||||||
import com.pahimar.ee3.reference.Names;
|
import com.pahimar.ee3.reference.Names;
|
||||||
|
@ -12,12 +14,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockCalcinator extends BlockTileEntityEE {
|
||||||
|
public BlockCalcinator() {
|
||||||
public class BlockCalcinator extends BlockTileEntityEE
|
|
||||||
{
|
|
||||||
public BlockCalcinator()
|
|
||||||
{
|
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
this.setHardness(2.0f);
|
this.setHardness(2.0f);
|
||||||
this.setBlockName(Names.Blocks.CALCINATOR);
|
this.setBlockName(Names.Blocks.CALCINATOR);
|
||||||
|
@ -25,56 +23,76 @@ public class BlockCalcinator extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int metaData)
|
public TileEntity createNewTileEntity(World world, int metaData) {
|
||||||
{
|
|
||||||
return new TileEntityCalcinator();
|
return new TileEntityCalcinator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock()
|
public boolean renderAsNormalBlock() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType()
|
public int getRenderType() {
|
||||||
{
|
|
||||||
return RenderIds.calcinator;
|
return RenderIds.calcinator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube()
|
public boolean isOpaqueCube() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void randomDisplayTick(World world, int x, int y, int z, Random random)
|
public void randomDisplayTick(World world, int x, int y, int z, Random random) {
|
||||||
{
|
if (world.getTileEntity(x, y, z) instanceof TileEntityCalcinator) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityCalcinator)
|
if (((TileEntityCalcinator) world.getTileEntity(x, y, z)).getState() == 1) {
|
||||||
{
|
world.spawnParticle(
|
||||||
if (((TileEntityCalcinator) world.getTileEntity(x, y, z)).getState() == 1)
|
Particles.NORMAL_SMOKE,
|
||||||
{
|
(double) x + 0.5F,
|
||||||
world.spawnParticle(Particles.NORMAL_SMOKE, (double) x + 0.5F, (double) y + 0.4F, (double) ((z + 0.5F) + (random.nextFloat() * 0.5F - 0.3F)), 0.0D, 0.0D, 0.0D);
|
(double) y + 0.4F,
|
||||||
world.spawnParticle(Particles.FLAME, (double) x + 0.5F, (double) y + 0.4F, (double) z + 0.5F, 0.0D, 0.0D, 0.0D);
|
(double) ((z + 0.5F) + (random.nextFloat() * 0.5F - 0.3F)),
|
||||||
|
0.0D,
|
||||||
|
0.0D,
|
||||||
|
0.0D
|
||||||
|
);
|
||||||
|
world.spawnParticle(
|
||||||
|
Particles.FLAME,
|
||||||
|
(double) x + 0.5F,
|
||||||
|
(double) y + 0.4F,
|
||||||
|
(double) z + 0.5F,
|
||||||
|
0.0D,
|
||||||
|
0.0D,
|
||||||
|
0.0D
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
public boolean onBlockActivated(
|
||||||
{
|
World world,
|
||||||
if (player.isSneaking())
|
int x,
|
||||||
{
|
int y,
|
||||||
|
int z,
|
||||||
|
EntityPlayer player,
|
||||||
|
int par6,
|
||||||
|
float par7,
|
||||||
|
float par8,
|
||||||
|
float par9
|
||||||
|
) {
|
||||||
|
if (player.isSneaking()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else
|
if (!world.isRemote) {
|
||||||
{
|
if (world.getTileEntity(x, y, z) instanceof TileEntityCalcinator) {
|
||||||
if (!world.isRemote)
|
player.openGui(
|
||||||
{
|
EquivalentExchange3.instance,
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityCalcinator)
|
GUIs.CALCINATOR.ordinal(),
|
||||||
{
|
world,
|
||||||
player.openGui(EquivalentExchange3.instance, GUIs.CALCINATOR.ordinal(), world, x, y, z);
|
x,
|
||||||
|
y,
|
||||||
|
z
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,10 +101,9 @@ public class BlockCalcinator extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||||
{
|
if ((world.getTileEntity(x, y, z) instanceof TileEntityCalcinator)
|
||||||
if ((world.getTileEntity(x, y, z) instanceof TileEntityCalcinator) && (((TileEntityCalcinator) world.getTileEntity(x, y, z)).getState() == 1))
|
&& (((TileEntityCalcinator) world.getTileEntity(x, y, z)).getState() == 1)) {
|
||||||
{
|
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
package com.pahimar.ee3.block;
|
package com.pahimar.ee3.block;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.pahimar.ee3.init.ModItems;
|
import com.pahimar.ee3.init.ModItems;
|
||||||
import com.pahimar.ee3.reference.Names;
|
import com.pahimar.ee3.reference.Names;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockChalk extends BlockEE {
|
||||||
|
public BlockChalk() {
|
||||||
public class BlockChalk extends BlockEE
|
|
||||||
{
|
|
||||||
public BlockChalk()
|
|
||||||
{
|
|
||||||
super(Material.clay);
|
super(Material.clay);
|
||||||
this.setBlockName(Names.Items.CHALK);
|
this.setBlockName(Names.Items.CHALK);
|
||||||
this.setHardness(0.6f);
|
this.setHardness(0.6f);
|
||||||
|
@ -18,14 +16,12 @@ public class BlockChalk extends BlockEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int par1, Random random, int par2)
|
public Item getItemDropped(int par1, Random random, int par2) {
|
||||||
{
|
|
||||||
return ModItems.chalk;
|
return ModItems.chalk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random random)
|
public int quantityDropped(Random random) {
|
||||||
{
|
|
||||||
return (random.nextInt(4) + 1);
|
return (random.nextInt(4) + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.pahimar.ee3.block;
|
package com.pahimar.ee3.block;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.pahimar.ee3.reference.Names;
|
import com.pahimar.ee3.reference.Names;
|
||||||
import com.pahimar.ee3.reference.RenderIds;
|
import com.pahimar.ee3.reference.RenderIds;
|
||||||
import com.pahimar.ee3.tileentity.TileEntityAlchemyArray;
|
import com.pahimar.ee3.tileentity.TileEntityAlchemyArray;
|
||||||
|
@ -18,41 +20,33 @@ import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockDummyArray extends BlockTileEntityEE {
|
||||||
|
public BlockDummyArray() {
|
||||||
public class BlockDummyArray extends BlockTileEntityEE
|
|
||||||
{
|
|
||||||
public BlockDummyArray()
|
|
||||||
{
|
|
||||||
super(Material.circuits);
|
super(Material.circuits);
|
||||||
setCreativeTab(null);
|
setCreativeTab(null);
|
||||||
this.setBlockName(Names.Blocks.DUMMY_ARRAY);
|
this.setBlockName(Names.Blocks.DUMMY_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube()
|
public boolean isOpaqueCube() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock()
|
public boolean renderAsNormalBlock() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType()
|
public int getRenderType() {
|
||||||
{
|
|
||||||
return RenderIds.dummyArray;
|
return RenderIds.dummyArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||||
{
|
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
TileEntityDummyArray tileEntityDummyArray
|
||||||
{
|
= (TileEntityDummyArray) world.getTileEntity(x, y, z);
|
||||||
TileEntityDummyArray tileEntityDummyArray = (TileEntityDummyArray) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
return tileEntityDummyArray.getLightLevel();
|
return tileEntityDummyArray.getLightLevel();
|
||||||
}
|
}
|
||||||
|
@ -61,64 +55,106 @@ public class BlockDummyArray extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side)
|
public boolean
|
||||||
{
|
isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
|
public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockAt(World world, int x, int y, int z)
|
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
|
||||||
{
|
return world.getBlock(x, y, z).isReplaceable(world, x, y, z)
|
||||||
return world.getBlock(x, y, z).isReplaceable(world, x, y, z) && (world.isSideSolid(x - 1, y, z, ForgeDirection.EAST) ||
|
&& (world.isSideSolid(x - 1, y, z, ForgeDirection.EAST)
|
||||||
world.isSideSolid(x + 1, y, z, ForgeDirection.WEST) ||
|
|| world.isSideSolid(x + 1, y, z, ForgeDirection.WEST)
|
||||||
world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH) ||
|
|| world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH)
|
||||||
world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH) ||
|
|| world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH)
|
||||||
world.isSideSolid(x, y - 1, z, ForgeDirection.UP) ||
|
|| world.isSideSolid(x, y - 1, z, ForgeDirection.UP)
|
||||||
world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN));
|
|| world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int sideHit)
|
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int sideHit) {
|
||||||
{
|
|
||||||
ForgeDirection side = ForgeDirection.getOrientation(sideHit);
|
ForgeDirection side = ForgeDirection.getOrientation(sideHit);
|
||||||
return world.getBlock(x, y, z).isReplaceable(world, x, y, z) && ((side == ForgeDirection.DOWN && world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) ||
|
return world.getBlock(x, y, z).isReplaceable(world, x, y, z)
|
||||||
(side == ForgeDirection.UP && world.isSideSolid(x, y - 1, z, ForgeDirection.UP)) ||
|
&& ((side == ForgeDirection.DOWN
|
||||||
(side == ForgeDirection.NORTH && world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH)) ||
|
&& world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN))
|
||||||
(side == ForgeDirection.SOUTH && world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH)) ||
|
|| (side == ForgeDirection.UP
|
||||||
(side == ForgeDirection.WEST && world.isSideSolid(x + 1, y, z, ForgeDirection.WEST)) ||
|
&& world.isSideSolid(x, y - 1, z, ForgeDirection.UP))
|
||||||
(side == ForgeDirection.EAST && world.isSideSolid(x - 1, y, z, ForgeDirection.EAST)));
|
|| (side == ForgeDirection.NORTH
|
||||||
|
&& world.isSideSolid(x, y, z + 1, ForgeDirection.NORTH))
|
||||||
|
|| (side == ForgeDirection.SOUTH
|
||||||
|
&& world.isSideSolid(x, y, z - 1, ForgeDirection.SOUTH))
|
||||||
|
|| (side == ForgeDirection.WEST
|
||||||
|
&& world.isSideSolid(x + 1, y, z, ForgeDirection.WEST))
|
||||||
|
|| (side == ForgeDirection.EAST
|
||||||
|
&& world.isSideSolid(x - 1, y, z, ForgeDirection.EAST)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData)
|
public int onBlockPlaced(
|
||||||
{
|
World world,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int z,
|
||||||
|
int sideHit,
|
||||||
|
float hitX,
|
||||||
|
float hitY,
|
||||||
|
float hitZ,
|
||||||
|
int metaData
|
||||||
|
) {
|
||||||
return sideHit;
|
return sideHit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
|
public void onBlockPlacedBy(
|
||||||
{
|
World world,
|
||||||
((TileEntityEE) world.getTileEntity(x, y, z)).setOrientation(world.getBlockMetadata(x, y, z));
|
int x,
|
||||||
|
int y,
|
||||||
|
int z,
|
||||||
|
EntityLivingBase entityLiving,
|
||||||
|
ItemStack itemStack
|
||||||
|
) {
|
||||||
|
((TileEntityEE) world.getTileEntity(x, y, z))
|
||||||
|
.setOrientation(world.getBlockMetadata(x, y, z));
|
||||||
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z), 3);
|
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(
|
||||||
{
|
World world,
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
int x,
|
||||||
{
|
int y,
|
||||||
TileEntityAlchemyArray tileEntityAlchemyArray = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getAssociatedTileEntity();
|
int z,
|
||||||
|
EntityPlayer entityPlayer,
|
||||||
|
int sideHit,
|
||||||
|
float hitX,
|
||||||
|
float hitY,
|
||||||
|
float hitZ
|
||||||
|
) {
|
||||||
|
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray) {
|
||||||
|
TileEntityAlchemyArray tileEntityAlchemyArray
|
||||||
|
= ((TileEntityDummyArray) world.getTileEntity(x, y, z))
|
||||||
|
.getAssociatedTileEntity();
|
||||||
|
|
||||||
if (tileEntityAlchemyArray != null)
|
if (tileEntityAlchemyArray != null) {
|
||||||
{
|
tileEntityAlchemyArray.onBlockActivated(
|
||||||
tileEntityAlchemyArray.onBlockActivated(world, x, y, z, tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord, entityPlayer, sideHit, hitX, hitY, hitZ);
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
tileEntityAlchemyArray.xCoord,
|
||||||
|
tileEntityAlchemyArray.yCoord,
|
||||||
|
tileEntityAlchemyArray.zCoord,
|
||||||
|
entityPlayer,
|
||||||
|
sideHit,
|
||||||
|
hitX,
|
||||||
|
hitY,
|
||||||
|
hitZ
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,91 +162,139 @@ public class BlockDummyArray extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer entityPlayer)
|
public void
|
||||||
{
|
onBlockClicked(World world, int x, int y, int z, EntityPlayer entityPlayer) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray) {
|
||||||
{
|
TileEntityAlchemyArray tileEntityAlchemyArray
|
||||||
TileEntityAlchemyArray tileEntityAlchemyArray = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getAssociatedTileEntity();
|
= ((TileEntityDummyArray) world.getTileEntity(x, y, z))
|
||||||
|
.getAssociatedTileEntity();
|
||||||
|
|
||||||
if (tileEntityAlchemyArray != null)
|
if (tileEntityAlchemyArray != null) {
|
||||||
{
|
tileEntityAlchemyArray.onBlockClicked(
|
||||||
tileEntityAlchemyArray.onBlockClicked(world, x, y, z, tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord, entityPlayer);
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
tileEntityAlchemyArray.xCoord,
|
||||||
|
tileEntityAlchemyArray.yCoord,
|
||||||
|
tileEntityAlchemyArray.zCoord,
|
||||||
|
entityPlayer
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion)
|
public void
|
||||||
{
|
onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion explosion) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray) {
|
||||||
{
|
TileEntityAlchemyArray tileEntityAlchemyArray
|
||||||
TileEntityAlchemyArray tileEntityAlchemyArray = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getAssociatedTileEntity();
|
= ((TileEntityDummyArray) world.getTileEntity(x, y, z))
|
||||||
|
.getAssociatedTileEntity();
|
||||||
|
|
||||||
if (tileEntityAlchemyArray != null)
|
if (tileEntityAlchemyArray != null) {
|
||||||
{
|
tileEntityAlchemyArray.onBlockDestroyedByExplosion(
|
||||||
tileEntityAlchemyArray.onBlockDestroyedByExplosion(world, x, y, z, tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord, explosion);
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
tileEntityAlchemyArray.xCoord,
|
||||||
|
tileEntityAlchemyArray.yCoord,
|
||||||
|
tileEntityAlchemyArray.zCoord,
|
||||||
|
explosion
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int metaData)
|
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int metaData) {
|
||||||
{
|
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
TileEntityAlchemyArray tileEntityAlchemyArray
|
||||||
{
|
= ((TileEntityDummyArray) world.getTileEntity(x, y, z))
|
||||||
TileEntityAlchemyArray tileEntityAlchemyArray = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getAssociatedTileEntity();
|
.getAssociatedTileEntity();
|
||||||
|
|
||||||
if (tileEntityAlchemyArray != null)
|
if (tileEntityAlchemyArray != null) {
|
||||||
{
|
tileEntityAlchemyArray.onBlockDestroyedByPlayer(
|
||||||
tileEntityAlchemyArray.onBlockDestroyedByPlayer(world, x, y, z, tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord, metaData);
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
tileEntityAlchemyArray.xCoord,
|
||||||
|
tileEntityAlchemyArray.yCoord,
|
||||||
|
tileEntityAlchemyArray.zCoord,
|
||||||
|
metaData
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
|
public void
|
||||||
{
|
onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray) {
|
||||||
{
|
TileEntityAlchemyArray tileEntityAlchemyArray
|
||||||
TileEntityAlchemyArray tileEntityAlchemyArray = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getAssociatedTileEntity();
|
= ((TileEntityDummyArray) world.getTileEntity(x, y, z))
|
||||||
|
.getAssociatedTileEntity();
|
||||||
|
|
||||||
if (tileEntityAlchemyArray != null)
|
if (tileEntityAlchemyArray != null) {
|
||||||
{
|
tileEntityAlchemyArray.onEntityCollidedWithBlock(
|
||||||
tileEntityAlchemyArray.onEntityCollidedWithBlock(world, x, y, z, tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord, entity);
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
tileEntityAlchemyArray.xCoord,
|
||||||
|
tileEntityAlchemyArray.yCoord,
|
||||||
|
tileEntityAlchemyArray.zCoord,
|
||||||
|
entity
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFallenUpon(World world, int x, int y, int z, Entity entity, float fallDistance)
|
public void
|
||||||
{
|
onFallenUpon(World world, int x, int y, int z, Entity entity, float fallDistance) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray) {
|
||||||
{
|
TileEntityAlchemyArray tileEntityAlchemyArray
|
||||||
TileEntityAlchemyArray tileEntityAlchemyArray = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getAssociatedTileEntity();
|
= ((TileEntityDummyArray) world.getTileEntity(x, y, z))
|
||||||
|
.getAssociatedTileEntity();
|
||||||
|
|
||||||
if (tileEntityAlchemyArray != null)
|
if (tileEntityAlchemyArray != null) {
|
||||||
{
|
tileEntityAlchemyArray.onFallenUpon(
|
||||||
tileEntityAlchemyArray.onFallenUpon(world, x, y, z, tileEntityAlchemyArray.xCoord, tileEntityAlchemyArray.yCoord, tileEntityAlchemyArray.zCoord, entity, fallDistance);
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
tileEntityAlchemyArray.xCoord,
|
||||||
|
tileEntityAlchemyArray.yCoord,
|
||||||
|
tileEntityAlchemyArray.zCoord,
|
||||||
|
entity,
|
||||||
|
fallDistance
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
{
|
if (!world.isRemote
|
||||||
if (!world.isRemote && world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
&& world.getTileEntity(x, y, z) instanceof TileEntityDummyArray) {
|
||||||
{
|
int trueXCoord
|
||||||
int trueXCoord = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getTrueXCoord();
|
= ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getTrueXCoord();
|
||||||
int trueYCoord = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getTrueYCoord();
|
int trueYCoord
|
||||||
int trueZCoord = ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getTrueZCoord();
|
= ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getTrueYCoord();
|
||||||
|
int trueZCoord
|
||||||
|
= ((TileEntityDummyArray) world.getTileEntity(x, y, z)).getTrueZCoord();
|
||||||
|
|
||||||
if (world.getTileEntity(trueXCoord, trueYCoord, trueZCoord) instanceof TileEntityAlchemyArray)
|
if (world.getTileEntity(trueXCoord, trueYCoord, trueZCoord)
|
||||||
{
|
instanceof TileEntityAlchemyArray) {
|
||||||
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) world.getTileEntity(trueXCoord, trueYCoord, trueZCoord);
|
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray
|
||||||
|
) world.getTileEntity(trueXCoord, trueYCoord, trueZCoord);
|
||||||
boolean invalidateAlchemyArray = false;
|
boolean invalidateAlchemyArray = false;
|
||||||
|
|
||||||
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP && !world.isSideSolid(x, y - 1, z, ForgeDirection.UP, true))
|
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP
|
||||||
{
|
&& !world.isSideSolid(x, y - 1, z, ForgeDirection.UP, true)) {
|
||||||
invalidateAlchemyArray = true;
|
invalidateAlchemyArray = true;
|
||||||
}
|
}
|
||||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.DOWN && !world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, true))
|
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.DOWN && !world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, true))
|
||||||
|
@ -234,8 +318,7 @@ public class BlockDummyArray extends BlockTileEntityEE
|
||||||
invalidateAlchemyArray = true;
|
invalidateAlchemyArray = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (invalidateAlchemyArray)
|
if (invalidateAlchemyArray) {
|
||||||
{
|
|
||||||
world.getTileEntity(x, y, z).invalidate();
|
world.getTileEntity(x, y, z).invalidate();
|
||||||
tileEntityAlchemyArray.invalidate();
|
tileEntityAlchemyArray.invalidate();
|
||||||
world.setBlockToAir(x, y, z);
|
world.setBlockToAir(x, y, z);
|
||||||
|
@ -246,64 +329,60 @@ public class BlockDummyArray extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int par1, Random random, int par2)
|
public Item getItemDropped(int par1, Random random, int par2) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z)
|
public void
|
||||||
{
|
setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z) {
|
||||||
if (iBlockAccess.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
if (iBlockAccess.getTileEntity(x, y, z) instanceof TileEntityDummyArray) {
|
||||||
{
|
TileEntityDummyArray tileEntityDummyArray
|
||||||
TileEntityDummyArray tileEntityDummyArray = (TileEntityDummyArray) iBlockAccess.getTileEntity(x, y, z);
|
= (TileEntityDummyArray) iBlockAccess.getTileEntity(x, y, z);
|
||||||
|
|
||||||
switch (tileEntityDummyArray.getOrientation())
|
switch (tileEntityDummyArray.getOrientation()) {
|
||||||
{
|
case DOWN: {
|
||||||
case DOWN:
|
|
||||||
{
|
|
||||||
this.setBlockBounds(0f, 1f, 0f, 1f, 1 - 0.0625f, 1f);
|
this.setBlockBounds(0f, 1f, 0f, 1f, 1 - 0.0625f, 1f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UP:
|
case UP: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.0625f, 1f);
|
this.setBlockBounds(0f, 0f, 0f, 1f, 0.0625f, 1f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NORTH:
|
case NORTH: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0f, 0f, 1 - 0.0625f, 1f, 1f, 1f);
|
this.setBlockBounds(0f, 0f, 1 - 0.0625f, 1f, 1f, 1f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SOUTH:
|
case SOUTH: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0f, 0f, 0f, 1f, 1f, 0.0625f);
|
this.setBlockBounds(0f, 0f, 0f, 1f, 1f, 0.0625f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EAST:
|
case EAST: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0f, 0f, 0f, 0.0625f, 1f, 1f);
|
this.setBlockBounds(0f, 0f, 0f, 0.0625f, 1f, 1f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WEST:
|
case WEST: {
|
||||||
{
|
|
||||||
this.setBlockBounds(1f, 0f, 0f, 1 - 0.0625f, 1f, 1f);
|
this.setBlockBounds(1f, 0f, 0f, 1 - 0.0625f, 1f, 1f);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UNKNOWN:
|
case UNKNOWN: {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int metaData)
|
public void breakBlock(World world, int x, int y, int z, Block block, int metaData) {
|
||||||
{
|
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityDummyArray)
|
|
||||||
{
|
|
||||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||||
super.breakBlock(world, ((TileEntityDummyArray) tileEntity).getTrueXCoord(), ((TileEntityDummyArray) tileEntity).getTrueYCoord(), ((TileEntityDummyArray) tileEntity).getTrueZCoord(), block, metaData);
|
super.breakBlock(
|
||||||
|
world,
|
||||||
|
((TileEntityDummyArray) tileEntity).getTrueXCoord(),
|
||||||
|
((TileEntityDummyArray) tileEntity).getTrueYCoord(),
|
||||||
|
((TileEntityDummyArray) tileEntity).getTrueZCoord(),
|
||||||
|
block,
|
||||||
|
metaData
|
||||||
|
);
|
||||||
}
|
}
|
||||||
super.breakBlock(world, x, y, z, block, metaData);
|
super.breakBlock(world, x, y, z, block, metaData);
|
||||||
}
|
}
|
||||||
|
@ -315,8 +394,7 @@ public class BlockDummyArray extends BlockTileEntityEE
|
||||||
* @param metaData
|
* @param metaData
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int metaData)
|
public TileEntity createNewTileEntity(World world, int metaData) {
|
||||||
{
|
|
||||||
return new TileEntityDummyArray();
|
return new TileEntityDummyArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.pahimar.ee3.block;
|
package com.pahimar.ee3.block;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.pahimar.ee3.creativetab.CreativeTab;
|
import com.pahimar.ee3.creativetab.CreativeTab;
|
||||||
import com.pahimar.ee3.reference.Textures;
|
import com.pahimar.ee3.reference.Textures;
|
||||||
import com.pahimar.ee3.tileentity.TileEntityEE;
|
import com.pahimar.ee3.tileentity.TileEntityEE;
|
||||||
|
@ -19,75 +21,72 @@ import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockEE extends Block {
|
||||||
|
public BlockEE() {
|
||||||
public class BlockEE extends Block
|
|
||||||
{
|
|
||||||
public BlockEE()
|
|
||||||
{
|
|
||||||
this(Material.rock);
|
this(Material.rock);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockEE(Material material)
|
public BlockEE(Material material) {
|
||||||
{
|
|
||||||
super(material);
|
super(material);
|
||||||
this.setCreativeTab(CreativeTab.EE3_TAB);
|
this.setCreativeTab(CreativeTab.EE3_TAB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName()
|
public String getUnlocalizedName() {
|
||||||
{
|
return String.format(
|
||||||
return String.format("tile.%s%s", Textures.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
|
"tile.%s%s",
|
||||||
|
Textures.RESOURCE_PREFIX,
|
||||||
|
getUnwrappedUnlocalizedName(super.getUnlocalizedName())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister)
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
{
|
blockIcon = iconRegister.registerIcon(
|
||||||
blockIcon = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName())));
|
String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getUnwrappedUnlocalizedName(String unlocalizedName)
|
protected String getUnwrappedUnlocalizedName(String unlocalizedName) {
|
||||||
{
|
|
||||||
return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
|
return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||||
{
|
|
||||||
dropInventory(world, x, y, z);
|
dropInventory(world, x, y, z);
|
||||||
super.breakBlock(world, x, y, z, block, meta);
|
super.breakBlock(world, x, y, z, block, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
|
public void onBlockPlacedBy(
|
||||||
{
|
World world,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int z,
|
||||||
|
EntityLivingBase entityLiving,
|
||||||
|
ItemStack itemStack
|
||||||
|
) {
|
||||||
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
|
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityEE)
|
if (world.getTileEntity(x, y, z) instanceof TileEntityEE) {
|
||||||
{
|
|
||||||
int direction = 0;
|
int direction = 0;
|
||||||
int facing = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
int facing
|
||||||
|
= MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D)
|
||||||
|
& 3;
|
||||||
|
|
||||||
if (facing == 0)
|
if (facing == 0) {
|
||||||
{
|
|
||||||
direction = ForgeDirection.NORTH.ordinal();
|
direction = ForgeDirection.NORTH.ordinal();
|
||||||
}
|
} else if (facing == 1) {
|
||||||
else if (facing == 1)
|
|
||||||
{
|
|
||||||
direction = ForgeDirection.EAST.ordinal();
|
direction = ForgeDirection.EAST.ordinal();
|
||||||
}
|
} else if (facing == 2) {
|
||||||
else if (facing == 2)
|
|
||||||
{
|
|
||||||
direction = ForgeDirection.SOUTH.ordinal();
|
direction = ForgeDirection.SOUTH.ordinal();
|
||||||
}
|
} else if (facing == 3) {
|
||||||
else if (facing == 3)
|
|
||||||
{
|
|
||||||
direction = ForgeDirection.WEST.ordinal();
|
direction = ForgeDirection.WEST.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemStack.hasDisplayName())
|
if (itemStack.hasDisplayName()) {
|
||||||
{
|
((TileEntityEE) world.getTileEntity(x, y, z))
|
||||||
((TileEntityEE) world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
.setCustomName(itemStack.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
((TileEntityEE) world.getTileEntity(x, y, z)).setOrientation(direction);
|
((TileEntityEE) world.getTileEntity(x, y, z)).setOrientation(direction);
|
||||||
|
@ -95,40 +94,38 @@ public class BlockEE extends Block
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
public AxisAlignedBB
|
||||||
{
|
getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||||
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
|
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void dropInventory(World world, int x, int y, int z)
|
protected void dropInventory(World world, int x, int y, int z) {
|
||||||
{
|
|
||||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if (!(tileEntity instanceof IInventory))
|
if (!(tileEntity instanceof IInventory)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IInventory inventory = (IInventory) tileEntity;
|
IInventory inventory = (IInventory) tileEntity;
|
||||||
|
|
||||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||||
{
|
|
||||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||||
|
|
||||||
if (itemStack != null && itemStack.stackSize > 0)
|
if (itemStack != null && itemStack.stackSize > 0) {
|
||||||
{
|
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
|
|
||||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
|
|
||||||
EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, itemStack.copy());
|
EntityItem entityItem
|
||||||
|
= new EntityItem(world, x + dX, y + dY, z + dZ, itemStack.copy());
|
||||||
|
|
||||||
if (itemStack.hasTagCompound())
|
if (itemStack.hasTagCompound()) {
|
||||||
{
|
entityItem.getEntityItem().setTagCompound(
|
||||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
(NBTTagCompound) itemStack.getTagCompound().copy()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
float factor = 0.05F;
|
float factor = 0.05F;
|
||||||
|
|
|
@ -16,45 +16,38 @@ import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class BlockGlassBell extends BlockTileEntityEE
|
public class BlockGlassBell extends BlockTileEntityEE {
|
||||||
{
|
public BlockGlassBell() {
|
||||||
public BlockGlassBell()
|
|
||||||
{
|
|
||||||
super(Material.glass);
|
super(Material.glass);
|
||||||
this.setHardness(1.0f);
|
this.setHardness(1.0f);
|
||||||
this.setBlockName(Names.Blocks.GLASS_BELL);
|
this.setBlockName(Names.Blocks.GLASS_BELL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int metaData)
|
public TileEntity createNewTileEntity(World world, int metaData) {
|
||||||
{
|
|
||||||
return new TileEntityGlassBell();
|
return new TileEntityGlassBell();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock()
|
public boolean renderAsNormalBlock() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube()
|
public boolean isOpaqueCube() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType()
|
public int getRenderType() {
|
||||||
{
|
|
||||||
return RenderIds.glassBell;
|
return RenderIds.glassBell;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLightValue(IBlockAccess world, int x, int y, int z)
|
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
||||||
{
|
if (world.getTileEntity(x, y, z) instanceof TileEntityGlassBell) {
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityGlassBell)
|
TileEntityGlassBell tileEntityGlassBell
|
||||||
{
|
= (TileEntityGlassBell) world.getTileEntity(x, y, z);
|
||||||
TileEntityGlassBell tileEntityGlassBell = (TileEntityGlassBell) world.getTileEntity(x, y, z);
|
|
||||||
|
|
||||||
return tileEntityGlassBell.getState();
|
return tileEntityGlassBell.getState();
|
||||||
}
|
}
|
||||||
|
@ -63,25 +56,40 @@ public class BlockGlassBell extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
public boolean onBlockActivated(
|
||||||
{
|
World world,
|
||||||
if (player.isSneaking())
|
int x,
|
||||||
{
|
int y,
|
||||||
|
int z,
|
||||||
|
EntityPlayer player,
|
||||||
|
int par6,
|
||||||
|
float par7,
|
||||||
|
float par8,
|
||||||
|
float par9
|
||||||
|
) {
|
||||||
|
if (player.isSneaking()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else
|
if (!world.isRemote) {
|
||||||
{
|
if (world.getTileEntity(x, y, z) instanceof TileEntityGlassBell) {
|
||||||
if (!world.isRemote)
|
if (world.getTileEntity(x, y - 1, z) instanceof TileEntityAludel) {
|
||||||
{
|
player.openGui(
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityGlassBell)
|
EquivalentExchange3.instance,
|
||||||
{
|
GUIs.ALUDEL.ordinal(),
|
||||||
if (world.getTileEntity(x, y - 1, z) instanceof TileEntityAludel)
|
world,
|
||||||
{
|
x,
|
||||||
player.openGui(EquivalentExchange3.instance, GUIs.ALUDEL.ordinal(), world, x, y - 1, z);
|
y - 1,
|
||||||
}
|
z
|
||||||
else
|
);
|
||||||
{
|
} else {
|
||||||
player.openGui(EquivalentExchange3.instance, GUIs.GLASS_BELL.ordinal(), world, x, y, z);
|
player.openGui(
|
||||||
|
EquivalentExchange3.instance,
|
||||||
|
GUIs.GLASS_BELL.ordinal(),
|
||||||
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,72 +99,79 @@ public class BlockGlassBell extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
|
public void onBlockPlacedBy(
|
||||||
{
|
World world,
|
||||||
if (itemStack.hasDisplayName())
|
int x,
|
||||||
{
|
int y,
|
||||||
((TileEntityEE) world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
int z,
|
||||||
|
EntityLivingBase entityLiving,
|
||||||
|
ItemStack itemStack
|
||||||
|
) {
|
||||||
|
if (itemStack.hasDisplayName()) {
|
||||||
|
((TileEntityEE) world.getTileEntity(x, y, z))
|
||||||
|
.setCustomName(itemStack.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getTileEntity(x, y - 1, z) != null && world.getTileEntity(x, y - 1, z) instanceof TileEntityAludel)
|
if (world.getTileEntity(x, y - 1, z) != null
|
||||||
{
|
&& world.getTileEntity(x, y - 1, z) instanceof TileEntityAludel) {
|
||||||
((TileEntityEE) world.getTileEntity(x, y, z)).setOrientation(ForgeDirection.UP);
|
((TileEntityEE) world.getTileEntity(x, y, z))
|
||||||
}
|
.setOrientation(ForgeDirection.UP);
|
||||||
else
|
} else {
|
||||||
{
|
((TileEntityEE) world.getTileEntity(x, y, z))
|
||||||
((TileEntityEE) world.getTileEntity(x, y, z)).setOrientation(world.getBlockMetadata(x, y, z));
|
.setOrientation(world.getBlockMetadata(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, 0, 3);
|
world.setBlockMetadataWithNotify(x, y, z, 0, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData)
|
public int onBlockPlaced(
|
||||||
{
|
World world,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int z,
|
||||||
|
int sideHit,
|
||||||
|
float hitX,
|
||||||
|
float hitY,
|
||||||
|
float hitZ,
|
||||||
|
int metaData
|
||||||
|
) {
|
||||||
return sideHit;
|
return sideHit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z)
|
public void
|
||||||
{
|
setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z) {
|
||||||
if (iBlockAccess.getTileEntity(x, y, z) instanceof TileEntityGlassBell)
|
if (iBlockAccess.getTileEntity(x, y, z) instanceof TileEntityGlassBell) {
|
||||||
{
|
TileEntityGlassBell tileGlassBell
|
||||||
TileEntityGlassBell tileGlassBell = (TileEntityGlassBell) iBlockAccess.getTileEntity(x, y, z);
|
= (TileEntityGlassBell) iBlockAccess.getTileEntity(x, y, z);
|
||||||
|
|
||||||
switch (tileGlassBell.getOrientation())
|
switch (tileGlassBell.getOrientation()) {
|
||||||
{
|
case DOWN: {
|
||||||
case DOWN:
|
|
||||||
{
|
|
||||||
this.setBlockBounds(0.125F, 0.33F, 0.125F, 0.875F, 1.0F, 0.875F);
|
this.setBlockBounds(0.125F, 0.33F, 0.125F, 0.875F, 1.0F, 0.875F);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UP:
|
case UP: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.66F, 0.875F);
|
this.setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.66F, 0.875F);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NORTH:
|
case NORTH: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0.125F, 0.125F, 0.33F, 0.875F, 0.875F, 1.0F);
|
this.setBlockBounds(0.125F, 0.125F, 0.33F, 0.875F, 0.875F, 1.0F);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SOUTH:
|
case SOUTH: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.875F, 0.66F);
|
this.setBlockBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.875F, 0.66F);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EAST:
|
case EAST: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0.0F, 0.125F, 0.125F, 0.66F, 0.875F, 0.875F);
|
this.setBlockBounds(0.0F, 0.125F, 0.125F, 0.66F, 0.875F, 0.875F);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WEST:
|
case WEST: {
|
||||||
{
|
|
||||||
this.setBlockBounds(0.33F, 0.125F, 0.125F, 1.0F, 0.875F, 0.875F);
|
this.setBlockBounds(0.33F, 0.125F, 0.125F, 1.0F, 0.875F, 0.875F);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UNKNOWN:
|
case UNKNOWN: {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,53 +10,58 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class BlockResearchStation extends BlockTileEntityEE
|
public class BlockResearchStation extends BlockTileEntityEE {
|
||||||
{
|
public BlockResearchStation() {
|
||||||
public BlockResearchStation()
|
|
||||||
{
|
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
this.setHardness(2.0f);
|
this.setHardness(2.0f);
|
||||||
this.setBlockName(Names.Blocks.RESEARCH_STATION);
|
this.setBlockName(Names.Blocks.RESEARCH_STATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int metaData)
|
public TileEntity createNewTileEntity(World world, int metaData) {
|
||||||
{
|
|
||||||
return new TileEntityResearchStation();
|
return new TileEntityResearchStation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock()
|
public boolean renderAsNormalBlock() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube()
|
public boolean isOpaqueCube() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType()
|
public int getRenderType() {
|
||||||
{
|
|
||||||
return RenderIds.researchStation;
|
return RenderIds.researchStation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
public boolean onBlockActivated(
|
||||||
{
|
World world,
|
||||||
if (player.isSneaking())
|
int x,
|
||||||
{
|
int y,
|
||||||
|
int z,
|
||||||
|
EntityPlayer player,
|
||||||
|
int par6,
|
||||||
|
float par7,
|
||||||
|
float par8,
|
||||||
|
float par9
|
||||||
|
) {
|
||||||
|
if (player.isSneaking()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else
|
if (!world.isRemote) {
|
||||||
{
|
if (world.getTileEntity(x, y, z) instanceof TileEntityResearchStation) {
|
||||||
if (!world.isRemote)
|
player.openGui(
|
||||||
{
|
EquivalentExchange3.instance,
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityResearchStation)
|
GUIs.RESEARCH_STATION.ordinal(),
|
||||||
{
|
world,
|
||||||
player.openGui(EquivalentExchange3.instance, GUIs.RESEARCH_STATION.ordinal(), world, x, y, z);
|
x,
|
||||||
|
y,
|
||||||
|
z
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.pahimar.ee3.block;
|
package com.pahimar.ee3.block;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.pahimar.ee3.creativetab.CreativeTab;
|
import com.pahimar.ee3.creativetab.CreativeTab;
|
||||||
import com.pahimar.ee3.reference.Textures;
|
import com.pahimar.ee3.reference.Textures;
|
||||||
import com.pahimar.ee3.tileentity.TileEntityEE;
|
import com.pahimar.ee3.tileentity.TileEntityEE;
|
||||||
|
@ -20,70 +22,68 @@ import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import java.util.Random;
|
public abstract class BlockTileEntityEE extends BlockContainer {
|
||||||
|
protected BlockTileEntityEE(Material material) {
|
||||||
public abstract class BlockTileEntityEE extends BlockContainer
|
|
||||||
{
|
|
||||||
protected BlockTileEntityEE(Material material)
|
|
||||||
{
|
|
||||||
super(material);
|
super(material);
|
||||||
this.setCreativeTab(CreativeTab.EE3_TAB);
|
this.setCreativeTab(CreativeTab.EE3_TAB);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName()
|
public String getUnlocalizedName() {
|
||||||
{
|
return String.format(
|
||||||
return String.format("tile.%s%s", Textures.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
|
"tile.%s%s",
|
||||||
|
Textures.RESOURCE_PREFIX,
|
||||||
|
getUnwrappedUnlocalizedName(super.getUnlocalizedName())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister iconRegister)
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||||
{
|
blockIcon = iconRegister.registerIcon(
|
||||||
blockIcon = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName())));
|
String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getUnwrappedUnlocalizedName(String unlocalizedName)
|
protected String getUnwrappedUnlocalizedName(String unlocalizedName) {
|
||||||
{
|
|
||||||
return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
|
return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
|
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||||
{
|
|
||||||
dropInventory(world, x, y, z);
|
dropInventory(world, x, y, z);
|
||||||
super.breakBlock(world, x, y, z, block, meta);
|
super.breakBlock(world, x, y, z, block, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack)
|
public void onBlockPlacedBy(
|
||||||
{
|
World world,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int z,
|
||||||
|
EntityLivingBase entityLiving,
|
||||||
|
ItemStack itemStack
|
||||||
|
) {
|
||||||
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
|
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityEE)
|
if (world.getTileEntity(x, y, z) instanceof TileEntityEE) {
|
||||||
{
|
|
||||||
int direction = 0;
|
int direction = 0;
|
||||||
int facing = MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
int facing
|
||||||
|
= MathHelper.floor_double(entityLiving.rotationYaw * 4.0F / 360.0F + 0.5D)
|
||||||
|
& 3;
|
||||||
|
|
||||||
if (facing == 0)
|
if (facing == 0) {
|
||||||
{
|
|
||||||
direction = ForgeDirection.NORTH.ordinal();
|
direction = ForgeDirection.NORTH.ordinal();
|
||||||
}
|
} else if (facing == 1) {
|
||||||
else if (facing == 1)
|
|
||||||
{
|
|
||||||
direction = ForgeDirection.EAST.ordinal();
|
direction = ForgeDirection.EAST.ordinal();
|
||||||
}
|
} else if (facing == 2) {
|
||||||
else if (facing == 2)
|
|
||||||
{
|
|
||||||
direction = ForgeDirection.SOUTH.ordinal();
|
direction = ForgeDirection.SOUTH.ordinal();
|
||||||
}
|
} else if (facing == 3) {
|
||||||
else if (facing == 3)
|
|
||||||
{
|
|
||||||
direction = ForgeDirection.WEST.ordinal();
|
direction = ForgeDirection.WEST.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemStack.hasDisplayName())
|
if (itemStack.hasDisplayName()) {
|
||||||
{
|
((TileEntityEE) world.getTileEntity(x, y, z))
|
||||||
((TileEntityEE) world.getTileEntity(x, y, z)).setCustomName(itemStack.getDisplayName());
|
.setCustomName(itemStack.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
((TileEntityEE) world.getTileEntity(x, y, z)).setOrientation(direction);
|
((TileEntityEE) world.getTileEntity(x, y, z)).setOrientation(direction);
|
||||||
|
@ -91,40 +91,38 @@ public abstract class BlockTileEntityEE extends BlockContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z)
|
public AxisAlignedBB
|
||||||
{
|
getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||||
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
|
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void dropInventory(World world, int x, int y, int z)
|
protected void dropInventory(World world, int x, int y, int z) {
|
||||||
{
|
|
||||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if (!(tileEntity instanceof IInventory))
|
if (!(tileEntity instanceof IInventory)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IInventory inventory = (IInventory) tileEntity;
|
IInventory inventory = (IInventory) tileEntity;
|
||||||
|
|
||||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||||
{
|
|
||||||
ItemStack itemStack = inventory.getStackInSlot(i);
|
ItemStack itemStack = inventory.getStackInSlot(i);
|
||||||
|
|
||||||
if (itemStack != null && itemStack.stackSize > 0)
|
if (itemStack != null && itemStack.stackSize > 0) {
|
||||||
{
|
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
|
|
||||||
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
float dX = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
float dY = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
float dZ = rand.nextFloat() * 0.8F + 0.1F;
|
||||||
|
|
||||||
EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, itemStack.copy());
|
EntityItem entityItem
|
||||||
|
= new EntityItem(world, x + dX, y + dY, z + dZ, itemStack.copy());
|
||||||
|
|
||||||
if (itemStack.hasTagCompound())
|
if (itemStack.hasTagCompound()) {
|
||||||
{
|
entityItem.getEntityItem().setTagCompound(
|
||||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
|
(NBTTagCompound) itemStack.getTagCompound().copy()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
float factor = 0.05F;
|
float factor = 0.05F;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.pahimar.ee3.block;
|
package com.pahimar.ee3.block;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import com.pahimar.ee3.EquivalentExchange3;
|
import com.pahimar.ee3.EquivalentExchange3;
|
||||||
import com.pahimar.ee3.init.ModBlocks;
|
import com.pahimar.ee3.init.ModBlocks;
|
||||||
import com.pahimar.ee3.reference.GUIs;
|
import com.pahimar.ee3.reference.GUIs;
|
||||||
|
@ -13,12 +15,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.Random;
|
public class BlockTransmutationTablet extends BlockTileEntityEE {
|
||||||
|
public BlockTransmutationTablet() {
|
||||||
public class BlockTransmutationTablet extends BlockTileEntityEE
|
|
||||||
{
|
|
||||||
public BlockTransmutationTablet()
|
|
||||||
{
|
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
setCreativeTab(null);
|
setCreativeTab(null);
|
||||||
this.setHardness(2.0f);
|
this.setHardness(2.0f);
|
||||||
|
@ -26,38 +24,46 @@ public class BlockTransmutationTablet extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z)
|
public void
|
||||||
{
|
setBlockBoundsBasedOnState(IBlockAccess iBlockAccess, int x, int y, int z) {
|
||||||
if (isStructureValid(iBlockAccess, x, y, z))
|
if (isStructureValid(iBlockAccess, x, y, z)) {
|
||||||
{
|
|
||||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.625f, 1f);
|
this.setBlockBounds(0f, 0f, 0f, 1f, 0.625f, 1f);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.5f, 1f);
|
this.setBlockBounds(0f, 0f, 0f, 1f, 0.5f, 1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||||
{
|
|
||||||
return Item.getItemFromBlock(ModBlocks.ashInfusedStoneSlab);
|
return Item.getItemFromBlock(ModBlocks.ashInfusedStoneSlab);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int sideHit, float hitX, float hitY, float hitZ)
|
public boolean onBlockActivated(
|
||||||
{
|
World world,
|
||||||
if (entityPlayer.isSneaking())
|
int x,
|
||||||
{
|
int y,
|
||||||
|
int z,
|
||||||
|
EntityPlayer entityPlayer,
|
||||||
|
int sideHit,
|
||||||
|
float hitX,
|
||||||
|
float hitY,
|
||||||
|
float hitZ
|
||||||
|
) {
|
||||||
|
if (entityPlayer.isSneaking()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else
|
if (!world.isRemote) {
|
||||||
{
|
if (world.getTileEntity(x, y, z) instanceof TileEntityTransmutationTablet
|
||||||
if (!world.isRemote)
|
&& isStructureValid(world, x, y, z)) {
|
||||||
{
|
entityPlayer.openGui(
|
||||||
if (world.getTileEntity(x, y, z) instanceof TileEntityTransmutationTablet && isStructureValid(world, x, y, z))
|
EquivalentExchange3.instance,
|
||||||
{
|
GUIs.TRANSMUTATION_TABLET.ordinal(),
|
||||||
entityPlayer.openGui(EquivalentExchange3.instance, GUIs.TRANSMUTATION_TABLET.ordinal(), world, x, y, z);
|
world,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,44 +72,67 @@ public class BlockTransmutationTablet extends BlockTileEntityEE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onBlockPlaced(World world, int x, int y, int z, int sideHit, float hitX, float hitY, float hitZ, int metaData)
|
public int onBlockPlaced(
|
||||||
{
|
World world,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int z,
|
||||||
|
int sideHit,
|
||||||
|
float hitX,
|
||||||
|
float hitY,
|
||||||
|
float hitZ,
|
||||||
|
int metaData
|
||||||
|
) {
|
||||||
return metaData;
|
return metaData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int metaData)
|
public TileEntity createNewTileEntity(World world, int metaData) {
|
||||||
{
|
|
||||||
return new TileEntityTransmutationTablet();
|
return new TileEntityTransmutationTablet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock()
|
public boolean renderAsNormalBlock() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube()
|
public boolean isOpaqueCube() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType()
|
public int getRenderType() {
|
||||||
{
|
|
||||||
return RenderIds.tabletSlab;
|
return RenderIds.tabletSlab;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isStructureValid(IBlockAccess iBlockAcces, int xCoord, int yCoord, int zCoord)
|
private boolean
|
||||||
{
|
isStructureValid(IBlockAccess iBlockAcces, int xCoord, int yCoord, int zCoord) {
|
||||||
return ((iBlockAcces.getBlock(xCoord - 1, yCoord, zCoord - 1) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord - 1, yCoord, zCoord - 1) == 1) &&
|
return (
|
||||||
(iBlockAcces.getBlock(xCoord, yCoord, zCoord - 1) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord, yCoord, zCoord - 1) == 2) &&
|
(iBlockAcces.getBlock(xCoord - 1, yCoord, zCoord - 1)
|
||||||
(iBlockAcces.getBlock(xCoord + 1, yCoord, zCoord - 1) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord + 1, yCoord, zCoord - 1) == 3) &&
|
instanceof BlockAshInfusedStoneSlab
|
||||||
(iBlockAcces.getBlock(xCoord - 1, yCoord, zCoord) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord - 1, yCoord, zCoord) == 4) &&
|
&& iBlockAcces.getBlockMetadata(xCoord - 1, yCoord, zCoord - 1) == 1)
|
||||||
(iBlockAcces.getBlock(xCoord + 1, yCoord, zCoord) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord + 1, yCoord, zCoord) == 5) &&
|
&& (iBlockAcces.getBlock(xCoord, yCoord, zCoord - 1)
|
||||||
(iBlockAcces.getBlock(xCoord - 1, yCoord, zCoord + 1) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord - 1, yCoord, zCoord + 1) == 6) &&
|
instanceof BlockAshInfusedStoneSlab
|
||||||
(iBlockAcces.getBlock(xCoord, yCoord, zCoord + 1) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord, yCoord, zCoord + 1) == 7) &&
|
&& iBlockAcces.getBlockMetadata(xCoord, yCoord, zCoord - 1) == 2)
|
||||||
(iBlockAcces.getBlock(xCoord + 1, yCoord, zCoord + 1) instanceof BlockAshInfusedStoneSlab && iBlockAcces.getBlockMetadata(xCoord + 1, yCoord, zCoord + 1) == 8));
|
&& (iBlockAcces.getBlock(xCoord + 1, yCoord, zCoord - 1)
|
||||||
|
instanceof BlockAshInfusedStoneSlab
|
||||||
|
&& iBlockAcces.getBlockMetadata(xCoord + 1, yCoord, zCoord - 1) == 3)
|
||||||
|
&& (iBlockAcces.getBlock(xCoord - 1, yCoord, zCoord)
|
||||||
|
instanceof BlockAshInfusedStoneSlab
|
||||||
|
&& iBlockAcces.getBlockMetadata(xCoord - 1, yCoord, zCoord) == 4)
|
||||||
|
&& (iBlockAcces.getBlock(xCoord + 1, yCoord, zCoord)
|
||||||
|
instanceof BlockAshInfusedStoneSlab
|
||||||
|
&& iBlockAcces.getBlockMetadata(xCoord + 1, yCoord, zCoord) == 5)
|
||||||
|
&& (iBlockAcces.getBlock(xCoord - 1, yCoord, zCoord + 1)
|
||||||
|
instanceof BlockAshInfusedStoneSlab
|
||||||
|
&& iBlockAcces.getBlockMetadata(xCoord - 1, yCoord, zCoord + 1) == 6)
|
||||||
|
&& (iBlockAcces.getBlock(xCoord, yCoord, zCoord + 1)
|
||||||
|
instanceof BlockAshInfusedStoneSlab
|
||||||
|
&& iBlockAcces.getBlockMetadata(xCoord, yCoord, zCoord + 1) == 7)
|
||||||
|
&& (iBlockAcces.getBlock(xCoord + 1, yCoord, zCoord + 1)
|
||||||
|
instanceof BlockAshInfusedStoneSlab
|
||||||
|
&& iBlockAcces.getBlockMetadata(xCoord + 1, yCoord, zCoord + 1) == 8)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.pahimar.ee3.client.gui;
|
package com.pahimar.ee3.client.gui;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
import com.pahimar.ee3.client.gui.component.GuiComponent;
|
import com.pahimar.ee3.client.gui.component.GuiComponent;
|
||||||
import com.pahimar.ee3.client.util.RenderUtils;
|
import com.pahimar.ee3.client.util.RenderUtils;
|
||||||
import com.pahimar.repackage.cofh.lib.util.helpers.StringHelper;
|
import com.pahimar.repackage.cofh.lib.util.helpers.StringHelper;
|
||||||
|
@ -12,14 +14,12 @@ import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public abstract class GuiBase extends GuiContainer {
|
public abstract class GuiBase extends GuiContainer {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
protected ResourceLocation texture;
|
protected ResourceLocation texture;
|
||||||
protected Map<String, GuiComponent> guiComponentMap = new TreeMap<String, GuiComponent>();
|
protected Map<String, GuiComponent> guiComponentMap
|
||||||
|
= new TreeMap<String, GuiComponent>();
|
||||||
protected String title;
|
protected String title;
|
||||||
private boolean shouldDrawTitle = true;
|
private boolean shouldDrawTitle = true;
|
||||||
private String activeGuiComponentId = null;
|
private String activeGuiComponentId = null;
|
||||||
|
@ -152,7 +152,8 @@ public abstract class GuiBase extends GuiContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiComponent getTopGuiComponentAt(int positionX, int positionY) {
|
public GuiComponent getTopGuiComponentAt(int positionX, int positionY) {
|
||||||
TreeSet<GuiComponent> guiComponents = new TreeSet<GuiComponent>(GuiComponent.zIndexComparator);
|
TreeSet<GuiComponent> guiComponents
|
||||||
|
= new TreeSet<GuiComponent>(GuiComponent.zIndexComparator);
|
||||||
for (GuiComponent guiComponent : getGuiComponents()) {
|
for (GuiComponent guiComponent : getGuiComponents()) {
|
||||||
if (guiComponent.intersectsWith(positionX, positionY)) {
|
if (guiComponent.intersectsWith(positionX, positionY)) {
|
||||||
guiComponents.add(guiComponent);
|
guiComponents.add(guiComponent);
|
||||||
|
@ -171,7 +172,8 @@ public abstract class GuiBase extends GuiContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<GuiComponent> getGuiComponentsAt(int positionX, int positionY) {
|
public Collection<GuiComponent> getGuiComponentsAt(int positionX, int positionY) {
|
||||||
Collection<GuiComponent> intersectingGuiComponents = new ArrayList<GuiComponent>();
|
Collection<GuiComponent> intersectingGuiComponents
|
||||||
|
= new ArrayList<GuiComponent>();
|
||||||
|
|
||||||
for (GuiComponent guiComponent : getGuiComponents()) {
|
for (GuiComponent guiComponent : getGuiComponents()) {
|
||||||
if (guiComponent.intersectsWith(positionX, positionY)) {
|
if (guiComponent.intersectsWith(positionX, positionY)) {
|
||||||
|
@ -182,8 +184,10 @@ public abstract class GuiBase extends GuiContainer {
|
||||||
return intersectingGuiComponents;
|
return intersectingGuiComponents;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<GuiComponent> getGuiComponentsAt(int positionX, int positionY, int zIndex) {
|
public Collection<GuiComponent>
|
||||||
Collection<GuiComponent> intersectingGuiComponents = new ArrayList<GuiComponent>();
|
getGuiComponentsAt(int positionX, int positionY, int zIndex) {
|
||||||
|
Collection<GuiComponent> intersectingGuiComponents
|
||||||
|
= new ArrayList<GuiComponent>();
|
||||||
|
|
||||||
for (GuiComponent guiComponent : getGuiComponents()) {
|
for (GuiComponent guiComponent : getGuiComponents()) {
|
||||||
if (guiComponent.intersectsWith(positionX, positionY, zIndex)) {
|
if (guiComponent.intersectsWith(positionX, positionY, zIndex)) {
|
||||||
|
@ -215,7 +219,8 @@ public abstract class GuiBase extends GuiContainer {
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
super.initGui();
|
super.initGui();
|
||||||
|
|
||||||
// A bunch of different impls clear the list of components here - no reason I can discern why at this point
|
// A bunch of different impls clear the list of components here - no reason I can
|
||||||
|
// discern why at this point
|
||||||
|
|
||||||
for (GuiComponent guiComponent : getGuiComponents()) {
|
for (GuiComponent guiComponent : getGuiComponents()) {
|
||||||
guiComponent.onInit();
|
guiComponent.onInit();
|
||||||
|
@ -263,12 +268,10 @@ public abstract class GuiBase extends GuiContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void mouseClickMove(int rawMouseX, int rawMouseY, int mouseButton, long duration) {
|
protected void
|
||||||
|
mouseClickMove(int rawMouseX, int rawMouseY, int mouseButton, long duration) {}
|
||||||
}
|
|
||||||
|
|
||||||
public Slot getSlotAtPosition(int rawMouseX, int rawMouseY) {
|
public Slot getSlotAtPosition(int rawMouseX, int rawMouseY) {
|
||||||
|
|
||||||
Iterator iterator = this.inventorySlots.inventorySlots.iterator();
|
Iterator iterator = this.inventorySlots.inventorySlots.iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Slot slot = (Slot) iterator.next();
|
Slot slot = (Slot) iterator.next();
|
||||||
|
@ -281,14 +284,25 @@ public abstract class GuiBase extends GuiContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMouseOverSlot(Slot slot, int rawMouseX, int rawMouseY) {
|
public boolean isMouseOverSlot(Slot slot, int rawMouseX, int rawMouseY) {
|
||||||
return this.isMouseOverSlot(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, rawMouseX, rawMouseY);
|
return this.isMouseOverSlot(
|
||||||
|
slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, rawMouseX, rawMouseY
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean isMouseOverSlot(
|
||||||
protected boolean isMouseOverSlot(int slotPositionX, int slotPositionY, int slotWidth, int slotHeight, int rawMouseX, int rawMouseY) {
|
int slotPositionX,
|
||||||
|
int slotPositionY,
|
||||||
|
int slotWidth,
|
||||||
|
int slotHeight,
|
||||||
|
int rawMouseX,
|
||||||
|
int rawMouseY
|
||||||
|
) {
|
||||||
rawMouseX -= getGuiPositionX();
|
rawMouseX -= getGuiPositionX();
|
||||||
rawMouseY -= getGuiPositionX();
|
rawMouseY -= getGuiPositionX();
|
||||||
return (rawMouseX >= slotPositionX - 1) && (rawMouseX < slotPositionX + slotWidth + 1) && (rawMouseY >= slotPositionY - 1) && (rawMouseY < slotPositionY + slotHeight + 1);
|
return (rawMouseX >= slotPositionX - 1)
|
||||||
|
&& (rawMouseX < slotPositionX + slotWidth + 1)
|
||||||
|
&& (rawMouseY >= slotPositionY - 1)
|
||||||
|
&& (rawMouseY < slotPositionY + slotHeight + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -299,7 +313,9 @@ public abstract class GuiBase extends GuiContainer {
|
||||||
|
|
||||||
for (GuiComponent guiComponent : getGuiComponents()) {
|
for (GuiComponent guiComponent : getGuiComponents()) {
|
||||||
if (guiComponent.intersectsWith(getAdjustedMouseX(), getAdjustedMouseY())) {
|
if (guiComponent.intersectsWith(getAdjustedMouseX(), getAdjustedMouseY())) {
|
||||||
guiComponent.onMouseOver(getAdjustedMouseX(), getAdjustedMouseY(), partialTicks);
|
guiComponent.onMouseOver(
|
||||||
|
getAdjustedMouseX(), getAdjustedMouseY(), partialTicks
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,7 +324,14 @@ public abstract class GuiBase extends GuiContainer {
|
||||||
protected void drawGuiContainerForegroundLayer(int rawMouseX, int rawMouseY) {
|
protected void drawGuiContainerForegroundLayer(int rawMouseX, int rawMouseY) {
|
||||||
// Draw text
|
// Draw text
|
||||||
if (shouldDrawTitle && title != null) {
|
if (shouldDrawTitle && title != null) {
|
||||||
getFontRenderer().drawString(StringHelper.localize(title), RenderUtils.getCenteredTextOffset(getFontRenderer(), StringHelper.localize(title), getGuiWidth()), 6, 0x404040);
|
getFontRenderer().drawString(
|
||||||
|
StringHelper.localize(title),
|
||||||
|
RenderUtils.getCenteredTextOffset(
|
||||||
|
getFontRenderer(), StringHelper.localize(title), getGuiWidth()
|
||||||
|
),
|
||||||
|
6,
|
||||||
|
0x404040
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw components
|
// Draw components
|
||||||
|
@ -316,14 +339,17 @@ public abstract class GuiBase extends GuiContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int rawMouseX, int rawMouseY) {
|
protected void
|
||||||
|
drawGuiContainerBackgroundLayer(float partialTicks, int rawMouseX, int rawMouseY) {
|
||||||
// Draw background
|
// Draw background
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
if (texture != null) {
|
if (texture != null) {
|
||||||
RenderUtils.bindTexture(texture);
|
RenderUtils.bindTexture(texture);
|
||||||
int xStart = (getScreenWidth() - getGuiWidth()) / 2;
|
int xStart = (getScreenWidth() - getGuiWidth()) / 2;
|
||||||
int yStart = (getScreenHeight() - getGuiHeight()) / 2;
|
int yStart = (getScreenHeight() - getGuiHeight()) / 2;
|
||||||
this.drawTexturedModalRect(xStart, yStart, 0, 0, getGuiWidth(), getGuiHeight());
|
this.drawTexturedModalRect(
|
||||||
|
xStart, yStart, 0, 0, getGuiWidth(), getGuiHeight()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw components
|
// Draw components
|
||||||
|
@ -331,11 +357,11 @@ public abstract class GuiBase extends GuiContainer {
|
||||||
GL11.glTranslatef(getGuiPositionX(), getGuiPositionY(), 0.0F);
|
GL11.glTranslatef(getGuiPositionX(), getGuiPositionY(), 0.0F);
|
||||||
drawComponents(false, rawMouseX, rawMouseY, partialTicks);
|
drawComponents(false, rawMouseX, rawMouseY, partialTicks);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawComponents(boolean drawForeground, int rawMouseX, int rawMouseY, float partialTicks) {
|
protected void drawComponents(
|
||||||
|
boolean drawForeground, int rawMouseX, int rawMouseY, float partialTicks
|
||||||
|
) {
|
||||||
for (GuiComponent guiComponent : getGuiComponents()) {
|
for (GuiComponent guiComponent : getGuiComponents()) {
|
||||||
if (guiComponent.isVisible()) {
|
if (guiComponent.isVisible()) {
|
||||||
if (drawForeground) {
|
if (drawForeground) {
|
||||||
|
|
|
@ -1,34 +1,27 @@
|
||||||
package com.pahimar.ee3.client.gui;
|
package com.pahimar.ee3.client.gui;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import cpw.mods.fml.client.IModGuiFactory;
|
import cpw.mods.fml.client.IModGuiFactory;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
|
||||||
import java.util.Set;
|
public class GuiFactory implements IModGuiFactory {
|
||||||
|
|
||||||
public class GuiFactory implements IModGuiFactory
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(Minecraft minecraft)
|
public void initialize(Minecraft minecraft) {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiScreen> mainConfigGuiClass()
|
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||||
{
|
|
||||||
return ModGuiConfig.class;
|
return ModGuiConfig.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
|
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
|
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,18 @@ import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraftforge.common.config.ConfigElement;
|
import net.minecraftforge.common.config.ConfigElement;
|
||||||
import net.minecraftforge.common.config.Configuration;
|
import net.minecraftforge.common.config.Configuration;
|
||||||
|
|
||||||
public class ModGuiConfig extends GuiConfig
|
public class ModGuiConfig extends GuiConfig {
|
||||||
{
|
public ModGuiConfig(GuiScreen guiScreen) {
|
||||||
public ModGuiConfig(GuiScreen guiScreen)
|
super(
|
||||||
{
|
guiScreen,
|
||||||
super(guiScreen, new ConfigElement(ConfigurationHandler.configuration.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), Reference.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath(ConfigurationHandler.configuration.toString()));
|
new ConfigElement(ConfigurationHandler.configuration.getCategory(
|
||||||
|
Configuration.CATEGORY_GENERAL
|
||||||
|
))
|
||||||
|
.getChildElements(),
|
||||||
|
Reference.MOD_ID,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
GuiConfig.getAbridgedConfigPath(ConfigurationHandler.configuration.toString())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +1,63 @@
|
||||||
package com.pahimar.ee3.client.gui.component;
|
package com.pahimar.ee3.client.gui.component;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
import com.pahimar.ee3.client.gui.GuiBase;
|
import com.pahimar.ee3.client.gui.GuiBase;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import java.util.Comparator;
|
|
||||||
|
|
||||||
public abstract class GuiComponent implements Comparable<GuiComponent> {
|
public abstract class GuiComponent implements Comparable<GuiComponent> {
|
||||||
|
public static Comparator<GuiComponent> orderingComparator
|
||||||
public static Comparator<GuiComponent> orderingComparator = new Comparator<GuiComponent>() {
|
= new Comparator<GuiComponent>() {
|
||||||
|
@Override
|
||||||
@Override
|
public int compare(GuiComponent guiComponent1, GuiComponent guiComponent2) {
|
||||||
public int compare(GuiComponent guiComponent1, GuiComponent guiComponent2) {
|
if (guiComponent1.ordering == guiComponent2.ordering) {
|
||||||
if (guiComponent1.ordering == guiComponent2.ordering) {
|
if (guiComponent1.zIndex == guiComponent2.zIndex) {
|
||||||
if (guiComponent1.zIndex == guiComponent2.zIndex) {
|
if (guiComponent1.id != null && guiComponent2.id != null) {
|
||||||
if (guiComponent1.id != null && guiComponent2.id != null) {
|
return guiComponent1.id.compareToIgnoreCase(guiComponent2.id
|
||||||
return guiComponent1.id.compareToIgnoreCase(guiComponent2.id);
|
);
|
||||||
} else {
|
} else {
|
||||||
return guiComponent1.hashCode() - guiComponent2.hashCode();
|
return guiComponent1.hashCode() - guiComponent2.hashCode();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Purposefully sorting so that higher z-indices appear first in the map
|
// Purposefully sorting so that higher z-indices appear first in
|
||||||
return guiComponent2.zIndex - guiComponent1.zIndex;
|
// the map
|
||||||
}
|
return guiComponent2.zIndex - guiComponent1.zIndex;
|
||||||
} else {
|
}
|
||||||
return guiComponent1.ordering - guiComponent2.ordering;
|
} else {
|
||||||
}
|
return guiComponent1.ordering - guiComponent2.ordering;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
public static Comparator<GuiComponent> zIndexComparator = new Comparator<GuiComponent>() {
|
};
|
||||||
|
public static Comparator<GuiComponent> zIndexComparator
|
||||||
@Override
|
= new Comparator<GuiComponent>() {
|
||||||
public int compare(GuiComponent guiComponent1, GuiComponent guiComponent2) {
|
@Override
|
||||||
if (guiComponent1.zIndex == guiComponent2.zIndex) {
|
public int compare(GuiComponent guiComponent1, GuiComponent guiComponent2) {
|
||||||
if (guiComponent1.ordering == guiComponent2.ordering) {
|
if (guiComponent1.zIndex == guiComponent2.zIndex) {
|
||||||
if (guiComponent1.id != null && guiComponent2.id != null) {
|
if (guiComponent1.ordering == guiComponent2.ordering) {
|
||||||
return guiComponent1.id.compareToIgnoreCase(guiComponent2.id);
|
if (guiComponent1.id != null && guiComponent2.id != null) {
|
||||||
} else {
|
return guiComponent1.id.compareToIgnoreCase(guiComponent2.id
|
||||||
return guiComponent1.hashCode() - guiComponent2.hashCode();
|
);
|
||||||
}
|
} else {
|
||||||
} else {
|
return guiComponent1.hashCode() - guiComponent2.hashCode();
|
||||||
return guiComponent1.ordering - guiComponent2.ordering;
|
}
|
||||||
}
|
} else {
|
||||||
} else {
|
return guiComponent1.ordering - guiComponent2.ordering;
|
||||||
// Purposefully sorting so that higher z-indices appear first in the map
|
}
|
||||||
return guiComponent2.zIndex - guiComponent1.zIndex;
|
} else {
|
||||||
}
|
// Purposefully sorting so that higher z-indices appear first in the
|
||||||
}
|
// map
|
||||||
};
|
return guiComponent2.zIndex - guiComponent1.zIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
protected final GuiBase parentGui;
|
protected final GuiBase parentGui;
|
||||||
protected final String id;
|
protected final String id;
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
protected ResourceLocation texture;
|
protected ResourceLocation texture;
|
||||||
protected int positionX, positionY, componentWidth, componentHeight, textureWidth, textureHeight;
|
protected int positionX, positionY, componentWidth, componentHeight, textureWidth,
|
||||||
|
textureHeight;
|
||||||
protected int ordering = 0;
|
protected int ordering = 0;
|
||||||
protected int zIndex = 0;
|
protected int zIndex = 0;
|
||||||
protected boolean isVisible = true;
|
protected boolean isVisible = true;
|
||||||
|
@ -64,15 +68,49 @@ public abstract class GuiComponent implements Comparable<GuiComponent> {
|
||||||
this(parentGui, id, null, 0, 0);
|
this(parentGui, id, null, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiComponent(GuiBase parentGui, String id, ResourceLocation texture, int positionX, int positionY) {
|
public GuiComponent(
|
||||||
|
GuiBase parentGui,
|
||||||
|
String id,
|
||||||
|
ResourceLocation texture,
|
||||||
|
int positionX,
|
||||||
|
int positionY
|
||||||
|
) {
|
||||||
this(parentGui, id, texture, positionX, positionY, 256, 256);
|
this(parentGui, id, texture, positionX, positionY, 256, 256);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiComponent(GuiBase parentGui, String id, ResourceLocation texture, int positionX, int positionY, int componentWidth, int componentHeight) {
|
public GuiComponent(
|
||||||
this(parentGui, id, texture, positionX, positionY, componentWidth, componentHeight, 256, 256);
|
GuiBase parentGui,
|
||||||
|
String id,
|
||||||
|
ResourceLocation texture,
|
||||||
|
int positionX,
|
||||||
|
int positionY,
|
||||||
|
int componentWidth,
|
||||||
|
int componentHeight
|
||||||
|
) {
|
||||||
|
this(
|
||||||
|
parentGui,
|
||||||
|
id,
|
||||||
|
texture,
|
||||||
|
positionX,
|
||||||
|
positionY,
|
||||||
|
componentWidth,
|
||||||
|
componentHeight,
|
||||||
|
256,
|
||||||
|
256
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiComponent(GuiBase parentGui, String id, ResourceLocation texture, int positionX, int positionY, int componentWidth, int componentHeight, int textureWidth, int textureHeight) {
|
public GuiComponent(
|
||||||
|
GuiBase parentGui,
|
||||||
|
String id,
|
||||||
|
ResourceLocation texture,
|
||||||
|
int positionX,
|
||||||
|
int positionY,
|
||||||
|
int componentWidth,
|
||||||
|
int componentHeight,
|
||||||
|
int textureWidth,
|
||||||
|
int textureHeight
|
||||||
|
) {
|
||||||
this.parentGui = parentGui;
|
this.parentGui = parentGui;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
|
@ -101,7 +139,8 @@ public abstract class GuiComponent implements Comparable<GuiComponent> {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiComponent setTexture(ResourceLocation texture, int textureWidth, int textureHeight) {
|
public GuiComponent
|
||||||
|
setTexture(ResourceLocation texture, int textureWidth, int textureHeight) {
|
||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
return this.setTextureSize(textureWidth, textureHeight);
|
return this.setTextureSize(textureWidth, textureHeight);
|
||||||
}
|
}
|
||||||
|
@ -171,7 +210,6 @@ public abstract class GuiComponent implements Comparable<GuiComponent> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiComponent setVisible(boolean isVisible) {
|
public GuiComponent setVisible(boolean isVisible) {
|
||||||
|
|
||||||
if (this.isVisible && !isVisible) {
|
if (this.isVisible && !isVisible) {
|
||||||
this.onHide();
|
this.onHide();
|
||||||
} else if (!this.isVisible && isVisible) {
|
} else if (!this.isVisible && isVisible) {
|
||||||
|
@ -187,7 +225,6 @@ public abstract class GuiComponent implements Comparable<GuiComponent> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiComponent setEnabled(boolean isEnabled) {
|
public GuiComponent setEnabled(boolean isEnabled) {
|
||||||
|
|
||||||
if (this.isEnabled && !isEnabled) {
|
if (this.isEnabled && !isEnabled) {
|
||||||
this.onDisable();
|
this.onDisable();
|
||||||
} else if (!this.isEnabled && isEnabled) {
|
} else if (!this.isEnabled && isEnabled) {
|
||||||
|
@ -226,14 +263,19 @@ public abstract class GuiComponent implements Comparable<GuiComponent> {
|
||||||
*
|
*
|
||||||
* @param xCoord x position
|
* @param xCoord x position
|
||||||
* @param yCoord y position
|
* @param yCoord y position
|
||||||
* @return true if the specified coordinates intersect with this GuiComponent, false otherwise
|
* @return true if the specified coordinates intersect with this GuiComponent, false
|
||||||
|
* otherwise
|
||||||
*/
|
*/
|
||||||
public boolean intersectsWith(int xCoord, int yCoord) {
|
public boolean intersectsWith(int xCoord, int yCoord) {
|
||||||
return (xCoord >= this.positionX && xCoord <= this.positionX + this.componentWidth) && (yCoord >= this.positionY && yCoord <= this.positionY + this.componentHeight);
|
return (xCoord >= this.positionX && xCoord <= this.positionX + this.componentWidth
|
||||||
|
)
|
||||||
|
&& (yCoord >= this.positionY
|
||||||
|
&& yCoord <= this.positionY + this.componentHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether or not the specified coordinate and z index intersects with this GuiComponent
|
* Checks whether or not the specified coordinate and z index intersects with this
|
||||||
|
* GuiComponent
|
||||||
*
|
*
|
||||||
* @param xCoord x position
|
* @param xCoord x position
|
||||||
* @param yCoord y position
|
* @param yCoord y position
|
||||||
|
@ -241,16 +283,20 @@ public abstract class GuiComponent implements Comparable<GuiComponent> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean intersectsWith(int xCoord, int yCoord, int zIndex) {
|
public boolean intersectsWith(int xCoord, int yCoord, int zIndex) {
|
||||||
return (xCoord >= this.positionX && xCoord <= this.positionX + this.componentWidth) && (yCoord >= this.positionY && yCoord <= this.positionY + this.componentHeight) && (zIndex == this.zIndex);
|
return (xCoord >= this.positionX && xCoord <= this.positionX + this.componentWidth
|
||||||
|
)
|
||||||
|
&& (yCoord >= this.positionY
|
||||||
|
&& yCoord <= this.positionY + this.componentHeight)
|
||||||
|
&& (zIndex == this.zIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param rawMouseX
|
* @param rawMouseX
|
||||||
* @param rawMouseY
|
* @param rawMouseY
|
||||||
* @param mouseButton
|
* @param mouseButton
|
||||||
*/
|
*/
|
||||||
public abstract void onMouseButtonClicked(int rawMouseX, int rawMouseY, int mouseButton);
|
public abstract void
|
||||||
|
onMouseButtonClicked(int rawMouseX, int rawMouseY, int mouseButton);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -268,9 +314,11 @@ public abstract class GuiComponent implements Comparable<GuiComponent> {
|
||||||
|
|
||||||
public abstract void onMouseButtonUp(int rawMouseX, int rawMouseY, int mouseButton);
|
public abstract void onMouseButtonUp(int rawMouseX, int rawMouseY, int mouseButton);
|
||||||
|
|
||||||
public abstract void onMouseButtonRelease(int rawMouseX, int rawMouseY, int mouseButton, long duration);
|
public abstract void
|
||||||
|
onMouseButtonRelease(int rawMouseX, int rawMouseY, int mouseButton, long duration);
|
||||||
|
|
||||||
public abstract void onMouseMove(int prevRawMouseX, int prevRawMouseY, int newRawMouseX, int newRawMouseY);
|
public abstract void
|
||||||
|
onMouseMove(int prevRawMouseX, int prevRawMouseY, int newRawMouseX, int newRawMouseY);
|
||||||
|
|
||||||
public abstract void onMouseEnter(int rawMouseX, int rawMouseY);
|
public abstract void onMouseEnter(int rawMouseX, int rawMouseY);
|
||||||
|
|
||||||
|
|
|
@ -4,35 +4,62 @@ import com.pahimar.repackage.cofh.lib.gui.GuiBase;
|
||||||
import com.pahimar.repackage.cofh.lib.gui.element.ElementButton;
|
import com.pahimar.repackage.cofh.lib.gui.element.ElementButton;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class ElementCheckBox extends ElementButton
|
public class ElementCheckBox extends ElementButton {
|
||||||
{
|
|
||||||
private boolean isChecked;
|
private boolean isChecked;
|
||||||
|
|
||||||
public ElementCheckBox(GuiBase gui, int posX, int posY, String name, int sheetX, int sheetY, int hoverX, int hoverY, int disabledX, int disabledY, int sizeX, int sizeY, int texW, int texH, ResourceLocation texture)
|
public ElementCheckBox(
|
||||||
{
|
GuiBase gui,
|
||||||
super(gui, posX, posY, name, sheetX, sheetY, hoverX, hoverY, disabledX, disabledY, sizeX, sizeY, texW, texH, texture);
|
int posX,
|
||||||
|
int posY,
|
||||||
|
String name,
|
||||||
|
int sheetX,
|
||||||
|
int sheetY,
|
||||||
|
int hoverX,
|
||||||
|
int hoverY,
|
||||||
|
int disabledX,
|
||||||
|
int disabledY,
|
||||||
|
int sizeX,
|
||||||
|
int sizeY,
|
||||||
|
int texW,
|
||||||
|
int texH,
|
||||||
|
ResourceLocation texture
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
gui,
|
||||||
|
posX,
|
||||||
|
posY,
|
||||||
|
name,
|
||||||
|
sheetX,
|
||||||
|
sheetY,
|
||||||
|
hoverX,
|
||||||
|
hoverY,
|
||||||
|
disabledX,
|
||||||
|
disabledY,
|
||||||
|
sizeX,
|
||||||
|
sizeY,
|
||||||
|
texW,
|
||||||
|
texH,
|
||||||
|
texture
|
||||||
|
);
|
||||||
this.isChecked = false;
|
this.isChecked = false;
|
||||||
|
|
||||||
// TODO Standardize size and textures - should only ever need to know gui, name, and positioning
|
// TODO Standardize size and textures - should only ever need to know gui, name,
|
||||||
|
// and positioning
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isChecked()
|
public boolean isChecked() {
|
||||||
{
|
|
||||||
return isChecked;
|
return isChecked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElementCheckBox check()
|
public ElementCheckBox check() {
|
||||||
{
|
|
||||||
return setIsChecked(true);
|
return setIsChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElementCheckBox unCheck()
|
public ElementCheckBox unCheck() {
|
||||||
{
|
|
||||||
return setIsChecked(false);
|
return setIsChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElementCheckBox setIsChecked(boolean isChecked)
|
public ElementCheckBox setIsChecked(boolean isChecked) {
|
||||||
{
|
|
||||||
this.isChecked = isChecked;
|
this.isChecked = isChecked;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,52 +6,47 @@ import com.pahimar.ee3.network.message.MessageGuiElementTextFieldUpdate;
|
||||||
import com.pahimar.repackage.cofh.lib.gui.GuiBase;
|
import com.pahimar.repackage.cofh.lib.gui.GuiBase;
|
||||||
import com.pahimar.repackage.cofh.lib.gui.element.ElementTextField;
|
import com.pahimar.repackage.cofh.lib.gui.element.ElementTextField;
|
||||||
|
|
||||||
public class ElementSearchField extends ElementTextField
|
public class ElementSearchField extends ElementTextField {
|
||||||
{
|
public ElementSearchField(
|
||||||
public ElementSearchField(GuiBase gui, int posX, int posY, String name, int width, int height)
|
GuiBase gui, int posX, int posY, String name, int width, int height
|
||||||
{
|
) {
|
||||||
super(gui, posX, posY, name, width, height);
|
super(gui, posX, posY, name, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCharacterEntered(boolean success)
|
protected void onCharacterEntered(boolean success) {
|
||||||
{
|
if (success && this.gui.inventorySlots instanceof IElementTextFieldHandler) {
|
||||||
if (success && this.gui.inventorySlots instanceof IElementTextFieldHandler)
|
((IElementTextFieldHandler) this.gui.inventorySlots)
|
||||||
{
|
.handleElementTextFieldUpdate(this.name, this.getText());
|
||||||
((IElementTextFieldHandler) this.gui.inventorySlots).handleElementTextFieldUpdate(this.name, this.getText());
|
PacketHandler.INSTANCE.sendToServer(new MessageGuiElementTextFieldUpdate(this)
|
||||||
PacketHandler.INSTANCE.sendToServer(new MessageGuiElementTextFieldUpdate(this));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onEnter()
|
protected boolean onEnter() {
|
||||||
{
|
if (isFocused()) {
|
||||||
if (isFocused())
|
|
||||||
{
|
|
||||||
this.setFocused(false);
|
this.setFocused(false);
|
||||||
}
|
}
|
||||||
return super.onEnter();
|
return super.onEnter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMousePressed(int mouseX, int mouseY, int mouseButton)
|
public boolean onMousePressed(int mouseX, int mouseY, int mouseButton) {
|
||||||
{
|
|
||||||
super.onMousePressed(mouseX, mouseY, mouseButton);
|
super.onMousePressed(mouseX, mouseY, mouseButton);
|
||||||
if (mouseButton == 1)
|
if (mouseButton == 1) {
|
||||||
{
|
|
||||||
this.setText("");
|
this.setText("");
|
||||||
PacketHandler.INSTANCE.sendToServer(new MessageGuiElementTextFieldUpdate(this));
|
PacketHandler.INSTANCE.sendToServer(new MessageGuiElementTextFieldUpdate(this)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMouseReleased(int mouseX, int mouseY)
|
public void onMouseReleased(int mouseX, int mouseY) {
|
||||||
{
|
|
||||||
super.onMouseReleased(mouseX, mouseY);
|
super.onMouseReleased(mouseX, mouseY);
|
||||||
if (this.intersectsWith(mouseX, mouseY))
|
if (this.intersectsWith(mouseX, mouseY)) {
|
||||||
{
|
|
||||||
this.setFocused(true);
|
this.setFocused(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,23 +4,51 @@ import com.pahimar.repackage.cofh.lib.gui.GuiBase;
|
||||||
import com.pahimar.repackage.cofh.lib.gui.element.ElementButton;
|
import com.pahimar.repackage.cofh.lib.gui.element.ElementButton;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class ElementStatefulButton extends ElementButton
|
public class ElementStatefulButton extends ElementButton {
|
||||||
{
|
|
||||||
private int state;
|
private int state;
|
||||||
|
|
||||||
public ElementStatefulButton(GuiBase gui, int posX, int posY, String name, int sheetX, int sheetY, int hoverX, int hoverY, int disabledX, int disabledY, int sizeX, int sizeY, int texW, int texH, ResourceLocation texture)
|
public ElementStatefulButton(
|
||||||
{
|
GuiBase gui,
|
||||||
super(gui, posX, posY, name, sheetX, sheetY, hoverX, hoverY, disabledX, disabledY, sizeX, sizeY, texW, texH, texture);
|
int posX,
|
||||||
|
int posY,
|
||||||
|
String name,
|
||||||
|
int sheetX,
|
||||||
|
int sheetY,
|
||||||
|
int hoverX,
|
||||||
|
int hoverY,
|
||||||
|
int disabledX,
|
||||||
|
int disabledY,
|
||||||
|
int sizeX,
|
||||||
|
int sizeY,
|
||||||
|
int texW,
|
||||||
|
int texH,
|
||||||
|
ResourceLocation texture
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
gui,
|
||||||
|
posX,
|
||||||
|
posY,
|
||||||
|
name,
|
||||||
|
sheetX,
|
||||||
|
sheetY,
|
||||||
|
hoverX,
|
||||||
|
hoverY,
|
||||||
|
disabledX,
|
||||||
|
disabledY,
|
||||||
|
sizeX,
|
||||||
|
sizeY,
|
||||||
|
texW,
|
||||||
|
texH,
|
||||||
|
texture
|
||||||
|
);
|
||||||
this.state = 0;
|
this.state = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getState()
|
public int getState() {
|
||||||
{
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElementStatefulButton setState(int state)
|
public ElementStatefulButton setState(int state) {
|
||||||
{
|
|
||||||
this.state = state;
|
this.state = state;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,50 +13,79 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiAdminPanel extends GuiBase
|
public class GuiAdminPanel extends GuiBase {
|
||||||
{
|
|
||||||
|
|
||||||
private ElementButton learnableButton;
|
private ElementButton learnableButton;
|
||||||
private ElementButton recoverableButton;
|
private ElementButton recoverableButton;
|
||||||
|
|
||||||
public GuiAdminPanel(InventoryPlayer inventoryPlayer)
|
public GuiAdminPanel(InventoryPlayer inventoryPlayer) {
|
||||||
{
|
|
||||||
super(new ContainerAdminPanel(inventoryPlayer), Textures.Gui.ADMIN_PANEL);
|
super(new ContainerAdminPanel(inventoryPlayer), Textures.Gui.ADMIN_PANEL);
|
||||||
xSize = 175;
|
xSize = 175;
|
||||||
ySize = 176;
|
ySize = 176;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui()
|
public void initGui() {
|
||||||
{
|
|
||||||
super.initGui();
|
super.initGui();
|
||||||
|
|
||||||
learnableButton = new ElementButton(this, 65, 22, "learnable", 0, 0, 0, 20, 0, 40, 100, 20, 100, 60, Textures.Gui.Elements.BUTTON);
|
learnableButton = new ElementButton(
|
||||||
recoverableButton = new ElementButton(this, 65, 48, "recoverable", 0, 0, 0, 20, 0, 40, 100, 20, 100, 60, Textures.Gui.Elements.BUTTON);
|
this,
|
||||||
|
65,
|
||||||
|
22,
|
||||||
|
"learnable",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
20,
|
||||||
|
0,
|
||||||
|
40,
|
||||||
|
100,
|
||||||
|
20,
|
||||||
|
100,
|
||||||
|
60,
|
||||||
|
Textures.Gui.Elements.BUTTON
|
||||||
|
);
|
||||||
|
recoverableButton = new ElementButton(
|
||||||
|
this,
|
||||||
|
65,
|
||||||
|
48,
|
||||||
|
"recoverable",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
20,
|
||||||
|
0,
|
||||||
|
40,
|
||||||
|
100,
|
||||||
|
20,
|
||||||
|
100,
|
||||||
|
60,
|
||||||
|
Textures.Gui.Elements.BUTTON
|
||||||
|
);
|
||||||
addElement(learnableButton);
|
addElement(learnableButton);
|
||||||
addElement(recoverableButton);
|
addElement(recoverableButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int x, int y)
|
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||||
{
|
|
||||||
super.drawGuiContainerForegroundLayer(x, y);
|
super.drawGuiContainerForegroundLayer(x, y);
|
||||||
|
|
||||||
if (learnableButton.intersectsWith(mouseX, mouseY))
|
if (learnableButton.intersectsWith(mouseX, mouseY)) {
|
||||||
{
|
fontRendererObj.drawSplitString(
|
||||||
fontRendererObj.drawSplitString("Not Learnable", 81, 28, 100, new GuiColor(255, 255, 255).getColor());
|
"Not Learnable", 81, 28, 100, new GuiColor(255, 255, 255).getColor()
|
||||||
}
|
);
|
||||||
else
|
} else {
|
||||||
{
|
fontRendererObj.drawSplitString(
|
||||||
fontRendererObj.drawSplitString("Learnable", 90, 28, 100, new GuiColor(255, 255, 255).getColor());
|
"Learnable", 90, 28, 100, new GuiColor(255, 255, 255).getColor()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fontRendererObj.drawSplitString("Recoverable", 85, 54, 100, new GuiColor(255, 255, 255).getColor());
|
fontRendererObj.drawSplitString(
|
||||||
|
"Recoverable", 85, 54, 100, new GuiColor(255, 255, 255).getColor()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int x, int y)
|
protected void drawGuiContainerBackgroundLayer(float partialTicks, int x, int y) {
|
||||||
{
|
|
||||||
mouseX = x - guiLeft;
|
mouseX = x - guiLeft;
|
||||||
mouseY = y - guiTop;
|
mouseY = y - guiTop;
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
@ -70,14 +99,12 @@ public class GuiAdminPanel extends GuiBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateElementInformation()
|
protected void updateElementInformation() {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleElementButtonClick(String buttonName, int mouseButton)
|
public void handleElementButtonClick(String buttonName, int mouseButton) {
|
||||||
{
|
PacketHandler.INSTANCE.sendToServer(
|
||||||
PacketHandler.INSTANCE.sendToServer(new MessageGuiElementClicked(buttonName, mouseButton));
|
new MessageGuiElementClicked(buttonName, mouseButton)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,60 +15,58 @@ import net.minecraft.util.StatCollector;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiAlchemicalBag extends GuiContainer
|
public class GuiAlchemicalBag extends GuiContainer {
|
||||||
{
|
|
||||||
private final ItemStack parentItemStack;
|
private final ItemStack parentItemStack;
|
||||||
private final InventoryAlchemicalBag inventoryAlchemicalBag;
|
private final InventoryAlchemicalBag inventoryAlchemicalBag;
|
||||||
|
|
||||||
public GuiAlchemicalBag(EntityPlayer entityPlayer, InventoryAlchemicalBag inventoryAlchemicalBag)
|
public GuiAlchemicalBag(
|
||||||
{
|
EntityPlayer entityPlayer, InventoryAlchemicalBag inventoryAlchemicalBag
|
||||||
|
) {
|
||||||
super(new ContainerAlchemicalBag(entityPlayer, inventoryAlchemicalBag));
|
super(new ContainerAlchemicalBag(entityPlayer, inventoryAlchemicalBag));
|
||||||
|
|
||||||
this.parentItemStack = inventoryAlchemicalBag.parentItemStack;
|
this.parentItemStack = inventoryAlchemicalBag.parentItemStack;
|
||||||
this.inventoryAlchemicalBag = inventoryAlchemicalBag;
|
this.inventoryAlchemicalBag = inventoryAlchemicalBag;
|
||||||
|
|
||||||
if (this.parentItemStack.getItemDamage() == 0)
|
if (this.parentItemStack.getItemDamage() == 0) {
|
||||||
{
|
|
||||||
xSize = 230;
|
xSize = 230;
|
||||||
ySize = 186;
|
ySize = 186;
|
||||||
}
|
} else if (this.parentItemStack.getItemDamage() == 1) {
|
||||||
else if (this.parentItemStack.getItemDamage() == 1)
|
|
||||||
{
|
|
||||||
xSize = 230;
|
xSize = 230;
|
||||||
ySize = 240;
|
ySize = 240;
|
||||||
}
|
} else if (this.parentItemStack.getItemDamage() == 2) {
|
||||||
else if (this.parentItemStack.getItemDamage() == 2)
|
|
||||||
{
|
|
||||||
xSize = 248;
|
xSize = 248;
|
||||||
ySize = 256;
|
ySize = 256;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int x, int y)
|
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||||
{
|
if (this.parentItemStack.getItemDamage() == 0
|
||||||
if (this.parentItemStack.getItemDamage() == 0 || this.parentItemStack.getItemDamage() == 1)
|
|| this.parentItemStack.getItemDamage() == 1) {
|
||||||
{
|
fontRendererObj.drawString(
|
||||||
fontRendererObj.drawString(StatCollector.translateToLocal(inventoryAlchemicalBag.getInventoryName()), 8, 6, Integer.parseInt(Colors.PURE_WHITE, 16));
|
StatCollector.translateToLocal(inventoryAlchemicalBag.getInventoryName()),
|
||||||
fontRendererObj.drawString(StatCollector.translateToLocal(Names.Containers.VANILLA_INVENTORY), 35, ySize - 95 + 2, Integer.parseInt(Colors.PURE_WHITE, 16));
|
8,
|
||||||
|
6,
|
||||||
|
Integer.parseInt(Colors.PURE_WHITE, 16)
|
||||||
|
);
|
||||||
|
fontRendererObj.drawString(
|
||||||
|
StatCollector.translateToLocal(Names.Containers.VANILLA_INVENTORY),
|
||||||
|
35,
|
||||||
|
ySize - 95 + 2,
|
||||||
|
Integer.parseInt(Colors.PURE_WHITE, 16)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y)
|
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
|
||||||
{
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
if (this.parentItemStack.getItemDamage() == 0)
|
if (this.parentItemStack.getItemDamage() == 0) {
|
||||||
{
|
|
||||||
this.mc.getTextureManager().bindTexture(Textures.Gui.ALCHEMICAL_BAG_SMALL);
|
this.mc.getTextureManager().bindTexture(Textures.Gui.ALCHEMICAL_BAG_SMALL);
|
||||||
}
|
} else if (this.parentItemStack.getItemDamage() == 1) {
|
||||||
else if (this.parentItemStack.getItemDamage() == 1)
|
|
||||||
{
|
|
||||||
this.mc.getTextureManager().bindTexture(Textures.Gui.ALCHEMICAL_BAG_MEDIUM);
|
this.mc.getTextureManager().bindTexture(Textures.Gui.ALCHEMICAL_BAG_MEDIUM);
|
||||||
}
|
} else if (this.parentItemStack.getItemDamage() == 2) {
|
||||||
else if (this.parentItemStack.getItemDamage() == 2)
|
|
||||||
{
|
|
||||||
this.mc.getTextureManager().bindTexture(Textures.Gui.ALCHEMICAL_BAG_LARGE);
|
this.mc.getTextureManager().bindTexture(Textures.Gui.ALCHEMICAL_BAG_LARGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,18 +76,13 @@ public class GuiAlchemicalBag extends GuiContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onGuiClosed()
|
public void onGuiClosed() {
|
||||||
{
|
|
||||||
super.onGuiClosed();
|
super.onGuiClosed();
|
||||||
|
|
||||||
if (mc.thePlayer != null)
|
if (mc.thePlayer != null) {
|
||||||
{
|
for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory) {
|
||||||
for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory)
|
if (itemStack != null) {
|
||||||
{
|
if (NBTHelper.hasKey(itemStack, Names.NBT.ALCHEMICAL_BAG_GUI_OPEN)) {
|
||||||
if (itemStack != null)
|
|
||||||
{
|
|
||||||
if (NBTHelper.hasKey(itemStack, Names.NBT.ALCHEMICAL_BAG_GUI_OPEN))
|
|
||||||
{
|
|
||||||
NBTHelper.removeTag(itemStack, Names.NBT.ALCHEMICAL_BAG_GUI_OPEN);
|
NBTHelper.removeTag(itemStack, Names.NBT.ALCHEMICAL_BAG_GUI_OPEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,9 +91,7 @@ public class GuiAlchemicalBag extends GuiContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean checkHotbarKeys(int key)
|
protected boolean checkHotbarKeys(int key) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,57 +10,56 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public class GuiAlchemicalChest extends GuiContainer
|
public class GuiAlchemicalChest extends GuiContainer {
|
||||||
{
|
|
||||||
private TileEntityAlchemicalChest tileEntityAlchemicalChest;
|
private TileEntityAlchemicalChest tileEntityAlchemicalChest;
|
||||||
|
|
||||||
public GuiAlchemicalChest(InventoryPlayer inventoryPlayer, TileEntityAlchemicalChest alchemicalChest)
|
public GuiAlchemicalChest(
|
||||||
{
|
InventoryPlayer inventoryPlayer, TileEntityAlchemicalChest alchemicalChest
|
||||||
|
) {
|
||||||
super(new ContainerAlchemicalChest(inventoryPlayer, alchemicalChest));
|
super(new ContainerAlchemicalChest(inventoryPlayer, alchemicalChest));
|
||||||
tileEntityAlchemicalChest = alchemicalChest;
|
tileEntityAlchemicalChest = alchemicalChest;
|
||||||
|
|
||||||
if (this.tileEntityAlchemicalChest.getState() == 0)
|
if (this.tileEntityAlchemicalChest.getState() == 0) {
|
||||||
{
|
|
||||||
xSize = 230;
|
xSize = 230;
|
||||||
ySize = 186;
|
ySize = 186;
|
||||||
}
|
} else if (this.tileEntityAlchemicalChest.getState() == 1) {
|
||||||
else if (this.tileEntityAlchemicalChest.getState() == 1)
|
|
||||||
{
|
|
||||||
xSize = 230;
|
xSize = 230;
|
||||||
ySize = 240;
|
ySize = 240;
|
||||||
}
|
} else if (this.tileEntityAlchemicalChest.getState() == 2) {
|
||||||
else if (this.tileEntityAlchemicalChest.getState() == 2)
|
|
||||||
{
|
|
||||||
xSize = 248;
|
xSize = 248;
|
||||||
ySize = 256;
|
ySize = 256;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int x, int y)
|
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||||
{
|
if (tileEntityAlchemicalChest.getState() == 0
|
||||||
if (tileEntityAlchemicalChest.getState() == 0 || tileEntityAlchemicalChest.getState() == 1)
|
|| tileEntityAlchemicalChest.getState() == 1) {
|
||||||
{
|
fontRendererObj.drawString(
|
||||||
fontRendererObj.drawString(StatCollector.translateToLocal(tileEntityAlchemicalChest.getInventoryName()), 8, 6, Integer.parseInt(Colors.PURE_WHITE, 16));
|
StatCollector.translateToLocal(tileEntityAlchemicalChest.getInventoryName(
|
||||||
fontRendererObj.drawString(StatCollector.translateToLocal(Names.Containers.VANILLA_INVENTORY), 35, ySize - 95 + 2, Integer.parseInt(Colors.PURE_WHITE, 16));
|
)),
|
||||||
|
8,
|
||||||
|
6,
|
||||||
|
Integer.parseInt(Colors.PURE_WHITE, 16)
|
||||||
|
);
|
||||||
|
fontRendererObj.drawString(
|
||||||
|
StatCollector.translateToLocal(Names.Containers.VANILLA_INVENTORY),
|
||||||
|
35,
|
||||||
|
ySize - 95 + 2,
|
||||||
|
Integer.parseInt(Colors.PURE_WHITE, 16)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y)
|
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
|
||||||
{
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
if (tileEntityAlchemicalChest.getState() == 0)
|
if (tileEntityAlchemicalChest.getState() == 0) {
|
||||||
{
|
|
||||||
this.mc.getTextureManager().bindTexture(Textures.Gui.ALCHEMICAL_CHEST_SMALL);
|
this.mc.getTextureManager().bindTexture(Textures.Gui.ALCHEMICAL_CHEST_SMALL);
|
||||||
}
|
} else if (tileEntityAlchemicalChest.getState() == 1) {
|
||||||
else if (tileEntityAlchemicalChest.getState() == 1)
|
|
||||||
{
|
|
||||||
this.mc.getTextureManager().bindTexture(Textures.Gui.ALCHEMICAL_CHEST_MEDIUM);
|
this.mc.getTextureManager().bindTexture(Textures.Gui.ALCHEMICAL_CHEST_MEDIUM);
|
||||||
}
|
} else if (tileEntityAlchemicalChest.getState() == 2) {
|
||||||
else if (tileEntityAlchemicalChest.getState() == 2)
|
|
||||||
{
|
|
||||||
this.mc.getTextureManager().bindTexture(Textures.Gui.ALCHEMICAL_CHEST_LARGE);
|
this.mc.getTextureManager().bindTexture(Textures.Gui.ALCHEMICAL_CHEST_LARGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,29 +19,61 @@ import net.minecraft.util.StatCollector;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiAlchenomicon extends GuiBase
|
public class GuiAlchenomicon extends GuiBase {
|
||||||
{
|
|
||||||
private ElementButton prevPageButton;
|
private ElementButton prevPageButton;
|
||||||
private ElementButton nextPageButton;
|
private ElementButton nextPageButton;
|
||||||
private ElementTextField searchTextField;
|
private ElementTextField searchTextField;
|
||||||
|
|
||||||
public GuiAlchenomicon(InventoryPlayer inventoryPlayer, ItemStack itemStack)
|
public GuiAlchenomicon(InventoryPlayer inventoryPlayer, ItemStack itemStack) {
|
||||||
{
|
super(
|
||||||
super(new ContainerAlchenomicon(inventoryPlayer.player, itemStack), Textures.Gui.ALCHENOMICON);
|
new ContainerAlchenomicon(inventoryPlayer.player, itemStack),
|
||||||
|
Textures.Gui.ALCHENOMICON
|
||||||
|
);
|
||||||
xSize = 256;
|
xSize = 256;
|
||||||
ySize = 226;
|
ySize = 226;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui()
|
public void initGui() {
|
||||||
{
|
|
||||||
super.initGui();
|
super.initGui();
|
||||||
|
|
||||||
this.drawTitle = false;
|
this.drawTitle = false;
|
||||||
this.drawInventory = false;
|
this.drawInventory = false;
|
||||||
|
|
||||||
prevPageButton = new ElementButton(this, 15, 177, "prev", 0, 0, 20, 0, 40, 0, 20, 10, 60, 10, Textures.Gui.Elements.ARROW_LEFT);
|
prevPageButton = new ElementButton(
|
||||||
nextPageButton = new ElementButton(this, 223, 177, "next", 0, 0, 22, 0, 44, 0, 22, 10, 66, 10, Textures.Gui.Elements.ARROW_RIGHT);
|
this,
|
||||||
|
15,
|
||||||
|
177,
|
||||||
|
"prev",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
20,
|
||||||
|
0,
|
||||||
|
40,
|
||||||
|
0,
|
||||||
|
20,
|
||||||
|
10,
|
||||||
|
60,
|
||||||
|
10,
|
||||||
|
Textures.Gui.Elements.ARROW_LEFT
|
||||||
|
);
|
||||||
|
nextPageButton = new ElementButton(
|
||||||
|
this,
|
||||||
|
223,
|
||||||
|
177,
|
||||||
|
"next",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
22,
|
||||||
|
0,
|
||||||
|
44,
|
||||||
|
0,
|
||||||
|
22,
|
||||||
|
10,
|
||||||
|
66,
|
||||||
|
10,
|
||||||
|
Textures.Gui.Elements.ARROW_RIGHT
|
||||||
|
);
|
||||||
searchTextField = new ElementSearchField(this, 64, 205, "searchField", 128, 20);
|
searchTextField = new ElementSearchField(this, 64, 205, "searchField", 128, 20);
|
||||||
searchTextField.setPadding(6, 3, 0, 3);
|
searchTextField.setPadding(6, 3, 0, 3);
|
||||||
searchTextField.borderColor = new GuiColor(160, 160, 160).getColor();
|
searchTextField.borderColor = new GuiColor(160, 160, 160).getColor();
|
||||||
|
@ -53,32 +85,37 @@ public class GuiAlchenomicon extends GuiBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int x, int y)
|
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||||
{
|
|
||||||
super.drawGuiContainerForegroundLayer(x, y);
|
super.drawGuiContainerForegroundLayer(x, y);
|
||||||
int pageOffset = ((ContainerAlchenomicon) this.inventorySlots).getPageOffset();
|
int pageOffset = ((ContainerAlchenomicon) this.inventorySlots).getPageOffset();
|
||||||
|
|
||||||
if (this.inventorySlots.getSlot(0).getHasStack())
|
if (this.inventorySlots.getSlot(0).getHasStack()) {
|
||||||
{
|
fontRendererObj.drawString(
|
||||||
fontRendererObj.drawString((pageOffset * 2 + 1) + "", 64, 178, new GuiColor(50, 50, 50).getColor());
|
(pageOffset * 2 + 1) + "", 64, 178, new GuiColor(50, 50, 50).getColor()
|
||||||
}
|
);
|
||||||
else
|
} else {
|
||||||
{
|
if (((ContainerAlchenomicon) this.inventorySlots)
|
||||||
if (((ContainerAlchenomicon) this.inventorySlots).getKnownTransmutationsCount() == 0)
|
.getKnownTransmutationsCount()
|
||||||
{
|
== 0) {
|
||||||
fontRendererObj.drawSplitString(StatCollector.translateToLocal(Messages.Gui.NO_KNOWN_TRANSMUTATIONS), 142, 20, 100, new GuiColor(50, 50, 50).getColor());
|
fontRendererObj.drawSplitString(
|
||||||
|
StatCollector.translateToLocal(Messages.Gui.NO_KNOWN_TRANSMUTATIONS),
|
||||||
|
142,
|
||||||
|
20,
|
||||||
|
100,
|
||||||
|
new GuiColor(50, 50, 50).getColor()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.inventorySlots.getSlot(40).getHasStack())
|
if (this.inventorySlots.getSlot(40).getHasStack()) {
|
||||||
{
|
fontRendererObj.drawString(
|
||||||
fontRendererObj.drawString((pageOffset * 2 + 2) + "", 186, 178, new GuiColor(50, 50, 50).getColor());
|
(pageOffset * 2 + 2) + "", 186, 178, new GuiColor(50, 50, 50).getColor()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int x, int y)
|
protected void drawGuiContainerBackgroundLayer(float partialTicks, int x, int y) {
|
||||||
{
|
|
||||||
mouseX = x - guiLeft;
|
mouseX = x - guiLeft;
|
||||||
mouseY = y - guiTop;
|
mouseY = y - guiTop;
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
@ -92,36 +129,31 @@ public class GuiAlchenomicon extends GuiBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateElementInformation()
|
protected void updateElementInformation() {
|
||||||
{
|
if (((ContainerAlchenomicon) this.inventorySlots).getPageOffset() == 0) {
|
||||||
if (((ContainerAlchenomicon) this.inventorySlots).getPageOffset() == 0)
|
|
||||||
{
|
|
||||||
prevPageButton.setDisabled();
|
prevPageButton.setDisabled();
|
||||||
}
|
} else if (!prevPageButton.isEnabled()) {
|
||||||
else if (!prevPageButton.isEnabled())
|
|
||||||
{
|
|
||||||
prevPageButton.setEnabled(true);
|
prevPageButton.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((ContainerAlchenomicon) this.inventorySlots).getPageOffset() == ((ContainerAlchenomicon) this.inventorySlots).getMaxPageOffset())
|
if (((ContainerAlchenomicon) this.inventorySlots).getPageOffset()
|
||||||
{
|
== ((ContainerAlchenomicon) this.inventorySlots).getMaxPageOffset()) {
|
||||||
nextPageButton.setDisabled();
|
nextPageButton.setDisabled();
|
||||||
}
|
} else if (!nextPageButton.isEnabled()) {
|
||||||
else if (!nextPageButton.isEnabled())
|
|
||||||
{
|
|
||||||
nextPageButton.setEnabled(true);
|
nextPageButton.setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleMouseClick(Slot slot, int p_146984_2_, int p_146984_3_, int p_146984_4_)
|
protected void
|
||||||
{
|
handleMouseClick(Slot slot, int p_146984_2_, int p_146984_3_, int p_146984_4_) {
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleElementButtonClick(String buttonName, int mouseButton)
|
public void handleElementButtonClick(String buttonName, int mouseButton) {
|
||||||
{
|
PacketHandler.INSTANCE.sendToServer(
|
||||||
PacketHandler.INSTANCE.sendToServer(new MessageGuiElementClicked(buttonName, mouseButton));
|
new MessageGuiElementClicked(buttonName, mouseButton)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,10 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiAludel extends GuiContainer
|
public class GuiAludel extends GuiContainer {
|
||||||
{
|
|
||||||
private TileEntityAludel tileEntityAludel;
|
private TileEntityAludel tileEntityAludel;
|
||||||
|
|
||||||
public GuiAludel(InventoryPlayer inventoryPlayer, TileEntityAludel tileEntityAludel)
|
public GuiAludel(InventoryPlayer inventoryPlayer, TileEntityAludel tileEntityAludel) {
|
||||||
{
|
|
||||||
super(new ContainerAludel(inventoryPlayer, tileEntityAludel));
|
super(new ContainerAludel(inventoryPlayer, tileEntityAludel));
|
||||||
this.tileEntityAludel = tileEntityAludel;
|
this.tileEntityAludel = tileEntityAludel;
|
||||||
xSize = 176;
|
xSize = 176;
|
||||||
|
@ -23,14 +21,12 @@ public class GuiAludel extends GuiContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int x, int y)
|
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||||
{
|
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3)
|
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
|
||||||
{
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
this.mc.getTextureManager().bindTexture(Textures.Gui.ALUDEL);
|
this.mc.getTextureManager().bindTexture(Textures.Gui.ALUDEL);
|
||||||
|
@ -40,13 +36,21 @@ public class GuiAludel extends GuiContainer
|
||||||
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
|
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
|
||||||
int scaleAdjustment;
|
int scaleAdjustment;
|
||||||
|
|
||||||
if (this.tileEntityAludel.getState() == 1)
|
if (this.tileEntityAludel.getState() == 1) {
|
||||||
{
|
|
||||||
scaleAdjustment = this.tileEntityAludel.getBurnTimeRemainingScaled(12);
|
scaleAdjustment = this.tileEntityAludel.getBurnTimeRemainingScaled(12);
|
||||||
this.drawTexturedModalRect(xStart + 45, yStart + 36 + 34 - scaleAdjustment, 176, 12 - scaleAdjustment, 14, scaleAdjustment + 2);
|
this.drawTexturedModalRect(
|
||||||
|
xStart + 45,
|
||||||
|
yStart + 36 + 34 - scaleAdjustment,
|
||||||
|
176,
|
||||||
|
12 - scaleAdjustment,
|
||||||
|
14,
|
||||||
|
scaleAdjustment + 2
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
scaleAdjustment = this.tileEntityAludel.getCookProgressScaled(24);
|
scaleAdjustment = this.tileEntityAludel.getCookProgressScaled(24);
|
||||||
this.drawTexturedModalRect(xStart + 80, yStart + 40, 176, 14, scaleAdjustment + 1, 16);
|
this.drawTexturedModalRect(
|
||||||
|
xStart + 80, yStart + 40, 176, 14, scaleAdjustment + 1, 16
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,26 +10,24 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiCalcinator extends GuiContainer
|
public class GuiCalcinator extends GuiContainer {
|
||||||
{
|
|
||||||
private TileEntityCalcinator tileEntityCalcinator;
|
private TileEntityCalcinator tileEntityCalcinator;
|
||||||
|
|
||||||
public GuiCalcinator(InventoryPlayer inventoryPlayer, TileEntityCalcinator tileEntityCalcinator)
|
public GuiCalcinator(
|
||||||
{
|
InventoryPlayer inventoryPlayer, TileEntityCalcinator tileEntityCalcinator
|
||||||
|
) {
|
||||||
super(new ContainerCalcinator(inventoryPlayer, tileEntityCalcinator));
|
super(new ContainerCalcinator(inventoryPlayer, tileEntityCalcinator));
|
||||||
ySize = 176;
|
ySize = 176;
|
||||||
this.tileEntityCalcinator = tileEntityCalcinator;
|
this.tileEntityCalcinator = tileEntityCalcinator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int x, int y)
|
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||||
{
|
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y)
|
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
|
||||||
{
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
this.mc.getTextureManager().bindTexture(Textures.Gui.CALCINATOR);
|
this.mc.getTextureManager().bindTexture(Textures.Gui.CALCINATOR);
|
||||||
|
@ -39,13 +37,21 @@ public class GuiCalcinator extends GuiContainer
|
||||||
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
|
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
|
||||||
int scaleAdjustment;
|
int scaleAdjustment;
|
||||||
|
|
||||||
if (this.tileEntityCalcinator.getState() == 1)
|
if (this.tileEntityCalcinator.getState() == 1) {
|
||||||
{
|
|
||||||
scaleAdjustment = this.tileEntityCalcinator.getBurnTimeRemainingScaled(12);
|
scaleAdjustment = this.tileEntityCalcinator.getBurnTimeRemainingScaled(12);
|
||||||
this.drawTexturedModalRect(xStart + 46, yStart + 22 + 23 - scaleAdjustment, 176, 12 - scaleAdjustment, 14, scaleAdjustment + 2);
|
this.drawTexturedModalRect(
|
||||||
|
xStart + 46,
|
||||||
|
yStart + 22 + 23 - scaleAdjustment,
|
||||||
|
176,
|
||||||
|
12 - scaleAdjustment,
|
||||||
|
14,
|
||||||
|
scaleAdjustment + 2
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
scaleAdjustment = this.tileEntityCalcinator.getCookProgressScaled(24);
|
scaleAdjustment = this.tileEntityCalcinator.getCookProgressScaled(24);
|
||||||
this.drawTexturedModalRect(xStart + 75, yStart + 30, 176, 14, scaleAdjustment + 1, 16);
|
this.drawTexturedModalRect(
|
||||||
|
xStart + 75, yStart + 30, 176, 14, scaleAdjustment + 1, 16
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,12 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiGlassBell extends GuiContainer
|
public class GuiGlassBell extends GuiContainer {
|
||||||
{
|
|
||||||
private TileEntityGlassBell tileEntityGlassBell;
|
private TileEntityGlassBell tileEntityGlassBell;
|
||||||
|
|
||||||
public GuiGlassBell(InventoryPlayer inventoryPlayer, TileEntityGlassBell tileEntityGlassBell)
|
public GuiGlassBell(
|
||||||
{
|
InventoryPlayer inventoryPlayer, TileEntityGlassBell tileEntityGlassBell
|
||||||
|
) {
|
||||||
super(new ContainerGlassBell(inventoryPlayer, tileEntityGlassBell));
|
super(new ContainerGlassBell(inventoryPlayer, tileEntityGlassBell));
|
||||||
this.tileEntityGlassBell = tileEntityGlassBell;
|
this.tileEntityGlassBell = tileEntityGlassBell;
|
||||||
xSize = 176;
|
xSize = 176;
|
||||||
|
@ -23,14 +23,12 @@ public class GuiGlassBell extends GuiContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int x, int y)
|
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||||
{
|
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3)
|
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
|
||||||
{
|
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
|
@ -3,9 +3,6 @@ package com.pahimar.ee3.client.gui.inventory;
|
||||||
import com.pahimar.ee3.inventory.ContainerPortableCrafting;
|
import com.pahimar.ee3.inventory.ContainerPortableCrafting;
|
||||||
import com.pahimar.ee3.reference.Names;
|
import com.pahimar.ee3.reference.Names;
|
||||||
import com.pahimar.ee3.util.NBTHelper;
|
import com.pahimar.ee3.util.NBTHelper;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
@ -14,18 +11,20 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiPortableCrafting extends GuiContainer {
|
public class GuiPortableCrafting extends GuiContainer {
|
||||||
|
|
||||||
public GuiPortableCrafting(EntityPlayer player, World world, int x, int y, int z) {
|
public GuiPortableCrafting(EntityPlayer player, World world, int x, int y, int z) {
|
||||||
super(new ContainerPortableCrafting(player.inventory, world, x, y, z));
|
super(new ContainerPortableCrafting(player.inventory, world, x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float arg0, int arg1, int arg2) {
|
protected void drawGuiContainerBackgroundLayer(float arg0, int arg1, int arg2) {
|
||||||
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
|
GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, (float) 1.0f);
|
||||||
this.mc.renderEngine.bindTexture(new ResourceLocation("textures/gui/container/crafting_table.png"));
|
this.mc.renderEngine.bindTexture(
|
||||||
|
new ResourceLocation("textures/gui/container/crafting_table.png")
|
||||||
|
);
|
||||||
int var5 = (this.width - this.xSize) / 2;
|
int var5 = (this.width - this.xSize) / 2;
|
||||||
int var6 = (this.height - this.ySize) / 2;
|
int var6 = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
|
||||||
|
@ -33,8 +32,15 @@ public class GuiPortableCrafting extends GuiContainer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||||
this.fontRendererObj.drawString(StatCollector.translateToLocal((String)"container.crafting"), 28, 6, 0x404040);
|
this.fontRendererObj.drawString(
|
||||||
this.fontRendererObj.drawString(StatCollector.translateToLocal((String)"container.inventory"), 8, this.ySize - 96 + 2, 0x404040);
|
StatCollector.translateToLocal((String) "container.crafting"), 28, 6, 0x404040
|
||||||
|
);
|
||||||
|
this.fontRendererObj.drawString(
|
||||||
|
StatCollector.translateToLocal((String) "container.inventory"),
|
||||||
|
8,
|
||||||
|
this.ySize - 96 + 2,
|
||||||
|
0x404040
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,10 +48,11 @@ public class GuiPortableCrafting extends GuiContainer {
|
||||||
super.onGuiClosed();
|
super.onGuiClosed();
|
||||||
if (this.mc.thePlayer != null) {
|
if (this.mc.thePlayer != null) {
|
||||||
for (ItemStack itemStack : this.mc.thePlayer.inventory.mainInventory) {
|
for (ItemStack itemStack : this.mc.thePlayer.inventory.mainInventory) {
|
||||||
if (itemStack == null || !NBTHelper.hasKey(itemStack, Names.NBT.CRAFTING_GUI_OPEN)) continue;
|
if (itemStack == null
|
||||||
|
|| !NBTHelper.hasKey(itemStack, Names.NBT.CRAFTING_GUI_OPEN))
|
||||||
|
continue;
|
||||||
NBTHelper.removeTag(itemStack, Names.NBT.CRAFTING_GUI_OPEN);
|
NBTHelper.removeTag(itemStack, Names.NBT.CRAFTING_GUI_OPEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,13 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiResearchStation extends GuiContainer
|
public class GuiResearchStation extends GuiContainer {
|
||||||
{
|
|
||||||
private TileEntityResearchStation tileEntityResearchStation;
|
private TileEntityResearchStation tileEntityResearchStation;
|
||||||
|
|
||||||
public GuiResearchStation(InventoryPlayer inventoryPlayer, TileEntityResearchStation tileEntityResearchStation)
|
public GuiResearchStation(
|
||||||
{
|
InventoryPlayer inventoryPlayer,
|
||||||
|
TileEntityResearchStation tileEntityResearchStation
|
||||||
|
) {
|
||||||
super(new ContainerResearchStation(inventoryPlayer, tileEntityResearchStation));
|
super(new ContainerResearchStation(inventoryPlayer, tileEntityResearchStation));
|
||||||
xSize = 256;
|
xSize = 256;
|
||||||
ySize = 234;
|
ySize = 234;
|
||||||
|
@ -23,8 +24,7 @@ public class GuiResearchStation extends GuiContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y)
|
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
|
||||||
{
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
||||||
this.mc.getTextureManager().bindTexture(Textures.Gui.RESEARCH_STATION);
|
this.mc.getTextureManager().bindTexture(Textures.Gui.RESEARCH_STATION);
|
||||||
|
@ -33,19 +33,24 @@ public class GuiResearchStation extends GuiContainer
|
||||||
int yStart = (height - ySize) / 2;
|
int yStart = (height - ySize) / 2;
|
||||||
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
|
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
|
||||||
|
|
||||||
if (this.tileEntityResearchStation.isItemKnown)
|
if (this.tileEntityResearchStation.isItemKnown) {
|
||||||
{
|
this.mc.getTextureManager().bindTexture(Textures.Gui.RESEARCH_STATION_GYLPH_1
|
||||||
this.mc.getTextureManager().bindTexture(Textures.Gui.RESEARCH_STATION_GYLPH_1);
|
);
|
||||||
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
|
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
|
||||||
}
|
} else {
|
||||||
else
|
int arrowScaleAdjustment
|
||||||
{
|
= this.tileEntityResearchStation.getLearnProgressScaled(42);
|
||||||
int arrowScaleAdjustment = this.tileEntityResearchStation.getLearnProgressScaled(42);
|
this.drawTexturedModalRect(
|
||||||
this.drawTexturedModalRect(xStart + 107, yStart + 87, 0, 236, arrowScaleAdjustment, 16);
|
xStart + 107, yStart + 87, 0, 236, arrowScaleAdjustment, 16
|
||||||
|
);
|
||||||
|
|
||||||
int scaleAdjustment = this.tileEntityResearchStation.getLearnProgressScaled(80);
|
int scaleAdjustment
|
||||||
this.mc.getTextureManager().bindTexture(Textures.Gui.RESEARCH_STATION_GYLPH_1);
|
= this.tileEntityResearchStation.getLearnProgressScaled(80);
|
||||||
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, (ySize * scaleAdjustment) / 100);
|
this.mc.getTextureManager().bindTexture(Textures.Gui.RESEARCH_STATION_GYLPH_1
|
||||||
|
);
|
||||||
|
this.drawTexturedModalRect(
|
||||||
|
xStart, yStart, 0, 0, xSize, (ySize * scaleAdjustment) / 100
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,22 +3,16 @@ package com.pahimar.ee3.client.gui.inventory;
|
||||||
import com.pahimar.ee3.inventory.ContainerSymbolSelection;
|
import com.pahimar.ee3.inventory.ContainerSymbolSelection;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
|
||||||
public class GuiSymbolSelection extends GuiContainer
|
public class GuiSymbolSelection extends GuiContainer {
|
||||||
{
|
public GuiSymbolSelection() {
|
||||||
public GuiSymbolSelection()
|
|
||||||
{
|
|
||||||
super(new ContainerSymbolSelection());
|
super(new ContainerSymbolSelection());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y)
|
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawDefaultBackground()
|
public void drawDefaultBackground() {
|
||||||
{
|
|
||||||
// NOOP
|
// NOOP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,12 +10,12 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiTransmutationArray extends GuiBase
|
public class GuiTransmutationArray extends GuiBase {
|
||||||
{
|
|
||||||
private TileEntityAlchemyArray tileEntityAlchemyArray;
|
private TileEntityAlchemyArray tileEntityAlchemyArray;
|
||||||
|
|
||||||
public GuiTransmutationArray(InventoryPlayer inventoryPlayer, TileEntityAlchemyArray tileEntityAlchemyArray)
|
public GuiTransmutationArray(
|
||||||
{
|
InventoryPlayer inventoryPlayer, TileEntityAlchemyArray tileEntityAlchemyArray
|
||||||
|
) {
|
||||||
super(new ContainerTransmutationArray(inventoryPlayer, tileEntityAlchemyArray));
|
super(new ContainerTransmutationArray(inventoryPlayer, tileEntityAlchemyArray));
|
||||||
this.tileEntityAlchemyArray = tileEntityAlchemyArray;
|
this.tileEntityAlchemyArray = tileEntityAlchemyArray;
|
||||||
xSize = 256;
|
xSize = 256;
|
||||||
|
@ -23,8 +23,7 @@ public class GuiTransmutationArray extends GuiBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui()
|
public void initGui() {
|
||||||
{
|
|
||||||
super.initGui();
|
super.initGui();
|
||||||
|
|
||||||
this.drawTitle = false;
|
this.drawTitle = false;
|
||||||
|
@ -32,27 +31,20 @@ public class GuiTransmutationArray extends GuiBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int x, int y)
|
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||||
{
|
|
||||||
super.drawGuiContainerForegroundLayer(x, y);
|
super.drawGuiContainerForegroundLayer(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int x, int y)
|
protected void drawGuiContainerBackgroundLayer(float partialTicks, int x, int y) {
|
||||||
{
|
|
||||||
mouseX = x - guiLeft;
|
mouseX = x - guiLeft;
|
||||||
mouseY = y - guiTop;
|
mouseY = y - guiTop;
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
if (tileEntityAlchemyArray.getSize() == 1)
|
if (tileEntityAlchemyArray.getSize() == 1) {
|
||||||
{
|
|
||||||
bindTexture(Textures.Gui.TRANSMUTATION_ARRAY_1);
|
bindTexture(Textures.Gui.TRANSMUTATION_ARRAY_1);
|
||||||
}
|
} else if (tileEntityAlchemyArray.getSize() == 2) {
|
||||||
else if (tileEntityAlchemyArray.getSize() == 2)
|
|
||||||
{
|
|
||||||
bindTexture(Textures.Gui.TRANSMUTATION_ARRAY_3);
|
bindTexture(Textures.Gui.TRANSMUTATION_ARRAY_3);
|
||||||
}
|
} else if (tileEntityAlchemyArray.getSize() == 3) {
|
||||||
else if (tileEntityAlchemyArray.getSize() == 3)
|
|
||||||
{
|
|
||||||
bindTexture(Textures.Gui.TRANSMUTATION_ARRAY_5);
|
bindTexture(Textures.Gui.TRANSMUTATION_ARRAY_5);
|
||||||
}
|
}
|
||||||
drawSizedTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize, 256f, 256f);
|
drawSizedTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize, 256f, 256f);
|
||||||
|
|
|
@ -22,7 +22,6 @@ import net.minecraft.util.StatCollector;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiTransmutationTablet extends GuiBase {
|
public class GuiTransmutationTablet extends GuiBase {
|
||||||
|
|
||||||
private ContainerTransmutationTablet containerTablet;
|
private ContainerTransmutationTablet containerTablet;
|
||||||
|
|
||||||
private ElementTextField searchTextField;
|
private ElementTextField searchTextField;
|
||||||
|
@ -41,17 +40,23 @@ public class GuiTransmutationTablet extends GuiBase {
|
||||||
private static final int SORT_ASCENDING = 0;
|
private static final int SORT_ASCENDING = 0;
|
||||||
private static final int SORT_DESCENDING = 1;
|
private static final int SORT_DESCENDING = 1;
|
||||||
|
|
||||||
public GuiTransmutationTablet(InventoryPlayer inventoryPlayer, TileEntityTransmutationTablet tileEntityTransmutationTablet)
|
public GuiTransmutationTablet(
|
||||||
{
|
InventoryPlayer inventoryPlayer,
|
||||||
super(new ContainerTransmutationTablet(inventoryPlayer, tileEntityTransmutationTablet), Textures.Gui.TRANSMUTATION_TABLET);
|
TileEntityTransmutationTablet tileEntityTransmutationTablet
|
||||||
|
) {
|
||||||
|
super(
|
||||||
|
new ContainerTransmutationTablet(
|
||||||
|
inventoryPlayer, tileEntityTransmutationTablet
|
||||||
|
),
|
||||||
|
Textures.Gui.TRANSMUTATION_TABLET
|
||||||
|
);
|
||||||
this.containerTablet = (ContainerTransmutationTablet) this.inventorySlots;
|
this.containerTablet = (ContainerTransmutationTablet) this.inventorySlots;
|
||||||
xSize = 256;
|
xSize = 256;
|
||||||
ySize = 256;
|
ySize = 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui()
|
public void initGui() {
|
||||||
{
|
|
||||||
super.initGui();
|
super.initGui();
|
||||||
|
|
||||||
this.drawTitle = false;
|
this.drawTitle = false;
|
||||||
|
@ -61,44 +66,62 @@ public class GuiTransmutationTablet extends GuiBase {
|
||||||
searchTextField.backgroundColor = new GuiColor(0, 0, 0, 0).getColor();
|
searchTextField.backgroundColor = new GuiColor(0, 0, 0, 0).getColor();
|
||||||
searchTextField.borderColor = new GuiColor(0, 0, 0, 0).getColor();
|
searchTextField.borderColor = new GuiColor(0, 0, 0, 0).getColor();
|
||||||
|
|
||||||
sortOptionButton = new ElementStatefulButton(this, 151, 36, "sortOption", 0, 0, 18, 0, 36, 0, 18, 18, 54, 18, Textures.Gui.Elements.BUTTON_SORT_OPTION)
|
sortOptionButton = new ElementStatefulButton(
|
||||||
{
|
this,
|
||||||
|
151,
|
||||||
|
36,
|
||||||
|
"sortOption",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
18,
|
||||||
|
0,
|
||||||
|
36,
|
||||||
|
0,
|
||||||
|
18,
|
||||||
|
18,
|
||||||
|
54,
|
||||||
|
18,
|
||||||
|
Textures.Gui.Elements.BUTTON_SORT_OPTION
|
||||||
|
) {
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int mouseX, int mouseY, float gameTicks)
|
public void drawBackground(int mouseX, int mouseY, float gameTicks) {
|
||||||
{
|
|
||||||
RenderHelper.bindTexture(texture);
|
RenderHelper.bindTexture(texture);
|
||||||
if (isEnabled())
|
if (isEnabled()) {
|
||||||
{
|
if (getState() == SORT_BY_DISPLAY_NAME) {
|
||||||
if (getState() == SORT_BY_DISPLAY_NAME)
|
|
||||||
{
|
|
||||||
drawTexturedModalRect(posX, posY, 36, 0, sizeX, sizeY);
|
drawTexturedModalRect(posX, posY, 36, 0, sizeX, sizeY);
|
||||||
}
|
} else if (getState() == SORT_BY_ENERGY_VALUE) {
|
||||||
else if (getState() == SORT_BY_ENERGY_VALUE)
|
|
||||||
{
|
|
||||||
drawTexturedModalRect(posX, posY, 0, 0, sizeX, sizeY);
|
drawTexturedModalRect(posX, posY, 0, 0, sizeX, sizeY);
|
||||||
}
|
} else if (getState() == SORT_BY_ID) {
|
||||||
else if (getState() == SORT_BY_ID)
|
|
||||||
{
|
|
||||||
drawTexturedModalRect(posX, posY, 18, 0, sizeX, sizeY);
|
drawTexturedModalRect(posX, posY, 18, 0, sizeX, sizeY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
sortOrderButton = new ElementStatefulButton(this, 151, 58, "sortOrder", 0, 0, 0, 0, 18, 0, 18, 18, 36, 18, Textures.Gui.Elements.BUTTON_SORT_ORDER)
|
sortOrderButton = new ElementStatefulButton(
|
||||||
{
|
this,
|
||||||
|
151,
|
||||||
|
58,
|
||||||
|
"sortOrder",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
18,
|
||||||
|
0,
|
||||||
|
18,
|
||||||
|
18,
|
||||||
|
36,
|
||||||
|
18,
|
||||||
|
Textures.Gui.Elements.BUTTON_SORT_ORDER
|
||||||
|
) {
|
||||||
@Override
|
@Override
|
||||||
public void drawBackground(int mouseX, int mouseY, float gameTicks)
|
public void drawBackground(int mouseX, int mouseY, float gameTicks) {
|
||||||
{
|
|
||||||
RenderHelper.bindTexture(texture);
|
RenderHelper.bindTexture(texture);
|
||||||
if (isEnabled())
|
if (isEnabled()) {
|
||||||
{
|
if (getState() == SORT_ASCENDING) {
|
||||||
if (getState() == SORT_ASCENDING)
|
|
||||||
{
|
|
||||||
drawTexturedModalRect(posX, posY, 0, 0, sizeX, sizeY);
|
drawTexturedModalRect(posX, posY, 0, 0, sizeX, sizeY);
|
||||||
}
|
} else if (getState() == SORT_DESCENDING) {
|
||||||
else if (getState() == SORT_DESCENDING)
|
|
||||||
{
|
|
||||||
drawTexturedModalRect(posX, posY, 18, 0, sizeX, sizeY);
|
drawTexturedModalRect(posX, posY, 18, 0, sizeX, sizeY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,37 +129,31 @@ public class GuiTransmutationTablet extends GuiBase {
|
||||||
};
|
};
|
||||||
setTooltipByState();
|
setTooltipByState();
|
||||||
|
|
||||||
slider = new ElementSlider(this, "scrollBar", 239, 36, 12, 201, 187, 0)
|
slider = new ElementSlider(this, "scrollBar", 239, 36, 12, 201, 187, 0) {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
protected void dragSlider(int x, int y)
|
protected void dragSlider(int x, int y) {
|
||||||
{
|
if (y > _value) {
|
||||||
if (y > _value)
|
|
||||||
{
|
|
||||||
setValue(_value + 1);
|
setValue(_value + 1);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
setValue(_value - 1);
|
setValue(_value - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onMouseWheel(int mouseX, int mouseY, int movement)
|
public boolean onMouseWheel(int mouseX, int mouseY, int movement) {
|
||||||
{
|
PacketHandler.INSTANCE.sendToServer(new MessageSliderElementUpdated(this)
|
||||||
PacketHandler.INSTANCE.sendToServer(new MessageSliderElementUpdated(this));
|
);
|
||||||
return super.onMouseWheel(mouseX, mouseY, movement);
|
return super.onMouseWheel(mouseX, mouseY, movement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStopDragging()
|
public void onStopDragging() {
|
||||||
{
|
PacketHandler.INSTANCE.sendToServer(new MessageSliderElementUpdated(this)
|
||||||
PacketHandler.INSTANCE.sendToServer(new MessageSliderElementUpdated(this));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSliderY()
|
public int getSliderY() {
|
||||||
{
|
|
||||||
return _value;
|
return _value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -151,76 +168,67 @@ public class GuiTransmutationTablet extends GuiBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawGuiContainerForegroundLayer(int x, int y)
|
protected void drawGuiContainerForegroundLayer(int x, int y) {
|
||||||
{
|
|
||||||
super.drawGuiContainerForegroundLayer(x, y);
|
super.drawGuiContainerForegroundLayer(x, y);
|
||||||
fontRendererObj.drawString(String.format("%s:", StatCollector.translateToLocal(Messages.ENERGY_VALUE)), 10, 142, Integer.parseInt(Colors.PURE_WHITE, 16));
|
fontRendererObj.drawString(
|
||||||
fontRendererObj.drawString(String.format("%s", containerTablet.getEnergyValue()), 10, 152, Integer.parseInt(Colors.PURE_WHITE, 16));
|
String.format("%s:", StatCollector.translateToLocal(Messages.ENERGY_VALUE)),
|
||||||
|
10,
|
||||||
|
142,
|
||||||
|
Integer.parseInt(Colors.PURE_WHITE, 16)
|
||||||
|
);
|
||||||
|
fontRendererObj.drawString(
|
||||||
|
String.format("%s", containerTablet.getEnergyValue()),
|
||||||
|
10,
|
||||||
|
152,
|
||||||
|
Integer.parseInt(Colors.PURE_WHITE, 16)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateScreen()
|
public void updateScreen() {
|
||||||
{
|
|
||||||
super.updateScreen();
|
super.updateScreen();
|
||||||
tickCount++;
|
tickCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean checkHotbarKeys(int key)
|
protected boolean checkHotbarKeys(int key) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleElementButtonClick(String buttonName, int mouseButton)
|
public void handleElementButtonClick(String buttonName, int mouseButton) {
|
||||||
{
|
if (buttonName.equals("sortOption")) {
|
||||||
if (buttonName.equals("sortOption"))
|
PacketHandler.INSTANCE.sendToServer(
|
||||||
{
|
new MessageGuiElementClicked(buttonName, mouseButton)
|
||||||
PacketHandler.INSTANCE.sendToServer(new MessageGuiElementClicked(buttonName, mouseButton));
|
);
|
||||||
|
|
||||||
if (mouseButton == LEFT_MOUSE_BUTTON)
|
if (mouseButton == LEFT_MOUSE_BUTTON) {
|
||||||
{
|
if (sortOptionButton.getState() == SORT_BY_DISPLAY_NAME) {
|
||||||
if (sortOptionButton.getState() == SORT_BY_DISPLAY_NAME)
|
|
||||||
{
|
|
||||||
sortOptionButton.setState(SORT_BY_ENERGY_VALUE);
|
sortOptionButton.setState(SORT_BY_ENERGY_VALUE);
|
||||||
}
|
} else if (sortOptionButton.getState() == SORT_BY_ENERGY_VALUE) {
|
||||||
else if (sortOptionButton.getState() == SORT_BY_ENERGY_VALUE)
|
|
||||||
{
|
|
||||||
sortOptionButton.setState(SORT_BY_ID);
|
sortOptionButton.setState(SORT_BY_ID);
|
||||||
}
|
} else if (sortOptionButton.getState() == SORT_BY_ID) {
|
||||||
else if (sortOptionButton.getState() == SORT_BY_ID)
|
|
||||||
{
|
|
||||||
sortOptionButton.setState(SORT_BY_DISPLAY_NAME);
|
sortOptionButton.setState(SORT_BY_DISPLAY_NAME);
|
||||||
}
|
}
|
||||||
}
|
} else if (mouseButton == RIGHT_MOUSE_BUTTON) {
|
||||||
else if (mouseButton == RIGHT_MOUSE_BUTTON)
|
if (sortOptionButton.getState() == SORT_BY_DISPLAY_NAME) {
|
||||||
{
|
|
||||||
if (sortOptionButton.getState() == SORT_BY_DISPLAY_NAME)
|
|
||||||
{
|
|
||||||
sortOptionButton.setState(SORT_BY_ID);
|
sortOptionButton.setState(SORT_BY_ID);
|
||||||
}
|
} else if (sortOptionButton.getState() == SORT_BY_ENERGY_VALUE) {
|
||||||
else if (sortOptionButton.getState() == SORT_BY_ENERGY_VALUE)
|
|
||||||
{
|
|
||||||
sortOptionButton.setState(SORT_BY_DISPLAY_NAME);
|
sortOptionButton.setState(SORT_BY_DISPLAY_NAME);
|
||||||
}
|
} else if (sortOptionButton.getState() == SORT_BY_ID) {
|
||||||
else if (sortOptionButton.getState() == SORT_BY_ID)
|
|
||||||
{
|
|
||||||
sortOptionButton.setState(SORT_BY_ENERGY_VALUE);
|
sortOptionButton.setState(SORT_BY_ENERGY_VALUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setTooltipByState();
|
setTooltipByState();
|
||||||
}
|
} else if (buttonName.equals("sortOrder")) {
|
||||||
else if (buttonName.equals("sortOrder"))
|
PacketHandler.INSTANCE.sendToServer(
|
||||||
{
|
new MessageGuiElementClicked(buttonName, mouseButton)
|
||||||
PacketHandler.INSTANCE.sendToServer(new MessageGuiElementClicked(buttonName, mouseButton));
|
);
|
||||||
|
|
||||||
if (sortOrderButton.getState() == SORT_ASCENDING)
|
if (sortOrderButton.getState() == SORT_ASCENDING) {
|
||||||
{
|
|
||||||
sortOrderButton.setState(SORT_DESCENDING);
|
sortOrderButton.setState(SORT_DESCENDING);
|
||||||
}
|
} else if (sortOrderButton.getState() == SORT_DESCENDING) {
|
||||||
else if (sortOrderButton.getState() == SORT_DESCENDING)
|
|
||||||
{
|
|
||||||
sortOrderButton.setState(SORT_ASCENDING);
|
sortOrderButton.setState(SORT_ASCENDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,29 +236,20 @@ public class GuiTransmutationTablet extends GuiBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTooltipByState()
|
private void setTooltipByState() {
|
||||||
{
|
|
||||||
sortOptionButton.clearToolTip();
|
sortOptionButton.clearToolTip();
|
||||||
if (sortOptionButton.getState() == SORT_BY_DISPLAY_NAME)
|
if (sortOptionButton.getState() == SORT_BY_DISPLAY_NAME) {
|
||||||
{
|
|
||||||
sortOptionButton.setToolTip(Messages.Tooltips.SORT_BY_DISPLAY_NAME);
|
sortOptionButton.setToolTip(Messages.Tooltips.SORT_BY_DISPLAY_NAME);
|
||||||
}
|
} else if (sortOptionButton.getState() == SORT_BY_ENERGY_VALUE) {
|
||||||
else if (sortOptionButton.getState() == SORT_BY_ENERGY_VALUE)
|
|
||||||
{
|
|
||||||
sortOptionButton.setToolTip(Messages.Tooltips.SORT_BY_ENERGY_VALUE);
|
sortOptionButton.setToolTip(Messages.Tooltips.SORT_BY_ENERGY_VALUE);
|
||||||
}
|
} else if (sortOptionButton.getState() == SORT_BY_ID) {
|
||||||
else if (sortOptionButton.getState() == SORT_BY_ID)
|
|
||||||
{
|
|
||||||
sortOptionButton.setToolTip(Messages.Tooltips.SORT_BY_ID);
|
sortOptionButton.setToolTip(Messages.Tooltips.SORT_BY_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
sortOrderButton.clearToolTip();
|
sortOrderButton.clearToolTip();
|
||||||
if (sortOrderButton.getState() == SORT_ASCENDING)
|
if (sortOrderButton.getState() == SORT_ASCENDING) {
|
||||||
{
|
|
||||||
sortOrderButton.setToolTip(Messages.Tooltips.SORT_ASCENDING);
|
sortOrderButton.setToolTip(Messages.Tooltips.SORT_ASCENDING);
|
||||||
}
|
} else if (sortOrderButton.getState() == SORT_DESCENDING) {
|
||||||
else if (sortOrderButton.getState() == SORT_DESCENDING)
|
|
||||||
{
|
|
||||||
sortOrderButton.setToolTip(Messages.Tooltips.SORT_DESCENDING);
|
sortOrderButton.setToolTip(Messages.Tooltips.SORT_DESCENDING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import com.pahimar.ee3.tileentity.TileEntityDummyArray;
|
||||||
import com.pahimar.ee3.tileentity.TileEntityEE;
|
import com.pahimar.ee3.tileentity.TileEntityEE;
|
||||||
import com.pahimar.ee3.util.IModalTool;
|
import com.pahimar.ee3.util.IModalTool;
|
||||||
import com.pahimar.ee3.util.TransmutationHelper;
|
import com.pahimar.ee3.util.TransmutationHelper;
|
||||||
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
@ -34,25 +33,29 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class DrawBlockHighlightEventHandler
|
public class DrawBlockHighlightEventHandler {
|
||||||
{
|
|
||||||
private static int pulse;
|
private static int pulse;
|
||||||
private static boolean doInc;
|
private static boolean doInc;
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onDrawBlockHighlightEvent(DrawBlockHighlightEvent event)
|
public void onDrawBlockHighlightEvent(DrawBlockHighlightEvent event) {
|
||||||
{
|
if (event.currentItem != null) {
|
||||||
if (event.currentItem != null)
|
if (event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||||
{
|
if (event.currentItem.getItem() instanceof ItemChalk) {
|
||||||
if (event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
|
||||||
{
|
|
||||||
if (event.currentItem.getItem() instanceof ItemChalk)
|
|
||||||
{
|
|
||||||
// if should draw
|
// if should draw
|
||||||
drawAlchemyArrayOverlay(event);
|
drawAlchemyArrayOverlay(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.currentItem != null && event.currentItem.getItem() instanceof ITransmutationStone && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
if (event.currentItem != null
|
||||||
TransmutationHelper.updateTargetBlock(event.player.worldObj, event.target.blockX, event.target.blockY, event.target.blockZ);
|
&& event.currentItem.getItem() instanceof ITransmutationStone
|
||||||
|
&& event.target.typeOfHit
|
||||||
|
== MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||||
|
TransmutationHelper.updateTargetBlock(
|
||||||
|
event.player.worldObj,
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ
|
||||||
|
);
|
||||||
if (Minecraft.isGuiEnabled() && Minecraft.getMinecraft().inGameHasFocus) {
|
if (Minecraft.isGuiEnabled() && Minecraft.getMinecraft().inGameHasFocus) {
|
||||||
this.drawInWorldTransmutationOverlay(event);
|
this.drawInWorldTransmutationOverlay(event);
|
||||||
}
|
}
|
||||||
|
@ -60,152 +63,399 @@ public class DrawBlockHighlightEventHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawSelectionBoxForShovel(DrawBlockHighlightEvent event, IModalTool modalTool)
|
private void
|
||||||
{
|
drawSelectionBoxForShovel(DrawBlockHighlightEvent event, IModalTool modalTool) {
|
||||||
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
|
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
|
||||||
int facing = MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
int facing
|
||||||
|
= MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D)
|
||||||
|
& 3;
|
||||||
|
|
||||||
if (toolMode != ToolMode.UNKNOWN)
|
if (toolMode != ToolMode.UNKNOWN) {
|
||||||
{
|
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
if (toolMode == ToolMode.STANDARD)
|
if (toolMode == ToolMode.STANDARD) {
|
||||||
{
|
drawSelectionBox(
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawSelectionBoxForPickAxe(DrawBlockHighlightEvent event, IModalTool modalTool)
|
private void
|
||||||
{
|
drawSelectionBoxForPickAxe(DrawBlockHighlightEvent event, IModalTool modalTool) {
|
||||||
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
|
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
|
||||||
int facing = MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
int facing
|
||||||
|
= MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D)
|
||||||
|
& 3;
|
||||||
|
|
||||||
if (toolMode != ToolMode.UNKNOWN)
|
if (toolMode != ToolMode.UNKNOWN) {
|
||||||
{
|
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
if (toolMode == ToolMode.STANDARD)
|
if (toolMode == ToolMode.STANDARD) {
|
||||||
{
|
drawSelectionBox(
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.context,
|
||||||
}
|
event.player,
|
||||||
else if (toolMode == ToolMode.WIDE)
|
new MovingObjectPosition(
|
||||||
{
|
event.target.blockX,
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
|
} else if (toolMode == ToolMode.WIDE) {
|
||||||
|
drawSelectionBox(
|
||||||
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
|
|
||||||
if (event.target.sideHit == ForgeDirection.NORTH.ordinal() || event.target.sideHit == ForgeDirection.SOUTH.ordinal())
|
if (event.target.sideHit == ForgeDirection.NORTH.ordinal()
|
||||||
{
|
|| event.target.sideHit == ForgeDirection.SOUTH.ordinal()) {
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX - 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
drawSelectionBox(
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX + 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX - 1,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
|
drawSelectionBox(
|
||||||
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX + 1,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else if (event.target.sideHit == ForgeDirection.EAST.ordinal() || event.target.sideHit == ForgeDirection.WEST.ordinal())
|
else if (event.target.sideHit == ForgeDirection.EAST.ordinal() || event.target.sideHit == ForgeDirection.WEST.ordinal())
|
||||||
{
|
{
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ - 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
drawSelectionBox(
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ + 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.context,
|
||||||
}
|
event.player,
|
||||||
else
|
new MovingObjectPosition(
|
||||||
{
|
event.target.blockX,
|
||||||
if (facing == 0 || facing == 2)
|
event.target.blockY,
|
||||||
{
|
event.target.blockZ - 1,
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX - 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.target.sideHit,
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX + 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.target.hitVec
|
||||||
}
|
),
|
||||||
else
|
0,
|
||||||
{
|
event.partialTicks
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ - 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
);
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ + 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
drawSelectionBox(
|
||||||
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ + 1,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (facing == 0 || facing == 2) {
|
||||||
|
drawSelectionBox(
|
||||||
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX - 1,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
|
drawSelectionBox(
|
||||||
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX + 1,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
drawSelectionBox(
|
||||||
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ - 1,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
|
drawSelectionBox(
|
||||||
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ + 1,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (toolMode == ToolMode.TALL) {
|
||||||
else if (toolMode == ToolMode.TALL)
|
drawSelectionBox(
|
||||||
{
|
event.context,
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
|
|
||||||
if (event.target.sideHit == ForgeDirection.NORTH.ordinal() || event.target.sideHit == ForgeDirection.SOUTH.ordinal() || event.target.sideHit == ForgeDirection.EAST.ordinal() || event.target.sideHit == ForgeDirection.WEST.ordinal())
|
if (event.target.sideHit == ForgeDirection.NORTH.ordinal()
|
||||||
{
|
|| event.target.sideHit == ForgeDirection.SOUTH.ordinal()
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY - 1, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
|| event.target.sideHit == ForgeDirection.EAST.ordinal()
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY + 1, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
|| event.target.sideHit == ForgeDirection.WEST.ordinal()) {
|
||||||
}
|
drawSelectionBox(
|
||||||
else
|
event.context,
|
||||||
{
|
event.player,
|
||||||
if (facing == 1 || facing == 3)
|
new MovingObjectPosition(
|
||||||
{
|
event.target.blockX,
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX - 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.target.blockY - 1,
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX + 1, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.target.blockZ,
|
||||||
}
|
event.target.sideHit,
|
||||||
else
|
event.target.hitVec
|
||||||
{
|
),
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ - 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
0,
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ + 1, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.partialTicks
|
||||||
|
);
|
||||||
|
drawSelectionBox(
|
||||||
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY + 1,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (facing == 1 || facing == 3) {
|
||||||
|
drawSelectionBox(
|
||||||
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX - 1,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
|
drawSelectionBox(
|
||||||
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX + 1,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
drawSelectionBox(
|
||||||
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ - 1,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
|
drawSelectionBox(
|
||||||
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ + 1,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawSelectionBoxForHammer(DrawBlockHighlightEvent event, IModalTool modalTool)
|
private void
|
||||||
{
|
drawSelectionBoxForHammer(DrawBlockHighlightEvent event, IModalTool modalTool) {
|
||||||
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
|
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
|
||||||
int facing = MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
int facing
|
||||||
|
= MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D)
|
||||||
|
& 3;
|
||||||
|
|
||||||
if (toolMode != ToolMode.UNKNOWN)
|
if (toolMode != ToolMode.UNKNOWN) {
|
||||||
{
|
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
if (toolMode == ToolMode.STANDARD)
|
if (toolMode == ToolMode.STANDARD) {
|
||||||
{
|
drawSelectionBox(
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawSelectionBoxForAxe(DrawBlockHighlightEvent event, IModalTool modalTool)
|
private void
|
||||||
{
|
drawSelectionBoxForAxe(DrawBlockHighlightEvent event, IModalTool modalTool) {
|
||||||
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
|
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
|
||||||
int facing = MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
int facing
|
||||||
|
= MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D)
|
||||||
|
& 3;
|
||||||
|
|
||||||
if (toolMode != ToolMode.UNKNOWN)
|
if (toolMode != ToolMode.UNKNOWN) {
|
||||||
{
|
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
if (toolMode == ToolMode.STANDARD)
|
if (toolMode == ToolMode.STANDARD) {
|
||||||
{
|
drawSelectionBox(
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawSelectionBoxForHoe(DrawBlockHighlightEvent event, IModalTool modalTool)
|
private void
|
||||||
{
|
drawSelectionBoxForHoe(DrawBlockHighlightEvent event, IModalTool modalTool) {
|
||||||
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
|
ToolMode toolMode = modalTool.getCurrentToolMode(event.currentItem);
|
||||||
int facing = MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
int facing
|
||||||
|
= MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D)
|
||||||
|
& 3;
|
||||||
|
|
||||||
if (toolMode != ToolMode.UNKNOWN)
|
if (toolMode != ToolMode.UNKNOWN) {
|
||||||
{
|
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
if (toolMode == ToolMode.STANDARD)
|
if (toolMode == ToolMode.STANDARD) {
|
||||||
{
|
drawSelectionBox(
|
||||||
drawSelectionBox(event.context, event.player, new MovingObjectPosition(event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit, event.target.hitVec), 0, event.partialTicks);
|
event.context,
|
||||||
|
event.player,
|
||||||
|
new MovingObjectPosition(
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit,
|
||||||
|
event.target.hitVec
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
event.partialTicks
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawAlchemyArrayOverlay(DrawBlockHighlightEvent event)
|
private void drawAlchemyArrayOverlay(DrawBlockHighlightEvent event) {
|
||||||
{
|
ChalkSettings chalkSettings
|
||||||
ChalkSettings chalkSettings = EquivalentExchange3.proxy.getClientProxy().chalkSettings;
|
= EquivalentExchange3.proxy.getClientProxy().chalkSettings;
|
||||||
AlchemyArray alchemyArray = AlchemyArrayRegistry.getInstance().getAlchemyArray(chalkSettings.getIndex());
|
AlchemyArray alchemyArray
|
||||||
|
= AlchemyArrayRegistry.getInstance().getAlchemyArray(chalkSettings.getIndex()
|
||||||
|
);
|
||||||
ResourceLocation texture = alchemyArray.getTexture();
|
ResourceLocation texture = alchemyArray.getTexture();
|
||||||
int rotation = chalkSettings.getRotation();
|
int rotation = chalkSettings.getRotation();
|
||||||
|
|
||||||
double x = event.target.blockX + 0.5F;
|
double x = event.target.blockX + 0.5F;
|
||||||
double y = event.target.blockY + 0.5F;
|
double y = event.target.blockY + 0.5F;
|
||||||
double z = event.target.blockZ + 0.5F;
|
double z = event.target.blockZ + 0.5F;
|
||||||
double iPX = event.player.prevPosX + (event.player.posX - event.player.prevPosX) * event.partialTicks;
|
double iPX = event.player.prevPosX
|
||||||
double iPY = event.player.prevPosY + (event.player.posY - event.player.prevPosY) * event.partialTicks;
|
+ (event.player.posX - event.player.prevPosX) * event.partialTicks;
|
||||||
double iPZ = event.player.prevPosZ + (event.player.posZ - event.player.prevPosZ) * event.partialTicks;
|
double iPY = event.player.prevPosY
|
||||||
|
+ (event.player.posY - event.player.prevPosY) * event.partialTicks;
|
||||||
|
double iPZ = event.player.prevPosZ
|
||||||
|
+ (event.player.posZ - event.player.prevPosZ) * event.partialTicks;
|
||||||
|
|
||||||
float xScale, yScale, zScale;
|
float xScale, yScale, zScale;
|
||||||
float xShift, yShift, zShift;
|
float xShift, yShift, zShift;
|
||||||
float xRotate, yRotate, zRotate;
|
float xRotate, yRotate, zRotate;
|
||||||
int zCorrection = 1;
|
int zCorrection = 1;
|
||||||
int rotationAngle = 0;
|
int rotationAngle = 0;
|
||||||
int playerFacing = MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
int playerFacing
|
||||||
|
= MathHelper.floor_double(event.player.rotationYaw * 4.0F / 360.0F + 0.5D)
|
||||||
|
& 3;
|
||||||
int facingCorrectionAngle = 0;
|
int facingCorrectionAngle = 0;
|
||||||
|
|
||||||
xScale = yScale = zScale = 1;
|
xScale = yScale = zScale = 1;
|
||||||
|
@ -215,104 +465,96 @@ public class DrawBlockHighlightEventHandler
|
||||||
int chargeLevel = ((chalkSettings.getSize() - 1) * 2) + 1;
|
int chargeLevel = ((chalkSettings.getSize() - 1) * 2) + 1;
|
||||||
|
|
||||||
ForgeDirection sideHit = ForgeDirection.getOrientation(event.target.sideHit);
|
ForgeDirection sideHit = ForgeDirection.getOrientation(event.target.sideHit);
|
||||||
TileEntity tileEntity = event.player.worldObj.getTileEntity(event.target.blockX, event.target.blockY, event.target.blockZ);
|
TileEntity tileEntity = event.player.worldObj.getTileEntity(
|
||||||
|
event.target.blockX, event.target.blockY, event.target.blockZ
|
||||||
|
);
|
||||||
boolean shouldRender = true;
|
boolean shouldRender = true;
|
||||||
|
|
||||||
if (tileEntity instanceof TileEntityEE)
|
if (tileEntity instanceof TileEntityEE) {
|
||||||
{
|
if (((TileEntityEE) tileEntity).getOrientation() != sideHit) {
|
||||||
if (((TileEntityEE) tileEntity).getOrientation() != sideHit)
|
|
||||||
{
|
|
||||||
shouldRender = false;
|
shouldRender = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!canPlaceAlchemyArray(event.currentItem, event.player.worldObj, event.target.blockX, event.target.blockY, event.target.blockZ, event.target.sideHit))
|
if (!canPlaceAlchemyArray(
|
||||||
{
|
event.currentItem,
|
||||||
|
event.player.worldObj,
|
||||||
|
event.target.blockX,
|
||||||
|
event.target.blockY,
|
||||||
|
event.target.blockZ,
|
||||||
|
event.target.sideHit
|
||||||
|
)) {
|
||||||
shouldRender = false;
|
shouldRender = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldRender)
|
if (shouldRender) {
|
||||||
{
|
switch (sideHit) {
|
||||||
switch (sideHit)
|
case UP: {
|
||||||
{
|
|
||||||
case UP:
|
|
||||||
{
|
|
||||||
xScale = zScale = chargeLevel;
|
xScale = zScale = chargeLevel;
|
||||||
yShift = 0.001f;
|
yShift = 0.001f;
|
||||||
xRotate = -1;
|
xRotate = -1;
|
||||||
rotationAngle = (-90 * (rotation + 2)) % 360;
|
rotationAngle = (-90 * (rotation + 2)) % 360;
|
||||||
facingCorrectionAngle = (-90 * (playerFacing + 2)) % 360;
|
facingCorrectionAngle = (-90 * (playerFacing + 2)) % 360;
|
||||||
if (tileEntity instanceof TileEntityAlchemyArray)
|
if (tileEntity instanceof TileEntityAlchemyArray) {
|
||||||
{
|
|
||||||
y -= 1;
|
y -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tileEntity instanceof TileEntityDummyArray)
|
if (tileEntity instanceof TileEntityDummyArray) {
|
||||||
{
|
|
||||||
x = ((TileEntityDummyArray) tileEntity).getTrueXCoord() + 0.5f;
|
x = ((TileEntityDummyArray) tileEntity).getTrueXCoord() + 0.5f;
|
||||||
y = ((TileEntityDummyArray) tileEntity).getTrueYCoord() + 0.5f - 1;
|
y = ((TileEntityDummyArray) tileEntity).getTrueYCoord() + 0.5f
|
||||||
|
- 1;
|
||||||
z = ((TileEntityDummyArray) tileEntity).getTrueXCoord() + 0.5f;
|
z = ((TileEntityDummyArray) tileEntity).getTrueXCoord() + 0.5f;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DOWN:
|
case DOWN: {
|
||||||
{
|
|
||||||
xScale = zScale = chargeLevel;
|
xScale = zScale = chargeLevel;
|
||||||
yShift = -0.001f;
|
yShift = -0.001f;
|
||||||
xRotate = 1;
|
xRotate = 1;
|
||||||
rotationAngle = (-90 * (rotation + 2)) % 360;
|
rotationAngle = (-90 * (rotation + 2)) % 360;
|
||||||
facingCorrectionAngle = (-90 * (playerFacing + 2)) % 360;
|
facingCorrectionAngle = (-90 * (playerFacing + 2)) % 360;
|
||||||
if (tileEntity instanceof TileEntityAlchemyArray)
|
if (tileEntity instanceof TileEntityAlchemyArray) {
|
||||||
{
|
|
||||||
y += 1;
|
y += 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NORTH:
|
case NORTH: {
|
||||||
{
|
|
||||||
xScale = yScale = chargeLevel;
|
xScale = yScale = chargeLevel;
|
||||||
zCorrection = -1;
|
zCorrection = -1;
|
||||||
zShift = -0.001f;
|
zShift = -0.001f;
|
||||||
zRotate = 1;
|
zRotate = 1;
|
||||||
rotationAngle = (-90 * (rotation + 1)) % 360;
|
rotationAngle = (-90 * (rotation + 1)) % 360;
|
||||||
if (tileEntity instanceof TileEntityAlchemyArray)
|
if (tileEntity instanceof TileEntityAlchemyArray) {
|
||||||
{
|
|
||||||
z += 1;
|
z += 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SOUTH:
|
case SOUTH: {
|
||||||
{
|
|
||||||
xScale = yScale = chargeLevel;
|
xScale = yScale = chargeLevel;
|
||||||
zShift = 0.001f;
|
zShift = 0.001f;
|
||||||
zRotate = -1;
|
zRotate = -1;
|
||||||
rotationAngle = (-90 * (rotation + 1)) % 360;
|
rotationAngle = (-90 * (rotation + 1)) % 360;
|
||||||
if (tileEntity instanceof TileEntityAlchemyArray)
|
if (tileEntity instanceof TileEntityAlchemyArray) {
|
||||||
{
|
|
||||||
z -= 1;
|
z -= 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EAST:
|
case EAST: {
|
||||||
{
|
|
||||||
yScale = zScale = chargeLevel;
|
yScale = zScale = chargeLevel;
|
||||||
xShift = 0.001f;
|
xShift = 0.001f;
|
||||||
yRotate = 1;
|
yRotate = 1;
|
||||||
rotationAngle = (-90 * (rotation + 2)) % 360;
|
rotationAngle = (-90 * (rotation + 2)) % 360;
|
||||||
if (tileEntity instanceof TileEntityAlchemyArray)
|
if (tileEntity instanceof TileEntityAlchemyArray) {
|
||||||
{
|
|
||||||
x -= 1;
|
x -= 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WEST:
|
case WEST: {
|
||||||
{
|
|
||||||
yScale = zScale = chargeLevel;
|
yScale = zScale = chargeLevel;
|
||||||
xShift = -0.001f;
|
xShift = -0.001f;
|
||||||
yRotate = -1;
|
yRotate = -1;
|
||||||
rotationAngle = (-90 * (rotation + 2)) % 360;
|
rotationAngle = (-90 * (rotation + 2)) % 360;
|
||||||
if (tileEntity instanceof TileEntityAlchemyArray)
|
if (tileEntity instanceof TileEntityAlchemyArray) {
|
||||||
{
|
|
||||||
x += 1;
|
x += 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -321,15 +563,23 @@ public class DrawBlockHighlightEventHandler
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldRender)
|
if (shouldRender) {
|
||||||
{
|
|
||||||
GL11.glDepthMask(false);
|
GL11.glDepthMask(false);
|
||||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
|
GL11.glTranslated(
|
||||||
|
-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift
|
||||||
|
);
|
||||||
GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale);
|
GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale);
|
||||||
GL11.glRotatef(rotationAngle, sideHit.offsetX, sideHit.offsetY, sideHit.offsetZ);
|
GL11.glRotatef(
|
||||||
GL11.glRotatef(facingCorrectionAngle, sideHit.offsetX, sideHit.offsetY, sideHit.offsetZ);
|
rotationAngle, sideHit.offsetX, sideHit.offsetY, sideHit.offsetZ
|
||||||
|
);
|
||||||
|
GL11.glRotatef(
|
||||||
|
facingCorrectionAngle,
|
||||||
|
sideHit.offsetX,
|
||||||
|
sideHit.offsetY,
|
||||||
|
sideHit.offsetZ
|
||||||
|
);
|
||||||
GL11.glRotatef(90, xRotate, yRotate, zRotate);
|
GL11.glRotatef(90, xRotate, yRotate, zRotate);
|
||||||
GL11.glTranslated(0, 0, 0.5f * zCorrection);
|
GL11.glTranslated(0, 0, 0.5f * zCorrection);
|
||||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||||
|
@ -341,19 +591,23 @@ public class DrawBlockHighlightEventHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canPlaceAlchemyArray(ItemStack itemStack, World world, int x, int y, int z, int side)
|
private boolean canPlaceAlchemyArray(
|
||||||
{
|
ItemStack itemStack, World world, int x, int y, int z, int side
|
||||||
ChalkSettings chalkSettings = EquivalentExchange3.proxy.getClientProxy().chalkSettings;
|
) {
|
||||||
|
ChalkSettings chalkSettings
|
||||||
|
= EquivalentExchange3.proxy.getClientProxy().chalkSettings;
|
||||||
|
|
||||||
int coordOffset = chalkSettings.getSize() - 1;
|
int coordOffset = chalkSettings.getSize() - 1;
|
||||||
ForgeDirection orientation = ForgeDirection.getOrientation(side);
|
ForgeDirection orientation = ForgeDirection.getOrientation(side);
|
||||||
AlchemyArray alchemyArray = AlchemyArrayRegistry.getInstance().getAlchemyArray(chalkSettings.getIndex());
|
AlchemyArray alchemyArray
|
||||||
|
= AlchemyArrayRegistry.getInstance().getAlchemyArray(chalkSettings.getIndex()
|
||||||
|
);
|
||||||
boolean canPlaceAlchemyArray = isValidForArray(world, x, y, z, side);
|
boolean canPlaceAlchemyArray = isValidForArray(world, x, y, z, side);
|
||||||
|
|
||||||
int chargeLevel = ((chalkSettings.getSize() - 1) * 2) + 1;
|
int chargeLevel = ((chalkSettings.getSize() - 1) * 2) + 1;
|
||||||
|
|
||||||
if (itemStack.getItemDamage() == itemStack.getMaxDamage() && (chargeLevel * chargeLevel) * alchemyArray.getChalkCostPerBlock() == 1)
|
if (itemStack.getItemDamage() == itemStack.getMaxDamage()
|
||||||
{
|
&& (chargeLevel * chargeLevel) * alchemyArray.getChalkCostPerBlock() == 1) {
|
||||||
canPlaceAlchemyArray = true;
|
canPlaceAlchemyArray = true;
|
||||||
}
|
}
|
||||||
else if (itemStack.getMaxDamage() - itemStack.getItemDamage() + 1 < (chargeLevel * chargeLevel) * alchemyArray.getChalkCostPerBlock())
|
else if (itemStack.getMaxDamage() - itemStack.getItemDamage() + 1 < (chargeLevel * chargeLevel) * alchemyArray.getChalkCostPerBlock())
|
||||||
|
@ -361,16 +615,12 @@ public class DrawBlockHighlightEventHandler
|
||||||
canPlaceAlchemyArray = false;
|
canPlaceAlchemyArray = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (canPlaceAlchemyArray)
|
if (canPlaceAlchemyArray) {
|
||||||
{
|
if (orientation == ForgeDirection.UP || orientation == ForgeDirection.DOWN) {
|
||||||
if (orientation == ForgeDirection.UP || orientation == ForgeDirection.DOWN)
|
for (int i = x - coordOffset; i <= x + coordOffset; i++) {
|
||||||
{
|
for (int j = z - coordOffset; j <= z + coordOffset; j++) {
|
||||||
for (int i = x - coordOffset; i <= x + coordOffset; i++)
|
if ((i != x || j != z)
|
||||||
{
|
&& (!isValidForArray(world, i, y, j, side))) {
|
||||||
for (int j = z - coordOffset; j <= z + coordOffset; j++)
|
|
||||||
{
|
|
||||||
if ((i != x || j != z) && (!isValidForArray(world, i, y, j, side)))
|
|
||||||
{
|
|
||||||
canPlaceAlchemyArray = false;
|
canPlaceAlchemyArray = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -378,25 +628,19 @@ public class DrawBlockHighlightEventHandler
|
||||||
}
|
}
|
||||||
else if (orientation == ForgeDirection.NORTH || orientation == ForgeDirection.SOUTH)
|
else if (orientation == ForgeDirection.NORTH || orientation == ForgeDirection.SOUTH)
|
||||||
{
|
{
|
||||||
for (int i = x - coordOffset; i <= x + coordOffset; i++)
|
for (int i = x - coordOffset; i <= x + coordOffset; i++) {
|
||||||
{
|
for (int j = y - coordOffset; j <= y + coordOffset; j++) {
|
||||||
for (int j = y - coordOffset; j <= y + coordOffset; j++)
|
if ((i != x || j != y)
|
||||||
{
|
&& (!isValidForArray(world, i, j, z, side))) {
|
||||||
if ((i != x || j != y) && (!isValidForArray(world, i, j, z, side)))
|
|
||||||
{
|
|
||||||
canPlaceAlchemyArray = false;
|
canPlaceAlchemyArray = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (orientation == ForgeDirection.EAST || orientation == ForgeDirection.WEST) {
|
||||||
else if (orientation == ForgeDirection.EAST || orientation == ForgeDirection.WEST)
|
for (int i = y - coordOffset; i <= y + coordOffset; i++) {
|
||||||
{
|
for (int j = z - coordOffset; j <= z + coordOffset; j++) {
|
||||||
for (int i = y - coordOffset; i <= y + coordOffset; i++)
|
if ((i != y || j != z)
|
||||||
{
|
&& (!isValidForArray(world, x, i, j, side))) {
|
||||||
for (int j = z - coordOffset; j <= z + coordOffset; j++)
|
|
||||||
{
|
|
||||||
if ((i != y || j != z) && (!isValidForArray(world, x, i, j, side)))
|
|
||||||
{
|
|
||||||
canPlaceAlchemyArray = false;
|
canPlaceAlchemyArray = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,21 +651,31 @@ public class DrawBlockHighlightEventHandler
|
||||||
return canPlaceAlchemyArray;
|
return canPlaceAlchemyArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isValidForArray(World world, int x, int y, int z, int sideHit)
|
private boolean isValidForArray(World world, int x, int y, int z, int sideHit) {
|
||||||
{
|
|
||||||
ForgeDirection side = ForgeDirection.getOrientation(sideHit);
|
ForgeDirection side = ForgeDirection.getOrientation(sideHit);
|
||||||
return world.isSideSolid(x, y, z, side) && ((side == ForgeDirection.DOWN && world.getBlock(x, y - 1, z).isReplaceable(world, x, y, z)) ||
|
return world.isSideSolid(x, y, z, side)
|
||||||
(side == ForgeDirection.UP && world.getBlock(x, y + 1, z).isReplaceable(world, x, y, z)) ||
|
&& ((side == ForgeDirection.DOWN
|
||||||
(side == ForgeDirection.NORTH && world.getBlock(x, y, z - 1).isReplaceable(world, x, y, z)) ||
|
&& world.getBlock(x, y - 1, z).isReplaceable(world, x, y, z))
|
||||||
(side == ForgeDirection.SOUTH && world.getBlock(x, y, z + 1).isReplaceable(world, x, y, z)) ||
|
|| (side == ForgeDirection.UP
|
||||||
(side == ForgeDirection.WEST && world.getBlock(x - 1, y, z).isReplaceable(world, x, y, z)) ||
|
&& world.getBlock(x, y + 1, z).isReplaceable(world, x, y, z))
|
||||||
(side == ForgeDirection.EAST && world.getBlock(x + 1, y, z).isReplaceable(world, x, y, z)));
|
|| (side == ForgeDirection.NORTH
|
||||||
|
&& world.getBlock(x, y, z - 1).isReplaceable(world, x, y, z))
|
||||||
|
|| (side == ForgeDirection.SOUTH
|
||||||
|
&& world.getBlock(x, y, z + 1).isReplaceable(world, x, y, z))
|
||||||
|
|| (side == ForgeDirection.WEST
|
||||||
|
&& world.getBlock(x - 1, y, z).isReplaceable(world, x, y, z))
|
||||||
|
|| (side == ForgeDirection.EAST
|
||||||
|
&& world.getBlock(x + 1, y, z).isReplaceable(world, x, y, z)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawSelectionBox(RenderGlobal context, EntityPlayer entityPlayer, MovingObjectPosition rayTrace, int i, float partialTicks)
|
private void drawSelectionBox(
|
||||||
{
|
RenderGlobal context,
|
||||||
if (i == 0 && rayTrace.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
EntityPlayer entityPlayer,
|
||||||
{
|
MovingObjectPosition rayTrace,
|
||||||
|
int i,
|
||||||
|
float partialTicks
|
||||||
|
) {
|
||||||
|
if (i == 0 && rayTrace.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||||
GL11.glColor4f(1f, 1f, 1f, 0.5f);
|
GL11.glColor4f(1f, 1f, 1f, 0.5f);
|
||||||
|
@ -429,15 +683,38 @@ public class DrawBlockHighlightEventHandler
|
||||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
GL11.glDepthMask(false);
|
GL11.glDepthMask(false);
|
||||||
float f1 = 0.002F;
|
float f1 = 0.002F;
|
||||||
Block block = entityPlayer.worldObj.getBlock(rayTrace.blockX, rayTrace.blockY, rayTrace.blockZ);
|
Block block = entityPlayer.worldObj.getBlock(
|
||||||
|
rayTrace.blockX, rayTrace.blockY, rayTrace.blockZ
|
||||||
|
);
|
||||||
|
|
||||||
if (block.getMaterial() != Material.air)
|
if (block.getMaterial() != Material.air) {
|
||||||
{
|
block.setBlockBoundsBasedOnState(
|
||||||
block.setBlockBoundsBasedOnState(entityPlayer.worldObj, rayTrace.blockX, rayTrace.blockY, rayTrace.blockZ);
|
entityPlayer.worldObj,
|
||||||
double d0 = entityPlayer.lastTickPosX + (entityPlayer.posX - entityPlayer.lastTickPosX) * (double) partialTicks;
|
rayTrace.blockX,
|
||||||
double d1 = entityPlayer.lastTickPosY + (entityPlayer.posY - entityPlayer.lastTickPosY) * (double) partialTicks;
|
rayTrace.blockY,
|
||||||
double d2 = entityPlayer.lastTickPosZ + (entityPlayer.posZ - entityPlayer.lastTickPosZ) * (double) partialTicks;
|
rayTrace.blockZ
|
||||||
context.drawOutlinedBoundingBox(block.getSelectedBoundingBoxFromPool(entityPlayer.worldObj, rayTrace.blockX, rayTrace.blockY, rayTrace.blockZ).expand((double) f1, (double) f1, (double) f1).getOffsetBoundingBox(-d0, -d1, -d2), -1);
|
);
|
||||||
|
double d0 = entityPlayer.lastTickPosX
|
||||||
|
+ (entityPlayer.posX - entityPlayer.lastTickPosX)
|
||||||
|
* (double) partialTicks;
|
||||||
|
double d1 = entityPlayer.lastTickPosY
|
||||||
|
+ (entityPlayer.posY - entityPlayer.lastTickPosY)
|
||||||
|
* (double) partialTicks;
|
||||||
|
double d2 = entityPlayer.lastTickPosZ
|
||||||
|
+ (entityPlayer.posZ - entityPlayer.lastTickPosZ)
|
||||||
|
* (double) partialTicks;
|
||||||
|
context.drawOutlinedBoundingBox(
|
||||||
|
block
|
||||||
|
.getSelectedBoundingBoxFromPool(
|
||||||
|
entityPlayer.worldObj,
|
||||||
|
rayTrace.blockX,
|
||||||
|
rayTrace.blockY,
|
||||||
|
rayTrace.blockZ
|
||||||
|
)
|
||||||
|
.expand((double) f1, (double) f1, (double) f1)
|
||||||
|
.getOffsetBoundingBox(-d0, -d1, -d2),
|
||||||
|
-1
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glDepthMask(true);
|
GL11.glDepthMask(true);
|
||||||
|
@ -450,10 +727,14 @@ public class DrawBlockHighlightEventHandler
|
||||||
final double x = event.target.blockX + 0.5f;
|
final double x = event.target.blockX + 0.5f;
|
||||||
final double y = event.target.blockY + 0.5f;
|
final double y = event.target.blockY + 0.5f;
|
||||||
final double z = event.target.blockZ + 0.5f;
|
final double z = event.target.blockZ + 0.5f;
|
||||||
final double iPX = (event.player).prevPosX + ((event.player).posX - (event.player).prevPosX) * event.partialTicks;
|
final double iPX = (event.player).prevPosX
|
||||||
final double iPY = (event.player).prevPosY + ((event.player).posY - (event.player).prevPosY) * event.partialTicks;
|
+ ((event.player).posX - (event.player).prevPosX) * event.partialTicks;
|
||||||
final double iPZ = (event.player).prevPosZ + ((event.player).posZ - (event.player).prevPosZ) * event.partialTicks;
|
final double iPY = (event.player).prevPosY
|
||||||
//final int texture = event.context.renderEngine.func_78341_b("/mods/ee3/textures/effects/noise.png");
|
+ ((event.player).posY - (event.player).prevPosY) * event.partialTicks;
|
||||||
|
final double iPZ = (event.player).prevPosZ
|
||||||
|
+ ((event.player).posZ - (event.player).prevPosZ) * event.partialTicks;
|
||||||
|
//final int texture =
|
||||||
|
//event.context.renderEngine.func_78341_b("/mods/ee3/textures/effects/noise.png");
|
||||||
float xScale = 1.0f;
|
float xScale = 1.0f;
|
||||||
float yScale = 1.0f;
|
float yScale = 1.0f;
|
||||||
float zScale = 1.0f;
|
float zScale = 1.0f;
|
||||||
|
@ -462,7 +743,8 @@ public class DrawBlockHighlightEventHandler
|
||||||
float zShift = 0.1f;
|
float zShift = 0.1f;
|
||||||
int itemChargeLevel = 0;
|
int itemChargeLevel = 0;
|
||||||
final int chargeLevel = 1 + itemChargeLevel * 2;
|
final int chargeLevel = 1 + itemChargeLevel * 2;
|
||||||
final ForgeDirection sideHit = ForgeDirection.getOrientation(event.target.sideHit);
|
final ForgeDirection sideHit
|
||||||
|
= ForgeDirection.getOrientation(event.target.sideHit);
|
||||||
switch (sideHit) {
|
switch (sideHit) {
|
||||||
case UP: {
|
case UP: {
|
||||||
xScale = chargeLevel + 0.1f;
|
xScale = chargeLevel + 0.1f;
|
||||||
|
@ -518,17 +800,25 @@ public class DrawBlockHighlightEventHandler
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
|
GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
|
||||||
GL11.glScalef(1.0f * xScale, 1.0f * yScale, 1.0f * zScale);
|
GL11.glScalef(1.0f * xScale, 1.0f * yScale, 1.0f * zScale);
|
||||||
GL11.glRotatef(90.0f, (float)forgeDir.offsetX, (float)forgeDir.offsetY, (float)forgeDir.offsetZ);
|
GL11.glRotatef(
|
||||||
GL11.glTranslated(0.0, 0.0, (double)(0.5f * zCorrection));
|
90.0f,
|
||||||
|
(float) forgeDir.offsetX,
|
||||||
|
(float) forgeDir.offsetY,
|
||||||
|
(float) forgeDir.offsetZ
|
||||||
|
);
|
||||||
|
GL11.glTranslated(0.0, 0.0, (double) (0.5f * zCorrection));
|
||||||
GL11.glClear(256);
|
GL11.glClear(256);
|
||||||
renderPulsingQuad(new ResourceLocation("ee3", "textures/effects/noise.png"), 0.75f);
|
renderPulsingQuad(
|
||||||
|
new ResourceLocation("ee3", "textures/effects/noise.png"), 0.75f
|
||||||
|
);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
GL11.glEnable(2884);
|
GL11.glEnable(2884);
|
||||||
GL11.glDepthMask(true);
|
GL11.glDepthMask(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderPulsingQuad(final ResourceLocation texture, final float maxTransparency) {
|
public static void
|
||||||
|
renderPulsingQuad(final ResourceLocation texture, final float maxTransparency) {
|
||||||
final float pulseTransparency = getPulseValue() * maxTransparency / 3000.0f;
|
final float pulseTransparency = getPulseValue() * maxTransparency / 3000.0f;
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||||
final Tessellator tessellator = Tessellator.instance;
|
final Tessellator tessellator = Tessellator.instance;
|
||||||
|
@ -546,12 +836,11 @@ public class DrawBlockHighlightEventHandler
|
||||||
GL11.glDisable(3042);
|
GL11.glDisable(3042);
|
||||||
GL11.glDisable(32826);
|
GL11.glDisable(32826);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getPulseValue() {
|
private static int getPulseValue() {
|
||||||
if (DrawBlockHighlightEventHandler.doInc) {
|
if (DrawBlockHighlightEventHandler.doInc) {
|
||||||
DrawBlockHighlightEventHandler.pulse += 8;
|
DrawBlockHighlightEventHandler.pulse += 8;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
DrawBlockHighlightEventHandler.pulse -= 8;
|
DrawBlockHighlightEventHandler.pulse -= 8;
|
||||||
}
|
}
|
||||||
if (DrawBlockHighlightEventHandler.pulse == 3000) {
|
if (DrawBlockHighlightEventHandler.pulse == 3000) {
|
||||||
|
|
|
@ -16,23 +16,18 @@ import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.opengl.GL12;
|
import org.lwjgl.opengl.GL12;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class HUDTickHandler
|
public class HUDTickHandler {
|
||||||
{
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void renderTick(TickEvent.RenderTickEvent event)
|
public void renderTick(TickEvent.RenderTickEvent event) {
|
||||||
{
|
if (event.phase == TickEvent.Phase.END) {
|
||||||
if (event.phase == TickEvent.Phase.END)
|
|
||||||
{
|
|
||||||
Minecraft minecraft = FMLClientHandler.instance().getClient();
|
Minecraft minecraft = FMLClientHandler.instance().getClient();
|
||||||
EntityPlayer entityPlayer = minecraft.thePlayer;
|
EntityPlayer entityPlayer = minecraft.thePlayer;
|
||||||
|
|
||||||
if (entityPlayer != null)
|
if (entityPlayer != null) {
|
||||||
{
|
|
||||||
ItemStack currentItemStack = entityPlayer.inventory.getCurrentItem();
|
ItemStack currentItemStack = entityPlayer.inventory.getCurrentItem();
|
||||||
if (Minecraft.isGuiEnabled() && minecraft.inGameHasFocus)
|
if (Minecraft.isGuiEnabled() && minecraft.inGameHasFocus) {
|
||||||
{
|
if (currentItemStack != null
|
||||||
if (currentItemStack != null && currentItemStack.getItem() instanceof IOverlayItem)
|
&& currentItemStack.getItem() instanceof IOverlayItem) {
|
||||||
{
|
|
||||||
renderHUDOverlayItem(minecraft, entityPlayer, currentItemStack);
|
renderHUDOverlayItem(minecraft, entityPlayer, currentItemStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,16 +35,26 @@ public class HUDTickHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void renderHUDOverlayItem(Minecraft minecraft, EntityPlayer entityPlayer, ItemStack itemStack)
|
private static void renderHUDOverlayItem(
|
||||||
{
|
Minecraft minecraft, EntityPlayer entityPlayer, ItemStack itemStack
|
||||||
|
) {
|
||||||
float overlayScale = 2f;
|
float overlayScale = 2f;
|
||||||
float overlayOpacity = 1f;
|
float overlayOpacity = 1f;
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
ScaledResolution sr = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
|
ScaledResolution sr = new ScaledResolution(
|
||||||
|
minecraft, minecraft.displayWidth, minecraft.displayHeight
|
||||||
|
);
|
||||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||||
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
GL11.glMatrixMode(GL11.GL_PROJECTION);
|
||||||
GL11.glLoadIdentity();
|
GL11.glLoadIdentity();
|
||||||
GL11.glOrtho(0.0D, sr.getScaledWidth_double(), sr.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
|
GL11.glOrtho(
|
||||||
|
0.0D,
|
||||||
|
sr.getScaledWidth_double(),
|
||||||
|
sr.getScaledHeight_double(),
|
||||||
|
0.0D,
|
||||||
|
1000.0D,
|
||||||
|
3000.0D
|
||||||
|
);
|
||||||
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
GL11.glMatrixMode(GL11.GL_MODELVIEW);
|
||||||
GL11.glLoadIdentity();
|
GL11.glLoadIdentity();
|
||||||
GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
|
GL11.glTranslatef(0.0F, 0.0F, -2000.0F);
|
||||||
|
@ -65,7 +70,15 @@ public class HUDTickHandler
|
||||||
hudOverlayX = (int) (sr.getScaledWidth() - 16 * overlayScale);
|
hudOverlayX = (int) (sr.getScaledWidth() - 16 * overlayScale);
|
||||||
hudOverlayY = (int) (sr.getScaledHeight() - 16 * overlayScale);
|
hudOverlayY = (int) (sr.getScaledHeight() - 16 * overlayScale);
|
||||||
|
|
||||||
RenderUtils.renderItemIntoGUI(minecraft.fontRenderer, itemStack, hudOverlayX, hudOverlayY, overlayOpacity, overlayScale, -90);
|
RenderUtils.renderItemIntoGUI(
|
||||||
|
minecraft.fontRenderer,
|
||||||
|
itemStack,
|
||||||
|
hudOverlayX,
|
||||||
|
hudOverlayY,
|
||||||
|
overlayOpacity,
|
||||||
|
overlayScale,
|
||||||
|
-90
|
||||||
|
);
|
||||||
|
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.pahimar.ee3.client.handler;
|
package com.pahimar.ee3.client.handler;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.pahimar.ee3.api.blacklist.BlacklistRegistryProxy;
|
import com.pahimar.ee3.api.blacklist.BlacklistRegistryProxy;
|
||||||
import com.pahimar.ee3.api.exchange.EnergyValue;
|
import com.pahimar.ee3.api.exchange.EnergyValue;
|
||||||
import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy;
|
import com.pahimar.ee3.api.exchange.EnergyValueRegistryProxy;
|
||||||
|
@ -21,43 +23,63 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ItemTooltipEventHandler {
|
public class ItemTooltipEventHandler {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void handleItemTooltipEvent(ItemTooltipEvent event) {
|
public void handleItemTooltipEvent(ItemTooltipEvent event) {
|
||||||
|
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)
|
||||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || (event.entityPlayer != null && (event.entityPlayer.openContainer instanceof ContainerAlchenomicon || event.entityPlayer.openContainer instanceof ContainerTransmutationTablet))) {
|
|| Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)
|
||||||
|
|| (event.entityPlayer != null
|
||||||
|
&& (event.entityPlayer.openContainer instanceof ContainerAlchenomicon
|
||||||
|
|| event.entityPlayer.openContainer
|
||||||
|
instanceof ContainerTransmutationTablet))) {
|
||||||
WrappedStack wrappedItemStack = WrappedStack.wrap(event.itemStack);
|
WrappedStack wrappedItemStack = WrappedStack.wrap(event.itemStack);
|
||||||
EnergyValue energyValue = EnergyValueRegistryProxy.getEnergyValue(wrappedItemStack);
|
EnergyValue energyValue
|
||||||
EnergyValue stackEnergyValue = EnergyValueRegistryProxy.getEnergyValueForStack(wrappedItemStack);
|
= EnergyValueRegistryProxy.getEnergyValue(wrappedItemStack);
|
||||||
|
EnergyValue stackEnergyValue
|
||||||
|
= EnergyValueRegistryProxy.getEnergyValueForStack(wrappedItemStack);
|
||||||
|
|
||||||
if (energyValue != null) {
|
if (energyValue != null) {
|
||||||
|
|
||||||
if (wrappedItemStack.getStackSize() > 1) {
|
if (wrappedItemStack.getStackSize() > 1) {
|
||||||
event.toolTip.add(String.format("Exchange Energy (Item): %s", energyValue)); // TODO Localize
|
event.toolTip.add(
|
||||||
event.toolTip.add(String.format("Exchange Energy (Stack of %s): %s", event.itemStack.stackSize, stackEnergyValue)); // TODO Localize
|
String.format("Exchange Energy (Item): %s", energyValue)
|
||||||
}
|
); // TODO Localize
|
||||||
else {
|
event.toolTip.add(String.format(
|
||||||
|
"Exchange Energy (Stack of %s): %s",
|
||||||
|
event.itemStack.stackSize,
|
||||||
|
stackEnergyValue
|
||||||
|
)); // TODO Localize
|
||||||
|
} else {
|
||||||
|
event.toolTip.add(
|
||||||
|
String.format("Exchange Energy: %s", stackEnergyValue)
|
||||||
|
); // TODO Localize
|
||||||
|
|
||||||
event.toolTip.add(String.format("Exchange Energy: %s", stackEnergyValue)); // TODO Localize
|
if (FluidContainerRegistry.getFluidForFilledItem(event.itemStack)
|
||||||
|
!= null) {
|
||||||
if (FluidContainerRegistry.getFluidForFilledItem(event.itemStack) != null) {
|
FluidStack fluidStack
|
||||||
|
= FluidContainerRegistry.getFluidForFilledItem(event.itemStack
|
||||||
FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(event.itemStack);
|
);
|
||||||
EnergyValue fluidStackEnergyValue = EnergyValueRegistryProxy.getEnergyValueForStack(fluidStack);
|
EnergyValue fluidStackEnergyValue
|
||||||
|
= EnergyValueRegistryProxy.getEnergyValueForStack(fluidStack);
|
||||||
|
|
||||||
if (fluidStackEnergyValue != null) {
|
if (fluidStackEnergyValue != null) {
|
||||||
event.toolTip.add(String.format(" - Exchange Energy (%smB of %s): %s", fluidStack.amount, fluidStack.getLocalizedName(), fluidStackEnergyValue)); // TODO Localize
|
event.toolTip.add(String.format(
|
||||||
event.toolTip.add(String.format(" - Exchange Energy (Container): %s", new EnergyValue(energyValue.getValue() - fluidStackEnergyValue.getValue()))); // TODO Localize
|
" - Exchange Energy (%smB of %s): %s",
|
||||||
|
fluidStack.amount,
|
||||||
|
fluidStack.getLocalizedName(),
|
||||||
|
fluidStackEnergyValue
|
||||||
|
)); // TODO Localize
|
||||||
|
event.toolTip.add(String.format(
|
||||||
|
" - Exchange Energy (Container): %s",
|
||||||
|
new EnergyValue(
|
||||||
|
energyValue.getValue()
|
||||||
|
- fluidStackEnergyValue.getValue()
|
||||||
|
)
|
||||||
|
)); // TODO Localize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
event.toolTip.add("No Exchange Energy value"); // TODO Localize
|
event.toolTip.add("No Exchange Energy value"); // TODO Localize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,22 +92,32 @@ public class ItemTooltipEventHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) && (event.entityPlayer != null && event.entityPlayer.openContainer instanceof ContainerResearchStation))) {
|
if (((Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)
|
||||||
|
|| Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))
|
||||||
if (PlayerKnowledgeRegistryProxy.doesPlayerKnow(event.entityPlayer, event.itemStack)) {
|
&& (event.entityPlayer != null
|
||||||
event.toolTip.add("You know how to transmute this"); // TODO Localize with better phrasing
|
&& event.entityPlayer.openContainer instanceof ContainerResearchStation)
|
||||||
|
)) {
|
||||||
|
if (PlayerKnowledgeRegistryProxy.doesPlayerKnow(
|
||||||
|
event.entityPlayer, event.itemStack
|
||||||
|
)) {
|
||||||
|
event.toolTip.add("You know how to transmute this"
|
||||||
|
); // TODO Localize with better phrasing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.itemStack.getItem() instanceof IOwnable) {
|
if (event.itemStack.getItem() instanceof IOwnable) {
|
||||||
|
|
||||||
UUID playerUUID = ItemStackUtils.getOwnerUUID(event.itemStack);
|
UUID playerUUID = ItemStackUtils.getOwnerUUID(event.itemStack);
|
||||||
|
|
||||||
if (playerUUID != null && UsernameCache.containsUUID(playerUUID)) {
|
if (playerUUID != null && UsernameCache.containsUUID(playerUUID)) {
|
||||||
event.toolTip.add(StatCollector.translateToLocalFormatted(Messages.Tooltips.ITEM_BELONGS_TO, UsernameCache.getLastKnownUsername(playerUUID)));
|
event.toolTip.add(StatCollector.translateToLocalFormatted(
|
||||||
}
|
Messages.Tooltips.ITEM_BELONGS_TO,
|
||||||
else if (ItemStackUtils.getOwnerName(event.itemStack) != null) {
|
UsernameCache.getLastKnownUsername(playerUUID)
|
||||||
event.toolTip.add(StatCollector.translateToLocalFormatted(Messages.Tooltips.ITEM_BELONGS_TO, ItemStackUtils.getOwnerName(event.itemStack)));
|
));
|
||||||
|
} else if (ItemStackUtils.getOwnerName(event.itemStack) != null) {
|
||||||
|
event.toolTip.add(StatCollector.translateToLocalFormatted(
|
||||||
|
Messages.Tooltips.ITEM_BELONGS_TO,
|
||||||
|
ItemStackUtils.getOwnerName(event.itemStack)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,24 +14,15 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class KeyInputEventHandler
|
public class KeyInputEventHandler {
|
||||||
{
|
private static Key getPressedKeybinding() {
|
||||||
private static Key getPressedKeybinding()
|
if (Keybindings.charge.getIsKeyPressed()) {
|
||||||
{
|
|
||||||
if (Keybindings.charge.getIsKeyPressed())
|
|
||||||
{
|
|
||||||
return Key.CHARGE;
|
return Key.CHARGE;
|
||||||
}
|
} else if (Keybindings.extra.getIsKeyPressed()) {
|
||||||
else if (Keybindings.extra.getIsKeyPressed())
|
|
||||||
{
|
|
||||||
return Key.EXTRA;
|
return Key.EXTRA;
|
||||||
}
|
} else if (Keybindings.release.getIsKeyPressed()) {
|
||||||
else if (Keybindings.release.getIsKeyPressed())
|
|
||||||
{
|
|
||||||
return Key.RELEASE;
|
return Key.RELEASE;
|
||||||
}
|
} else if (Keybindings.toggle.getIsKeyPressed()) {
|
||||||
else if (Keybindings.toggle.getIsKeyPressed())
|
|
||||||
{
|
|
||||||
return Key.TOGGLE;
|
return Key.TOGGLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,32 +30,32 @@ public class KeyInputEventHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void handleKeyInputEvent(InputEvent.KeyInputEvent event)
|
public void handleKeyInputEvent(InputEvent.KeyInputEvent event) {
|
||||||
{
|
if (getPressedKeybinding() == Key.UNKNOWN) {
|
||||||
if (getPressedKeybinding() == Key.UNKNOWN)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FMLClientHandler.instance().getClient().inGameHasFocus)
|
if (FMLClientHandler.instance().getClient().inGameHasFocus) {
|
||||||
{
|
if (FMLClientHandler.instance().getClientPlayerEntity() != null) {
|
||||||
if (FMLClientHandler.instance().getClientPlayerEntity() != null)
|
EntityPlayer entityPlayer
|
||||||
{
|
= FMLClientHandler.instance().getClientPlayerEntity();
|
||||||
EntityPlayer entityPlayer = FMLClientHandler.instance().getClientPlayerEntity();
|
|
||||||
|
|
||||||
if (entityPlayer.getCurrentEquippedItem() != null)
|
if (entityPlayer.getCurrentEquippedItem() != null) {
|
||||||
{
|
ItemStack currentlyEquippedItemStack
|
||||||
ItemStack currentlyEquippedItemStack = entityPlayer.getCurrentEquippedItem();
|
= entityPlayer.getCurrentEquippedItem();
|
||||||
|
|
||||||
if (currentlyEquippedItemStack.getItem() instanceof IKeyBound)
|
if (currentlyEquippedItemStack.getItem() instanceof IKeyBound) {
|
||||||
{
|
if (entityPlayer.worldObj.isRemote) {
|
||||||
if (entityPlayer.worldObj.isRemote)
|
PacketHandler.INSTANCE.sendToServer(
|
||||||
{
|
new MessageKeyPressed(getPressedKeybinding())
|
||||||
PacketHandler.INSTANCE.sendToServer(new MessageKeyPressed(getPressedKeybinding()));
|
);
|
||||||
}
|
} else {
|
||||||
else
|
((IKeyBound) currentlyEquippedItemStack.getItem())
|
||||||
{
|
.doKeyBindingAction(
|
||||||
((IKeyBound) currentlyEquippedItemStack.getItem()).doKeyBindingAction(entityPlayer, currentlyEquippedItemStack, getPressedKeybinding());
|
entityPlayer,
|
||||||
|
currentlyEquippedItemStack,
|
||||||
|
getPressedKeybinding()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,49 +10,44 @@ import net.minecraftforge.client.IItemRenderer;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ItemRendererAlchemicalChest implements IItemRenderer
|
public class ItemRendererAlchemicalChest implements IItemRenderer {
|
||||||
{
|
|
||||||
private final ModelChest modelChest;
|
private final ModelChest modelChest;
|
||||||
|
|
||||||
public ItemRendererAlchemicalChest()
|
public ItemRendererAlchemicalChest() {
|
||||||
{
|
|
||||||
modelChest = new ModelChest();
|
modelChest = new ModelChest();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType)
|
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldUseRenderHelper(ItemRenderType itemRenderType, ItemStack itemStack, ItemRendererHelper itemRendererHelper)
|
public boolean shouldUseRenderHelper(
|
||||||
{
|
ItemRenderType itemRenderType,
|
||||||
|
ItemStack itemStack,
|
||||||
|
ItemRendererHelper itemRendererHelper
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... data)
|
public void
|
||||||
{
|
renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... data) {
|
||||||
switch (itemRenderType)
|
switch (itemRenderType) {
|
||||||
{
|
case ENTITY: {
|
||||||
case ENTITY:
|
|
||||||
{
|
|
||||||
renderAlchemicalChest(0.5F, 0.5F, 0.5F, itemStack.getItemDamage());
|
renderAlchemicalChest(0.5F, 0.5F, 0.5F, itemStack.getItemDamage());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EQUIPPED:
|
case EQUIPPED: {
|
||||||
{
|
|
||||||
renderAlchemicalChest(1.0F, 1.0F, 1.0F, itemStack.getItemDamage());
|
renderAlchemicalChest(1.0F, 1.0F, 1.0F, itemStack.getItemDamage());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EQUIPPED_FIRST_PERSON:
|
case EQUIPPED_FIRST_PERSON: {
|
||||||
{
|
|
||||||
renderAlchemicalChest(1.0F, 1.0F, 1.0F, itemStack.getItemDamage());
|
renderAlchemicalChest(1.0F, 1.0F, 1.0F, itemStack.getItemDamage());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case INVENTORY:
|
case INVENTORY: {
|
||||||
{
|
|
||||||
renderAlchemicalChest(0.0F, 0.075F, 0.0F, itemStack.getItemDamage());
|
renderAlchemicalChest(0.0F, 0.075F, 0.0F, itemStack.getItemDamage());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -61,19 +56,19 @@ public class ItemRendererAlchemicalChest implements IItemRenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderAlchemicalChest(float x, float y, float z, int metaData)
|
private void renderAlchemicalChest(float x, float y, float z, int metaData) {
|
||||||
{
|
if (metaData == 0) {
|
||||||
if (metaData == 0)
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(
|
||||||
{
|
Textures.Model.ALCHEMICAL_CHEST_SMALL
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.Model.ALCHEMICAL_CHEST_SMALL);
|
);
|
||||||
}
|
} else if (metaData == 1) {
|
||||||
else if (metaData == 1)
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(
|
||||||
{
|
Textures.Model.ALCHEMICAL_CHEST_MEDIUM
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.Model.ALCHEMICAL_CHEST_MEDIUM);
|
);
|
||||||
}
|
} else if (metaData == 2) {
|
||||||
else if (metaData == 2)
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(
|
||||||
{
|
Textures.Model.ALCHEMICAL_CHEST_LARGE
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.Model.ALCHEMICAL_CHEST_LARGE);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glPushMatrix(); //start
|
GL11.glPushMatrix(); //start
|
||||||
|
|
|
@ -10,49 +10,44 @@ import net.minecraftforge.client.IItemRenderer;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ItemRendererAludel implements IItemRenderer
|
public class ItemRendererAludel implements IItemRenderer {
|
||||||
{
|
|
||||||
private final ModelAludel modelAludel;
|
private final ModelAludel modelAludel;
|
||||||
|
|
||||||
public ItemRendererAludel()
|
public ItemRendererAludel() {
|
||||||
{
|
|
||||||
modelAludel = new ModelAludel();
|
modelAludel = new ModelAludel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType)
|
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldUseRenderHelper(ItemRenderType itemRenderType, ItemStack itemStack, ItemRendererHelper itemRendererHelper)
|
public boolean shouldUseRenderHelper(
|
||||||
{
|
ItemRenderType itemRenderType,
|
||||||
|
ItemStack itemStack,
|
||||||
|
ItemRendererHelper itemRendererHelper
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... data)
|
public void
|
||||||
{
|
renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... data) {
|
||||||
switch (itemRenderType)
|
switch (itemRenderType) {
|
||||||
{
|
case ENTITY: {
|
||||||
case ENTITY:
|
|
||||||
{
|
|
||||||
renderAludel(-0.5F, -0.38F, 0.5F);
|
renderAludel(-0.5F, -0.38F, 0.5F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case EQUIPPED:
|
case EQUIPPED: {
|
||||||
{
|
|
||||||
renderAludel(0.0F, 0.0F, 1.0F);
|
renderAludel(0.0F, 0.0F, 1.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case EQUIPPED_FIRST_PERSON:
|
case EQUIPPED_FIRST_PERSON: {
|
||||||
{
|
|
||||||
renderAludel(0.0F, 0.0F, 1.0F);
|
renderAludel(0.0F, 0.0F, 1.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case INVENTORY:
|
case INVENTORY: {
|
||||||
{
|
|
||||||
renderAludel(-1.0F, -0.9F, 0.0F);
|
renderAludel(-1.0F, -0.9F, 0.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -60,8 +55,7 @@ public class ItemRendererAludel implements IItemRenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderAludel(float x, float y, float z)
|
private void renderAludel(float x, float y, float z) {
|
||||||
{
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
// Scale, Translate, Rotate
|
// Scale, Translate, Rotate
|
||||||
|
@ -70,7 +64,9 @@ public class ItemRendererAludel implements IItemRenderer
|
||||||
GL11.glRotatef(-90F, 1F, 0, 0);
|
GL11.glRotatef(-90F, 1F, 0, 0);
|
||||||
|
|
||||||
// Bind texture
|
// Bind texture
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.Model.ALUDEL);
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(
|
||||||
|
Textures.Model.ALUDEL
|
||||||
|
);
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
modelAludel.render();
|
modelAludel.render();
|
||||||
|
|
|
@ -10,60 +10,53 @@ import net.minecraftforge.client.IItemRenderer;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ItemRendererCalcinator implements IItemRenderer
|
public class ItemRendererCalcinator implements IItemRenderer {
|
||||||
{
|
|
||||||
private final ModelCalcinator modelCalcinator;
|
private final ModelCalcinator modelCalcinator;
|
||||||
|
|
||||||
public ItemRendererCalcinator()
|
public ItemRendererCalcinator() {
|
||||||
{
|
|
||||||
modelCalcinator = new ModelCalcinator();
|
modelCalcinator = new ModelCalcinator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType)
|
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldUseRenderHelper(ItemRenderType itemRenderType, ItemStack itemStack, ItemRendererHelper itemRendererHelper)
|
public boolean shouldUseRenderHelper(
|
||||||
{
|
ItemRenderType itemRenderType,
|
||||||
|
ItemStack itemStack,
|
||||||
|
ItemRendererHelper itemRendererHelper
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... data)
|
public void
|
||||||
{
|
renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... data) {
|
||||||
switch (itemRenderType)
|
switch (itemRenderType) {
|
||||||
{
|
case ENTITY: {
|
||||||
case ENTITY:
|
|
||||||
{
|
|
||||||
renderCalcinator(-0.5F, 0.0F, 0.5F);
|
renderCalcinator(-0.5F, 0.0F, 0.5F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case EQUIPPED:
|
case EQUIPPED: {
|
||||||
{
|
|
||||||
renderCalcinator(0.0F, 0.0F, 1.0F);
|
renderCalcinator(0.0F, 0.0F, 1.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case EQUIPPED_FIRST_PERSON:
|
case EQUIPPED_FIRST_PERSON: {
|
||||||
{
|
|
||||||
renderCalcinator(0.0F, 0.0F, 1.0F);
|
renderCalcinator(0.0F, 0.0F, 1.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case INVENTORY:
|
case INVENTORY: {
|
||||||
{
|
|
||||||
renderCalcinator(0.0F, -0.1F, 1.0F);
|
renderCalcinator(0.0F, -0.1F, 1.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderCalcinator(float x, float y, float z)
|
private void renderCalcinator(float x, float y, float z) {
|
||||||
{
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
// Scale, Translate, Rotate
|
// Scale, Translate, Rotate
|
||||||
|
@ -72,7 +65,9 @@ public class ItemRendererCalcinator implements IItemRenderer
|
||||||
GL11.glRotatef(-90F, 1F, 0, 0);
|
GL11.glRotatef(-90F, 1F, 0, 0);
|
||||||
|
|
||||||
// Bind texture
|
// Bind texture
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.Model.CALCINATOR_IDLE);
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(
|
||||||
|
Textures.Model.CALCINATOR_IDLE
|
||||||
|
);
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
modelCalcinator.renderPart("Calcinator");
|
modelCalcinator.renderPart("Calcinator");
|
||||||
|
|
|
@ -10,60 +10,53 @@ import net.minecraftforge.client.IItemRenderer;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ItemRendererGlassBell implements IItemRenderer
|
public class ItemRendererGlassBell implements IItemRenderer {
|
||||||
{
|
|
||||||
private final ModelGlassBell modelGlassBell;
|
private final ModelGlassBell modelGlassBell;
|
||||||
|
|
||||||
public ItemRendererGlassBell()
|
public ItemRendererGlassBell() {
|
||||||
{
|
|
||||||
modelGlassBell = new ModelGlassBell();
|
modelGlassBell = new ModelGlassBell();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType)
|
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldUseRenderHelper(ItemRenderType itemRenderType, ItemStack itemStack, ItemRendererHelper itemRendererHelper)
|
public boolean shouldUseRenderHelper(
|
||||||
{
|
ItemRenderType itemRenderType,
|
||||||
|
ItemStack itemStack,
|
||||||
|
ItemRendererHelper itemRendererHelper
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... data)
|
public void
|
||||||
{
|
renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... data) {
|
||||||
switch (itemRenderType)
|
switch (itemRenderType) {
|
||||||
{
|
case ENTITY: {
|
||||||
case ENTITY:
|
|
||||||
{
|
|
||||||
renderGlassBell(-0.5F, -1.2F, 0.5F);
|
renderGlassBell(-0.5F, -1.2F, 0.5F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case EQUIPPED:
|
case EQUIPPED: {
|
||||||
{
|
|
||||||
renderGlassBell(-0.2F, -0.85F, 0.8F);
|
renderGlassBell(-0.2F, -0.85F, 0.8F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case EQUIPPED_FIRST_PERSON:
|
case EQUIPPED_FIRST_PERSON: {
|
||||||
{
|
|
||||||
renderGlassBell(-0.2F, -0.85F, 0.8F);
|
renderGlassBell(-0.2F, -0.85F, 0.8F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case INVENTORY:
|
case INVENTORY: {
|
||||||
{
|
|
||||||
renderGlassBell(-1.0F, -1.675F, 0.0F);
|
renderGlassBell(-1.0F, -1.675F, 0.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderGlassBell(float x, float y, float z)
|
private void renderGlassBell(float x, float y, float z) {
|
||||||
{
|
|
||||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
@ -74,12 +67,13 @@ public class ItemRendererGlassBell implements IItemRenderer
|
||||||
GL11.glRotatef(-90F, 1F, 0, 0);
|
GL11.glRotatef(-90F, 1F, 0, 0);
|
||||||
|
|
||||||
// Bind texture
|
// Bind texture
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.Model.GLASS_BELL);
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(
|
||||||
|
Textures.Model.GLASS_BELL
|
||||||
|
);
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
modelGlassBell.render();
|
modelGlassBell.render();
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,60 +10,53 @@ import net.minecraftforge.client.IItemRenderer;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ItemRendererResearchStation implements IItemRenderer
|
public class ItemRendererResearchStation implements IItemRenderer {
|
||||||
{
|
|
||||||
private final ModelResearchStation modelResearchStation;
|
private final ModelResearchStation modelResearchStation;
|
||||||
|
|
||||||
public ItemRendererResearchStation()
|
public ItemRendererResearchStation() {
|
||||||
{
|
|
||||||
modelResearchStation = new ModelResearchStation();
|
modelResearchStation = new ModelResearchStation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType)
|
public boolean handleRenderType(ItemStack itemStack, ItemRenderType itemRenderType) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldUseRenderHelper(ItemRenderType itemRenderType, ItemStack itemStack, ItemRendererHelper itemRendererHelper)
|
public boolean shouldUseRenderHelper(
|
||||||
{
|
ItemRenderType itemRenderType,
|
||||||
|
ItemStack itemStack,
|
||||||
|
ItemRendererHelper itemRendererHelper
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... data)
|
public void
|
||||||
{
|
renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... data) {
|
||||||
switch (itemRenderType)
|
switch (itemRenderType) {
|
||||||
{
|
case ENTITY: {
|
||||||
case ENTITY:
|
|
||||||
{
|
|
||||||
renderCalcinator(-0.5F, 0.0F, 0.5F);
|
renderCalcinator(-0.5F, 0.0F, 0.5F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case EQUIPPED:
|
case EQUIPPED: {
|
||||||
{
|
|
||||||
renderCalcinator(0.0F, 0.0F, 1.0F);
|
renderCalcinator(0.0F, 0.0F, 1.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case EQUIPPED_FIRST_PERSON:
|
case EQUIPPED_FIRST_PERSON: {
|
||||||
{
|
|
||||||
renderCalcinator(0.0F, 0.0F, 1.0F);
|
renderCalcinator(0.0F, 0.0F, 1.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case INVENTORY:
|
case INVENTORY: {
|
||||||
{
|
|
||||||
renderCalcinator(0.0F, -0.1F, 1.0F);
|
renderCalcinator(0.0F, -0.1F, 1.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderCalcinator(float x, float y, float z)
|
private void renderCalcinator(float x, float y, float z) {
|
||||||
{
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
// Scale, Translate, Rotate
|
// Scale, Translate, Rotate
|
||||||
|
@ -71,7 +64,9 @@ public class ItemRendererResearchStation implements IItemRenderer
|
||||||
GL11.glTranslatef(x, y, z);
|
GL11.glTranslatef(x, y, z);
|
||||||
|
|
||||||
// Bind texture
|
// Bind texture
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.Model.RESEARCH_STATION);
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(
|
||||||
|
Textures.Model.RESEARCH_STATION
|
||||||
|
);
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
modelResearchStation.render();
|
modelResearchStation.render();
|
||||||
|
|
|
@ -7,17 +7,14 @@ import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||||
import net.minecraftforge.client.model.IModelCustom;
|
import net.minecraftforge.client.model.IModelCustom;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ModelAludel
|
public class ModelAludel {
|
||||||
{
|
|
||||||
private IModelCustom modelAludel;
|
private IModelCustom modelAludel;
|
||||||
|
|
||||||
public ModelAludel()
|
public ModelAludel() {
|
||||||
{
|
|
||||||
modelAludel = AdvancedModelLoader.loadModel(Models.ALUDEL);
|
modelAludel = AdvancedModelLoader.loadModel(Models.ALUDEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render()
|
public void render() {
|
||||||
{
|
|
||||||
modelAludel.renderPart("Base");
|
modelAludel.renderPart("Base");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,17 +7,14 @@ import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||||
import net.minecraftforge.client.model.IModelCustom;
|
import net.minecraftforge.client.model.IModelCustom;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ModelAugmentationTable
|
public class ModelAugmentationTable {
|
||||||
{
|
|
||||||
private IModelCustom modelAugmentationTable;
|
private IModelCustom modelAugmentationTable;
|
||||||
|
|
||||||
public ModelAugmentationTable()
|
public ModelAugmentationTable() {
|
||||||
{
|
|
||||||
modelAugmentationTable = AdvancedModelLoader.loadModel(Models.AUGMENTATION_TABLE);
|
modelAugmentationTable = AdvancedModelLoader.loadModel(Models.AUGMENTATION_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render()
|
public void render() {
|
||||||
{
|
|
||||||
modelAugmentationTable.renderAll();
|
modelAugmentationTable.renderAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,22 +7,18 @@ import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||||
import net.minecraftforge.client.model.IModelCustom;
|
import net.minecraftforge.client.model.IModelCustom;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ModelCalcinator
|
public class ModelCalcinator {
|
||||||
{
|
|
||||||
private IModelCustom modelCalcinator;
|
private IModelCustom modelCalcinator;
|
||||||
|
|
||||||
public ModelCalcinator()
|
public ModelCalcinator() {
|
||||||
{
|
|
||||||
modelCalcinator = AdvancedModelLoader.loadModel(Models.CALCINATOR);
|
modelCalcinator = AdvancedModelLoader.loadModel(Models.CALCINATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render()
|
public void render() {
|
||||||
{
|
|
||||||
modelCalcinator.renderAll();
|
modelCalcinator.renderAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderPart(String partName)
|
public void renderPart(String partName) {
|
||||||
{
|
|
||||||
modelCalcinator.renderPart(partName);
|
modelCalcinator.renderPart(partName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,17 +7,14 @@ import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||||
import net.minecraftforge.client.model.IModelCustom;
|
import net.minecraftforge.client.model.IModelCustom;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ModelGlassBell
|
public class ModelGlassBell {
|
||||||
{
|
|
||||||
private IModelCustom modelGlassBell;
|
private IModelCustom modelGlassBell;
|
||||||
|
|
||||||
public ModelGlassBell()
|
public ModelGlassBell() {
|
||||||
{
|
|
||||||
modelGlassBell = AdvancedModelLoader.loadModel(Models.GLASS_BELL);
|
modelGlassBell = AdvancedModelLoader.loadModel(Models.GLASS_BELL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render()
|
public void render() {
|
||||||
{
|
|
||||||
modelGlassBell.renderPart("Bell");
|
modelGlassBell.renderPart("Bell");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,17 +7,14 @@ import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||||
import net.minecraftforge.client.model.IModelCustom;
|
import net.minecraftforge.client.model.IModelCustom;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class ModelResearchStation
|
public class ModelResearchStation {
|
||||||
{
|
|
||||||
private IModelCustom modelResearchStation;
|
private IModelCustom modelResearchStation;
|
||||||
|
|
||||||
public ModelResearchStation()
|
public ModelResearchStation() {
|
||||||
{
|
|
||||||
modelResearchStation = AdvancedModelLoader.loadModel(Models.RESEARCH_STATION);
|
modelResearchStation = AdvancedModelLoader.loadModel(Models.RESEARCH_STATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render()
|
public void render() {
|
||||||
{
|
|
||||||
modelResearchStation.renderAll();
|
modelResearchStation.renderAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,11 @@ package com.pahimar.ee3.client.renderer.model;
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
|
||||||
public class ModelTransmutationTablet extends ModelBase
|
public class ModelTransmutationTablet extends ModelBase {
|
||||||
{
|
|
||||||
public ModelRenderer transmutationPad;
|
public ModelRenderer transmutationPad;
|
||||||
public ModelRenderer base;
|
public ModelRenderer base;
|
||||||
|
|
||||||
public ModelTransmutationTablet()
|
public ModelTransmutationTablet() {
|
||||||
{
|
|
||||||
this.textureWidth = 128;
|
this.textureWidth = 128;
|
||||||
this.textureHeight = 58;
|
this.textureHeight = 58;
|
||||||
this.transmutationPad = new ModelRenderer(this, 0, 24);
|
this.transmutationPad = new ModelRenderer(this, 0, 24);
|
||||||
|
@ -20,13 +18,11 @@ public class ModelTransmutationTablet extends ModelBase
|
||||||
this.base.addBox(-8.0F, 6.0F, -8.0F, 16, 8, 16, 0.0F);
|
this.base.addBox(-8.0F, 6.0F, -8.0F, 16, 8, 16, 0.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderTransmutationPad(float scale)
|
public void renderTransmutationPad(float scale) {
|
||||||
{
|
|
||||||
this.transmutationPad.render(scale);
|
this.transmutationPad.render(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderBase(float scale)
|
public void renderBase(float scale) {
|
||||||
{
|
|
||||||
this.base.render(scale);
|
this.base.render(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,33 +12,26 @@ import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.opengl.GL12;
|
import org.lwjgl.opengl.GL12;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class TileEntityRendererAlchemicalChest extends TileEntitySpecialRenderer
|
public class TileEntityRendererAlchemicalChest extends TileEntitySpecialRenderer {
|
||||||
{
|
|
||||||
private final ModelChest modelChest = new ModelChest();
|
private final ModelChest modelChest = new ModelChest();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
public void
|
||||||
{
|
renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
|
||||||
if (tileEntity instanceof TileEntityAlchemicalChest)
|
if (tileEntity instanceof TileEntityAlchemicalChest) {
|
||||||
{
|
TileEntityAlchemicalChest tileEntityAlchemicalChest
|
||||||
TileEntityAlchemicalChest tileEntityAlchemicalChest = (TileEntityAlchemicalChest) tileEntity;
|
= (TileEntityAlchemicalChest) tileEntity;
|
||||||
ForgeDirection direction = null;
|
ForgeDirection direction = null;
|
||||||
|
|
||||||
if (tileEntityAlchemicalChest.getWorldObj() != null)
|
if (tileEntityAlchemicalChest.getWorldObj() != null) {
|
||||||
{
|
|
||||||
direction = tileEntityAlchemicalChest.getOrientation();
|
direction = tileEntityAlchemicalChest.getOrientation();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tileEntityAlchemicalChest.getState() == 0)
|
if (tileEntityAlchemicalChest.getState() == 0) {
|
||||||
{
|
|
||||||
this.bindTexture(Textures.Model.ALCHEMICAL_CHEST_SMALL);
|
this.bindTexture(Textures.Model.ALCHEMICAL_CHEST_SMALL);
|
||||||
}
|
} else if (tileEntityAlchemicalChest.getState() == 1) {
|
||||||
else if (tileEntityAlchemicalChest.getState() == 1)
|
|
||||||
{
|
|
||||||
this.bindTexture(Textures.Model.ALCHEMICAL_CHEST_MEDIUM);
|
this.bindTexture(Textures.Model.ALCHEMICAL_CHEST_MEDIUM);
|
||||||
}
|
} else if (tileEntityAlchemicalChest.getState() == 2) {
|
||||||
else if (tileEntityAlchemicalChest.getState() == 2)
|
|
||||||
{
|
|
||||||
this.bindTexture(Textures.Model.ALCHEMICAL_CHEST_LARGE);
|
this.bindTexture(Textures.Model.ALCHEMICAL_CHEST_LARGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,32 +43,29 @@ public class TileEntityRendererAlchemicalChest extends TileEntitySpecialRenderer
|
||||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||||
short angle = 0;
|
short angle = 0;
|
||||||
|
|
||||||
if (direction != null)
|
if (direction != null) {
|
||||||
{
|
if (direction == ForgeDirection.NORTH) {
|
||||||
if (direction == ForgeDirection.NORTH)
|
|
||||||
{
|
|
||||||
angle = 180;
|
angle = 180;
|
||||||
}
|
} else if (direction == ForgeDirection.SOUTH) {
|
||||||
else if (direction == ForgeDirection.SOUTH)
|
|
||||||
{
|
|
||||||
angle = 0;
|
angle = 0;
|
||||||
}
|
} else if (direction == ForgeDirection.WEST) {
|
||||||
else if (direction == ForgeDirection.WEST)
|
|
||||||
{
|
|
||||||
angle = 90;
|
angle = 90;
|
||||||
}
|
} else if (direction == ForgeDirection.EAST) {
|
||||||
else if (direction == ForgeDirection.EAST)
|
|
||||||
{
|
|
||||||
angle = -90;
|
angle = -90;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
|
GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F);
|
||||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||||
float adjustedLidAngle = tileEntityAlchemicalChest.prevLidAngle + (tileEntityAlchemicalChest.lidAngle - tileEntityAlchemicalChest.prevLidAngle) * tick;
|
float adjustedLidAngle = tileEntityAlchemicalChest.prevLidAngle
|
||||||
|
+ (tileEntityAlchemicalChest.lidAngle
|
||||||
|
- tileEntityAlchemicalChest.prevLidAngle)
|
||||||
|
* tick;
|
||||||
adjustedLidAngle = 1.0F - adjustedLidAngle;
|
adjustedLidAngle = 1.0F - adjustedLidAngle;
|
||||||
adjustedLidAngle = 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle;
|
adjustedLidAngle
|
||||||
modelChest.chestLid.rotateAngleX = -(adjustedLidAngle * (float) Math.PI / 2.0F);
|
= 1.0F - adjustedLidAngle * adjustedLidAngle * adjustedLidAngle;
|
||||||
|
modelChest.chestLid.rotateAngleX
|
||||||
|
= -(adjustedLidAngle * (float) Math.PI / 2.0F);
|
||||||
modelChest.renderAll();
|
modelChest.renderAll();
|
||||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
|
@ -13,50 +13,49 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class TileEntityRendererAlchemyArray extends TileEntitySpecialRenderer
|
public class TileEntityRendererAlchemyArray extends TileEntitySpecialRenderer {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
public void
|
||||||
{
|
renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
|
||||||
if (tileEntity instanceof TileEntityAlchemyArray)
|
if (tileEntity instanceof TileEntityAlchemyArray) {
|
||||||
{
|
TileEntityAlchemyArray tileEntityAlchemyArray
|
||||||
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) FMLClientHandler.instance().getClient().theWorld.getTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
= (TileEntityAlchemyArray) FMLClientHandler.instance()
|
||||||
|
.getClient()
|
||||||
|
.theWorld.getTileEntity(
|
||||||
|
tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord
|
||||||
|
);
|
||||||
|
|
||||||
if (tileEntityAlchemyArray != null)
|
if (tileEntityAlchemyArray != null) {
|
||||||
{
|
|
||||||
AlchemyArray alchemyArray = tileEntityAlchemyArray.getAlchemyArray();
|
AlchemyArray alchemyArray = tileEntityAlchemyArray.getAlchemyArray();
|
||||||
|
|
||||||
if (alchemyArray != null)
|
if (alchemyArray != null) {
|
||||||
{
|
if (alchemyArray instanceof ICustomAlchemyArrayRender) {
|
||||||
if (alchemyArray instanceof ICustomAlchemyArrayRender)
|
((ICustomAlchemyArrayRender) alchemyArray)
|
||||||
{
|
.doCustomRendering(
|
||||||
((ICustomAlchemyArrayRender) alchemyArray).doCustomRendering(tileEntity, x, y, z, tileEntityAlchemyArray.getSize(), tileEntityAlchemyArray.getOrientation(), tileEntityAlchemyArray.getRotation(), tick);
|
tileEntity,
|
||||||
}
|
x,
|
||||||
else
|
y,
|
||||||
{
|
z,
|
||||||
|
tileEntityAlchemyArray.getSize(),
|
||||||
|
tileEntityAlchemyArray.getOrientation(),
|
||||||
|
tileEntityAlchemyArray.getRotation(),
|
||||||
|
tick
|
||||||
|
);
|
||||||
|
} else {
|
||||||
int scale = 1;
|
int scale = 1;
|
||||||
double xShift = 0.5d, yShift = 0.5d, zShift = 0.5d;
|
double xShift = 0.5d, yShift = 0.5d, zShift = 0.5d;
|
||||||
float xRotate = 0, yRotate = 0, zRotate = 0;
|
float xRotate = 0, yRotate = 0, zRotate = 0;
|
||||||
int rotationAngle = 0;
|
int rotationAngle = 0;
|
||||||
|
|
||||||
if (tileEntityAlchemyArray.getSize() == 1)
|
if (tileEntityAlchemyArray.getSize() == 1) {
|
||||||
{
|
|
||||||
scale = 1;
|
scale = 1;
|
||||||
}
|
} else if (tileEntityAlchemyArray.getSize() == 2) {
|
||||||
else if (tileEntityAlchemyArray.getSize() == 2)
|
|
||||||
{
|
|
||||||
scale = 3;
|
scale = 3;
|
||||||
}
|
} else if (tileEntityAlchemyArray.getSize() == 3) {
|
||||||
else if (tileEntityAlchemyArray.getSize() == 3)
|
|
||||||
{
|
|
||||||
scale = 5;
|
scale = 5;
|
||||||
}
|
} else if (tileEntityAlchemyArray.getSize() == 4) {
|
||||||
else if (tileEntityAlchemyArray.getSize() == 4)
|
|
||||||
{
|
|
||||||
scale = 7;
|
scale = 7;
|
||||||
}
|
} else if (tileEntityAlchemyArray.getSize() == 5) {
|
||||||
else if (tileEntityAlchemyArray.getSize() == 5)
|
|
||||||
{
|
|
||||||
scale = 9;
|
scale = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,10 +66,10 @@ public class TileEntityRendererAlchemyArray extends TileEntitySpecialRenderer
|
||||||
GL11.glDepthMask(false);
|
GL11.glDepthMask(false);
|
||||||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP)
|
if (tileEntityAlchemyArray.getOrientation()
|
||||||
{
|
== ForgeDirection.UP) {
|
||||||
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
|
if (tileEntityAlchemyArray.getRotation()
|
||||||
{
|
== ForgeDirection.NORTH) {
|
||||||
rotationAngle = 0;
|
rotationAngle = 0;
|
||||||
}
|
}
|
||||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
||||||
|
@ -91,8 +90,8 @@ public class TileEntityRendererAlchemyArray extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.DOWN)
|
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.DOWN)
|
||||||
{
|
{
|
||||||
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
|
if (tileEntityAlchemyArray.getRotation()
|
||||||
{
|
== ForgeDirection.NORTH) {
|
||||||
rotationAngle = 0;
|
rotationAngle = 0;
|
||||||
}
|
}
|
||||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
||||||
|
@ -113,8 +112,8 @@ public class TileEntityRendererAlchemyArray extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.NORTH)
|
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.NORTH)
|
||||||
{
|
{
|
||||||
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
|
if (tileEntityAlchemyArray.getRotation()
|
||||||
{
|
== ForgeDirection.UP) {
|
||||||
rotationAngle = -90;
|
rotationAngle = -90;
|
||||||
}
|
}
|
||||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
||||||
|
@ -135,8 +134,8 @@ public class TileEntityRendererAlchemyArray extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.SOUTH)
|
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.SOUTH)
|
||||||
{
|
{
|
||||||
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
|
if (tileEntityAlchemyArray.getRotation()
|
||||||
{
|
== ForgeDirection.UP) {
|
||||||
rotationAngle = -90;
|
rotationAngle = -90;
|
||||||
}
|
}
|
||||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
||||||
|
@ -157,8 +156,8 @@ public class TileEntityRendererAlchemyArray extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.EAST)
|
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.EAST)
|
||||||
{
|
{
|
||||||
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
|
if (tileEntityAlchemyArray.getRotation()
|
||||||
{
|
== ForgeDirection.UP) {
|
||||||
rotationAngle = 180;
|
rotationAngle = 180;
|
||||||
}
|
}
|
||||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
|
||||||
|
@ -179,8 +178,8 @@ public class TileEntityRendererAlchemyArray extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.WEST)
|
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.WEST)
|
||||||
{
|
{
|
||||||
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
|
if (tileEntityAlchemyArray.getRotation()
|
||||||
{
|
== ForgeDirection.UP) {
|
||||||
rotationAngle = 180;
|
rotationAngle = 180;
|
||||||
}
|
}
|
||||||
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
|
||||||
|
@ -203,7 +202,12 @@ public class TileEntityRendererAlchemyArray extends TileEntitySpecialRenderer
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslated(x + xShift, y + yShift, z + zShift);
|
GL11.glTranslated(x + xShift, y + yShift, z + zShift);
|
||||||
GL11.glScalef(1f * scale, 1f * scale, 1f * scale);
|
GL11.glScalef(1f * scale, 1f * scale, 1f * scale);
|
||||||
GL11.glRotatef(rotationAngle, tileEntityAlchemyArray.getOrientation().offsetX, tileEntityAlchemyArray.getOrientation().offsetY, tileEntityAlchemyArray.getOrientation().offsetZ);
|
GL11.glRotatef(
|
||||||
|
rotationAngle,
|
||||||
|
tileEntityAlchemyArray.getOrientation().offsetX,
|
||||||
|
tileEntityAlchemyArray.getOrientation().offsetY,
|
||||||
|
tileEntityAlchemyArray.getOrientation().offsetZ
|
||||||
|
);
|
||||||
GL11.glRotatef(90, xRotate, yRotate, zRotate);
|
GL11.glRotatef(90, xRotate, yRotate, zRotate);
|
||||||
RenderUtils.renderQuad(alchemyArray.getTexture());
|
RenderUtils.renderQuad(alchemyArray.getTexture());
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
|
@ -17,18 +17,14 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class TileEntityRendererAludel extends TileEntitySpecialRenderer
|
public class TileEntityRendererAludel extends TileEntitySpecialRenderer {
|
||||||
{
|
|
||||||
private final ModelAludel modelAludel = new ModelAludel();
|
private final ModelAludel modelAludel = new ModelAludel();
|
||||||
private final RenderItem customRenderItem;
|
private final RenderItem customRenderItem;
|
||||||
|
|
||||||
public TileEntityRendererAludel()
|
public TileEntityRendererAludel() {
|
||||||
{
|
customRenderItem = new RenderItem() {
|
||||||
customRenderItem = new RenderItem()
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldBob()
|
public boolean shouldBob() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -37,10 +33,9 @@ public class TileEntityRendererAludel extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
public void
|
||||||
{
|
renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
|
||||||
if (tileEntity instanceof TileEntityAludel)
|
if (tileEntity instanceof TileEntityAludel) {
|
||||||
{
|
|
||||||
TileEntityAludel tileEntityAludel = (TileEntityAludel) tileEntity;
|
TileEntityAludel tileEntityAludel = (TileEntityAludel) tileEntity;
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
@ -61,20 +56,27 @@ public class TileEntityRendererAludel extends TileEntitySpecialRenderer
|
||||||
*/
|
*/
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
TileEntity tileGlassBell = tileEntityAludel.getWorldObj().getTileEntity(tileEntityAludel.xCoord, tileEntityAludel.yCoord + 1, tileEntityAludel.zCoord);
|
TileEntity tileGlassBell = tileEntityAludel.getWorldObj().getTileEntity(
|
||||||
|
tileEntityAludel.xCoord,
|
||||||
|
tileEntityAludel.yCoord + 1,
|
||||||
|
tileEntityAludel.zCoord
|
||||||
|
);
|
||||||
|
|
||||||
if (tileGlassBell instanceof TileEntityGlassBell)
|
if (tileGlassBell instanceof TileEntityGlassBell) {
|
||||||
{
|
if (tileEntityAludel.outputItemStack != null) {
|
||||||
if (tileEntityAludel.outputItemStack != null)
|
float scaleFactor
|
||||||
{
|
= getGhostItemScaleFactor(tileEntityAludel.outputItemStack);
|
||||||
float scaleFactor = getGhostItemScaleFactor(tileEntityAludel.outputItemStack);
|
float rotationAngle = (float
|
||||||
float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
|
) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
|
||||||
|
|
||||||
EntityItem ghostEntityItem = new EntityItem(tileEntityAludel.getWorldObj());
|
EntityItem ghostEntityItem
|
||||||
|
= new EntityItem(tileEntityAludel.getWorldObj());
|
||||||
ghostEntityItem.hoverStart = 0.0F;
|
ghostEntityItem.hoverStart = 0.0F;
|
||||||
ghostEntityItem.setEntityItemStack(tileEntityAludel.outputItemStack);
|
ghostEntityItem.setEntityItemStack(tileEntityAludel.outputItemStack);
|
||||||
|
|
||||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.25F, (float) z + 0.5F);
|
GL11.glTranslatef(
|
||||||
|
(float) x + 0.5F, (float) y + 1.25F, (float) z + 0.5F
|
||||||
|
);
|
||||||
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||||
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
|
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
|
||||||
|
|
||||||
|
@ -86,62 +88,44 @@ public class TileEntityRendererAludel extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scaleTranslateRotate(double x, double y, double z, ForgeDirection orientation)
|
private void
|
||||||
{
|
scaleTranslateRotate(double x, double y, double z, ForgeDirection orientation) {
|
||||||
if (orientation == ForgeDirection.NORTH)
|
if (orientation == ForgeDirection.NORTH) {
|
||||||
{
|
|
||||||
GL11.glTranslated(x + 1, y, z);
|
GL11.glTranslated(x + 1, y, z);
|
||||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||||
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
||||||
}
|
} else if (orientation == ForgeDirection.EAST) {
|
||||||
else if (orientation == ForgeDirection.EAST)
|
|
||||||
{
|
|
||||||
GL11.glTranslated(x + 1, y, z + 1);
|
GL11.glTranslated(x + 1, y, z + 1);
|
||||||
GL11.glRotatef(90F, 0F, 1F, 0F);
|
GL11.glRotatef(90F, 0F, 1F, 0F);
|
||||||
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
||||||
}
|
} else if (orientation == ForgeDirection.SOUTH) {
|
||||||
else if (orientation == ForgeDirection.SOUTH)
|
|
||||||
{
|
|
||||||
GL11.glTranslated(x, y, z + 1);
|
GL11.glTranslated(x, y, z + 1);
|
||||||
GL11.glRotatef(0F, 0F, 1F, 0F);
|
GL11.glRotatef(0F, 0F, 1F, 0F);
|
||||||
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
||||||
}
|
} else if (orientation == ForgeDirection.WEST) {
|
||||||
else if (orientation == ForgeDirection.WEST)
|
|
||||||
{
|
|
||||||
GL11.glTranslated(x, y, z);
|
GL11.glTranslated(x, y, z);
|
||||||
GL11.glRotatef(-90F, 0F, 1F, 0F);
|
GL11.glRotatef(-90F, 0F, 1F, 0F);
|
||||||
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getGhostItemScaleFactor(ItemStack itemStack)
|
private float getGhostItemScaleFactor(ItemStack itemStack) {
|
||||||
{
|
|
||||||
float scaleFactor = 1.0F;
|
float scaleFactor = 1.0F;
|
||||||
|
|
||||||
if (itemStack != null)
|
if (itemStack != null) {
|
||||||
{
|
|
||||||
byte numBlocks = 1;
|
byte numBlocks = 1;
|
||||||
if (itemStack.stackSize > 1)
|
if (itemStack.stackSize > 1) {
|
||||||
{
|
|
||||||
numBlocks = 2;
|
numBlocks = 2;
|
||||||
}
|
} else if (itemStack.stackSize > 5) {
|
||||||
else if (itemStack.stackSize > 5)
|
|
||||||
{
|
|
||||||
numBlocks = 3;
|
numBlocks = 3;
|
||||||
}
|
} else if (itemStack.stackSize > 20) {
|
||||||
else if (itemStack.stackSize > 20)
|
|
||||||
{
|
|
||||||
numBlocks = 4;
|
numBlocks = 4;
|
||||||
}
|
} else if (itemStack.stackSize > 40) {
|
||||||
else if (itemStack.stackSize > 40)
|
|
||||||
{
|
|
||||||
numBlocks = 5;
|
numBlocks = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemStack.getItem() instanceof ItemBlock)
|
if (itemStack.getItem() instanceof ItemBlock) {
|
||||||
{
|
switch (numBlocks) {
|
||||||
switch (numBlocks)
|
|
||||||
{
|
|
||||||
case 1:
|
case 1:
|
||||||
return 0.90F;
|
return 0.90F;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -155,11 +139,8 @@ public class TileEntityRendererAludel extends TileEntitySpecialRenderer
|
||||||
default:
|
default:
|
||||||
return 0.90F;
|
return 0.90F;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
switch (numBlocks) {
|
||||||
{
|
|
||||||
switch (numBlocks)
|
|
||||||
{
|
|
||||||
case 1:
|
case 1:
|
||||||
return 0.65F;
|
return 0.65F;
|
||||||
case 2:
|
case 2:
|
||||||
|
|
|
@ -13,45 +13,53 @@ import net.minecraft.util.MathHelper;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class TileEntityRendererCalcinator extends TileEntitySpecialRenderer
|
public class TileEntityRendererCalcinator extends TileEntitySpecialRenderer {
|
||||||
{
|
|
||||||
private final ModelCalcinator modelCalcinator = new ModelCalcinator();
|
private final ModelCalcinator modelCalcinator = new ModelCalcinator();
|
||||||
|
|
||||||
private static float[] getBlendedDustColour(int leftStackSize, int leftStackMeta, int rightStackSize, int rightStackMeta)
|
private static float[] getBlendedDustColour(
|
||||||
{
|
int leftStackSize, int leftStackMeta, int rightStackSize, int rightStackMeta
|
||||||
|
) {
|
||||||
int totalDustStacksSize = leftStackSize + rightStackSize;
|
int totalDustStacksSize = leftStackSize + rightStackSize;
|
||||||
|
|
||||||
if (totalDustStacksSize > 0)
|
if (totalDustStacksSize > 0) {
|
||||||
{
|
int leftStackColour = Integer.parseInt(
|
||||||
int leftStackColour = Integer.parseInt(Colors.DUST_COLOURS[MathHelper.clamp_int(leftStackMeta, 0, Colors.DUST_COLOURS.length)], 16);
|
Colors.DUST_COLOURS
|
||||||
int rightStackColour = Integer.parseInt(Colors.DUST_COLOURS[MathHelper.clamp_int(rightStackMeta, 0, Colors.DUST_COLOURS.length)], 16);
|
[MathHelper.clamp_int(leftStackMeta, 0, Colors.DUST_COLOURS.length)],
|
||||||
|
16
|
||||||
|
);
|
||||||
|
int rightStackColour = Integer.parseInt(
|
||||||
|
Colors.DUST_COLOURS
|
||||||
|
[MathHelper.clamp_int(rightStackMeta, 0, Colors.DUST_COLOURS.length)],
|
||||||
|
16
|
||||||
|
);
|
||||||
|
|
||||||
float leftStackRatio = leftStackSize * 1f / totalDustStacksSize;
|
float leftStackRatio = leftStackSize * 1f / totalDustStacksSize;
|
||||||
float rightStackRatio = rightStackSize * 1f / totalDustStacksSize;
|
float rightStackRatio = rightStackSize * 1f / totalDustStacksSize;
|
||||||
|
|
||||||
float[][] blendedColours = ColorUtils.getFloatBlendedColours(leftStackColour, rightStackColour, 32);
|
float[][] blendedColours = ColorUtils.getFloatBlendedColours(
|
||||||
|
leftStackColour, rightStackColour, 32
|
||||||
|
);
|
||||||
|
|
||||||
if (blendedColours.length > 0)
|
if (blendedColours.length > 0) {
|
||||||
{
|
if (Float.compare(leftStackRatio, rightStackRatio) > 0) {
|
||||||
if (Float.compare(leftStackRatio, rightStackRatio) > 0)
|
return blendedColours[Math.round(
|
||||||
{
|
(1 - leftStackRatio) * (blendedColours.length - 1)
|
||||||
return blendedColours[Math.round((1 - leftStackRatio) * (blendedColours.length - 1))];
|
)];
|
||||||
}
|
} else {
|
||||||
else
|
return blendedColours[Math.round(
|
||||||
{
|
rightStackRatio * (blendedColours.length - 1)
|
||||||
return blendedColours[Math.round(rightStackRatio * (blendedColours.length - 1))];
|
)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new float[]{1F, 1F, 1F};
|
return new float[] { 1F, 1F, 1F };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
public void
|
||||||
{
|
renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
|
||||||
if (tileEntity instanceof TileEntityCalcinator)
|
if (tileEntity instanceof TileEntityCalcinator) {
|
||||||
{
|
|
||||||
TileEntityCalcinator tileEntityCalcinator = (TileEntityCalcinator) tileEntity;
|
TileEntityCalcinator tileEntityCalcinator = (TileEntityCalcinator) tileEntity;
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
@ -63,39 +71,39 @@ public class TileEntityRendererCalcinator extends TileEntitySpecialRenderer
|
||||||
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
||||||
|
|
||||||
// Bind texture
|
// Bind texture
|
||||||
if (tileEntityCalcinator.getState() == 1)
|
if (tileEntityCalcinator.getState() == 1) {
|
||||||
{
|
|
||||||
this.bindTexture(Textures.Model.CALCINATOR_ACTIVE);
|
this.bindTexture(Textures.Model.CALCINATOR_ACTIVE);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
this.bindTexture(Textures.Model.CALCINATOR_IDLE);
|
this.bindTexture(Textures.Model.CALCINATOR_IDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
modelCalcinator.renderPart("Calcinator");
|
modelCalcinator.renderPart("Calcinator");
|
||||||
|
|
||||||
int dustStackSize = tileEntityCalcinator.leftStackSize + tileEntityCalcinator.rightStackSize;
|
int dustStackSize = tileEntityCalcinator.leftStackSize
|
||||||
|
+ tileEntityCalcinator.rightStackSize;
|
||||||
|
|
||||||
if (dustStackSize > 0)
|
if (dustStackSize > 0) {
|
||||||
{
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
// Reverse previous rotation to get back into a workable frame of reference
|
// Reverse previous rotation to get back into a workable frame of
|
||||||
|
// reference
|
||||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||||
GL11.glRotatef(-45F, 0F, 1F, 0F);
|
GL11.glRotatef(-45F, 0F, 1F, 0F);
|
||||||
|
|
||||||
float[] dustColour = getBlendedDustColour(tileEntityCalcinator.leftStackSize, tileEntityCalcinator.leftStackMeta, tileEntityCalcinator.rightStackSize, tileEntityCalcinator.rightStackMeta);
|
float[] dustColour = getBlendedDustColour(
|
||||||
|
tileEntityCalcinator.leftStackSize,
|
||||||
|
tileEntityCalcinator.leftStackMeta,
|
||||||
|
tileEntityCalcinator.rightStackSize,
|
||||||
|
tileEntityCalcinator.rightStackMeta
|
||||||
|
);
|
||||||
|
|
||||||
GL11.glColor4f(dustColour[0], dustColour[1], dustColour[2], 1F);
|
GL11.glColor4f(dustColour[0], dustColour[1], dustColour[2], 1F);
|
||||||
|
|
||||||
if (dustStackSize <= 32)
|
if (dustStackSize <= 32) {
|
||||||
{
|
|
||||||
GL11.glScalef(0.25F, 0.25F, 0.25F);
|
GL11.glScalef(0.25F, 0.25F, 0.25F);
|
||||||
GL11.glTranslatef(0.0F, 2.20F, -2.1125F);
|
GL11.glTranslatef(0.0F, 2.20F, -2.1125F);
|
||||||
}
|
} else if (dustStackSize <= 64) {
|
||||||
else if (dustStackSize <= 64)
|
|
||||||
{
|
|
||||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||||
GL11.glTranslatef(-0.0125F, 0.75F, -0.7125F);
|
GL11.glTranslatef(-0.0125F, 0.75F, -0.7125F);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,19 +16,14 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class TileEntityRendererGlassBell extends TileEntitySpecialRenderer
|
public class TileEntityRendererGlassBell extends TileEntitySpecialRenderer {
|
||||||
{
|
|
||||||
private final ModelGlassBell modelGlassBell = new ModelGlassBell();
|
private final ModelGlassBell modelGlassBell = new ModelGlassBell();
|
||||||
private final RenderItem customRenderItem;
|
private final RenderItem customRenderItem;
|
||||||
|
|
||||||
public TileEntityRendererGlassBell()
|
public TileEntityRendererGlassBell() {
|
||||||
{
|
customRenderItem = new RenderItem() {
|
||||||
customRenderItem = new RenderItem()
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldBob()
|
public boolean shouldBob() {
|
||||||
{
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -37,10 +32,9 @@ public class TileEntityRendererGlassBell extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
public void
|
||||||
{
|
renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
|
||||||
if (tileEntity instanceof TileEntityGlassBell)
|
if (tileEntity instanceof TileEntityGlassBell) {
|
||||||
{
|
|
||||||
TileEntityGlassBell tileEntityGlassBell = (TileEntityGlassBell) tileEntity;
|
TileEntityGlassBell tileEntityGlassBell = (TileEntityGlassBell) tileEntity;
|
||||||
|
|
||||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
@ -65,17 +59,26 @@ public class TileEntityRendererGlassBell extends TileEntitySpecialRenderer
|
||||||
*/
|
*/
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
if (tileEntityGlassBell.outputItemStack != null)
|
if (tileEntityGlassBell.outputItemStack != null) {
|
||||||
{
|
// TODO Stop the ghost item rendering in the event that the client's game
|
||||||
// TODO Stop the ghost item rendering in the event that the client's game is paused
|
// is paused
|
||||||
float scaleFactor = getGhostItemScaleFactor(tileEntityGlassBell.outputItemStack);
|
float scaleFactor
|
||||||
float rotationAngle = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
|
= getGhostItemScaleFactor(tileEntityGlassBell.outputItemStack);
|
||||||
|
float rotationAngle
|
||||||
|
= (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
|
||||||
|
|
||||||
EntityItem ghostEntityItem = new EntityItem(tileEntityGlassBell.getWorldObj());
|
EntityItem ghostEntityItem
|
||||||
|
= new EntityItem(tileEntityGlassBell.getWorldObj());
|
||||||
ghostEntityItem.hoverStart = 0.0F;
|
ghostEntityItem.hoverStart = 0.0F;
|
||||||
ghostEntityItem.setEntityItemStack(tileEntityGlassBell.outputItemStack);
|
ghostEntityItem.setEntityItemStack(tileEntityGlassBell.outputItemStack);
|
||||||
|
|
||||||
translateGhostItemByOrientation(ghostEntityItem.getEntityItem(), x, y, z, tileEntityGlassBell.getOrientation());
|
translateGhostItemByOrientation(
|
||||||
|
ghostEntityItem.getEntityItem(),
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
z,
|
||||||
|
tileEntityGlassBell.getOrientation()
|
||||||
|
);
|
||||||
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
GL11.glScalef(scaleFactor, scaleFactor, scaleFactor);
|
||||||
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
|
GL11.glRotatef(rotationAngle, 0.0F, 1.0F, 0.0F);
|
||||||
|
|
||||||
|
@ -88,184 +91,172 @@ public class TileEntityRendererGlassBell extends TileEntitySpecialRenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderGlassBellByOrientation(double x, double y, double z, ForgeDirection forgeDirection)
|
private void renderGlassBellByOrientation(
|
||||||
{
|
double x, double y, double z, ForgeDirection forgeDirection
|
||||||
switch (forgeDirection)
|
) {
|
||||||
{
|
switch (forgeDirection) {
|
||||||
case DOWN:
|
case DOWN: {
|
||||||
{
|
|
||||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||||
GL11.glTranslatef((float) x + 0.0F, (float) y + 2.0F, (float) z + 0.0F);
|
GL11.glTranslatef((float) x + 0.0F, (float) y + 2.0F, (float) z + 0.0F);
|
||||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case UP:
|
case UP: {
|
||||||
{
|
|
||||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||||
GL11.glTranslatef((float) x + 0.0F, (float) y + -1.0F, (float) z + 1.0F);
|
GL11.glTranslatef((float) x + 0.0F, (float) y + -1.0F, (float) z + 1.0F);
|
||||||
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case NORTH:
|
case NORTH: {
|
||||||
{
|
|
||||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||||
GL11.glTranslatef((float) x + 1.0F, (float) y + 0.0F, (float) z + 2.0F);
|
GL11.glTranslatef((float) x + 1.0F, (float) y + 0.0F, (float) z + 2.0F);
|
||||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case SOUTH:
|
case SOUTH: {
|
||||||
{
|
|
||||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||||
GL11.glTranslatef((float) x + 0.0F, (float) y + 0.0F, (float) z + -1.0F);
|
GL11.glTranslatef((float) x + 0.0F, (float) y + 0.0F, (float) z + -1.0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case EAST:
|
case EAST: {
|
||||||
{
|
|
||||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||||
GL11.glTranslatef((float) x + -1.0F, (float) y + 1.0F, (float) z + 1.0F);
|
GL11.glTranslatef((float) x + -1.0F, (float) y + 1.0F, (float) z + 1.0F);
|
||||||
GL11.glRotatef(-90F, 0F, 0F, 1F);
|
GL11.glRotatef(-90F, 0F, 0F, 1F);
|
||||||
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case WEST:
|
case WEST: {
|
||||||
{
|
|
||||||
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
GL11.glScalef(1.0F, 1.0F, 1.0F);
|
||||||
GL11.glTranslatef((float) x + 2.0F, (float) y + 0.0F, (float) z + 1.0F);
|
GL11.glTranslatef((float) x + 2.0F, (float) y + 0.0F, (float) z + 1.0F);
|
||||||
GL11.glRotatef(90F, 0F, 0F, 1F);
|
GL11.glRotatef(90F, 0F, 0F, 1F);
|
||||||
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
GL11.glRotatef(-90F, 1F, 0F, 0F);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case UNKNOWN:
|
case UNKNOWN: {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void translateGhostItemByOrientation(ItemStack ghostItemStack, double x, double y, double z, ForgeDirection forgeDirection)
|
private void translateGhostItemByOrientation(
|
||||||
{
|
ItemStack ghostItemStack,
|
||||||
if (ghostItemStack != null)
|
double x,
|
||||||
{
|
double y,
|
||||||
if (ghostItemStack.getItem() instanceof ItemBlock)
|
double z,
|
||||||
{
|
ForgeDirection forgeDirection
|
||||||
switch (forgeDirection)
|
) {
|
||||||
{
|
if (ghostItemStack != null) {
|
||||||
case DOWN:
|
if (ghostItemStack.getItem() instanceof ItemBlock) {
|
||||||
{
|
switch (forgeDirection) {
|
||||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.7F, (float) z + 0.5F);
|
case DOWN: {
|
||||||
|
GL11.glTranslatef(
|
||||||
|
(float) x + 0.5F, (float) y + 0.7F, (float) z + 0.5F
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case UP:
|
case UP: {
|
||||||
{
|
GL11.glTranslatef(
|
||||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F);
|
(float) x + 0.5F, (float) y + 0.25F, (float) z + 0.5F
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case NORTH:
|
case NORTH: {
|
||||||
{
|
GL11.glTranslatef(
|
||||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F);
|
(float) x + 0.5F, (float) y + 0.5F, (float) z + 0.7F
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case SOUTH:
|
case SOUTH: {
|
||||||
{
|
GL11.glTranslatef(
|
||||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F);
|
(float) x + 0.5F, (float) y + 0.5F, (float) z + 0.3F
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case EAST:
|
case EAST: {
|
||||||
{
|
GL11.glTranslatef(
|
||||||
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F);
|
(float) x + 0.3F, (float) y + 0.5F, (float) z + 0.5F
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case WEST:
|
case WEST: {
|
||||||
{
|
GL11.glTranslatef(
|
||||||
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F);
|
(float) x + 0.70F, (float) y + 0.5F, (float) z + 0.5F
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case UNKNOWN:
|
case UNKNOWN: {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
switch (forgeDirection) {
|
||||||
{
|
case DOWN: {
|
||||||
switch (forgeDirection)
|
GL11.glTranslatef(
|
||||||
{
|
(float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F
|
||||||
case DOWN:
|
);
|
||||||
{
|
|
||||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.6F, (float) z + 0.5F);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case UP:
|
case UP: {
|
||||||
{
|
GL11.glTranslatef(
|
||||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F);
|
(float) x + 0.5F, (float) y + 0.20F, (float) z + 0.5F
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case NORTH:
|
case NORTH: {
|
||||||
{
|
GL11.glTranslatef(
|
||||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F);
|
(float) x + 0.5F, (float) y + 0.4F, (float) z + 0.7F
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case SOUTH:
|
case SOUTH: {
|
||||||
{
|
GL11.glTranslatef(
|
||||||
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F);
|
(float) x + 0.5F, (float) y + 0.4F, (float) z + 0.3F
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case EAST:
|
case EAST: {
|
||||||
{
|
GL11.glTranslatef(
|
||||||
GL11.glTranslatef((float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F);
|
(float) x + 0.3F, (float) y + 0.4F, (float) z + 0.5F
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case WEST:
|
case WEST: {
|
||||||
{
|
GL11.glTranslatef(
|
||||||
GL11.glTranslatef((float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F);
|
(float) x + 0.70F, (float) y + 0.4F, (float) z + 0.5F
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case UNKNOWN:
|
case UNKNOWN: {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getGhostItemScaleFactor(ItemStack itemStack)
|
private float getGhostItemScaleFactor(ItemStack itemStack) {
|
||||||
{
|
|
||||||
float scaleFactor = 1.0F;
|
float scaleFactor = 1.0F;
|
||||||
|
|
||||||
if (itemStack != null)
|
if (itemStack != null) {
|
||||||
{
|
|
||||||
byte numBlocks = 1;
|
byte numBlocks = 1;
|
||||||
if (itemStack.stackSize > 1)
|
if (itemStack.stackSize > 1) {
|
||||||
{
|
|
||||||
numBlocks = 2;
|
numBlocks = 2;
|
||||||
}
|
} else if (itemStack.stackSize > 5) {
|
||||||
else if (itemStack.stackSize > 5)
|
|
||||||
{
|
|
||||||
numBlocks = 3;
|
numBlocks = 3;
|
||||||
}
|
} else if (itemStack.stackSize > 20) {
|
||||||
else if (itemStack.stackSize > 20)
|
|
||||||
{
|
|
||||||
numBlocks = 4;
|
numBlocks = 4;
|
||||||
}
|
} else if (itemStack.stackSize > 40) {
|
||||||
else if (itemStack.stackSize > 40)
|
|
||||||
{
|
|
||||||
numBlocks = 5;
|
numBlocks = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemStack.getItem() instanceof ItemBlock)
|
if (itemStack.getItem() instanceof ItemBlock) {
|
||||||
{
|
switch (numBlocks) {
|
||||||
switch (numBlocks)
|
|
||||||
{
|
|
||||||
case 1:
|
case 1:
|
||||||
return 0.90F;
|
return 0.90F;
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -279,11 +270,8 @@ public class TileEntityRendererGlassBell extends TileEntitySpecialRenderer
|
||||||
default:
|
default:
|
||||||
return 0.90F;
|
return 0.90F;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
switch (numBlocks) {
|
||||||
{
|
|
||||||
switch (numBlocks)
|
|
||||||
{
|
|
||||||
case 1:
|
case 1:
|
||||||
return 0.65F;
|
return 0.65F;
|
||||||
case 2:
|
case 2:
|
||||||
|
|
|
@ -15,32 +15,27 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class TileEntityRendererResearchStation extends TileEntitySpecialRenderer
|
public class TileEntityRendererResearchStation extends TileEntitySpecialRenderer {
|
||||||
{
|
|
||||||
private final ModelResearchStation modelResearchStation = new ModelResearchStation();
|
private final ModelResearchStation modelResearchStation = new ModelResearchStation();
|
||||||
private final RenderItem customRenderItem;
|
private final RenderItem customRenderItem;
|
||||||
|
|
||||||
public TileEntityRendererResearchStation()
|
|
||||||
{
|
|
||||||
customRenderItem = new RenderItem()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public boolean shouldBob()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
public TileEntityRendererResearchStation() {
|
||||||
|
customRenderItem = new RenderItem() {
|
||||||
|
@Override
|
||||||
|
public boolean shouldBob() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
customRenderItem.setRenderManager(RenderManager.instance);
|
customRenderItem.setRenderManager(RenderManager.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
public void
|
||||||
{
|
renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
|
||||||
if (tileEntity instanceof TileEntityResearchStation)
|
if (tileEntity instanceof TileEntityResearchStation) {
|
||||||
{
|
TileEntityResearchStation tileEntityResearchStation
|
||||||
TileEntityResearchStation tileEntityResearchStation = (TileEntityResearchStation) tileEntity;
|
= (TileEntityResearchStation) tileEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the Research Station
|
* Render the Research Station
|
||||||
|
@ -58,19 +53,22 @@ public class TileEntityRendererResearchStation extends TileEntitySpecialRenderer
|
||||||
modelResearchStation.render();
|
modelResearchStation.render();
|
||||||
|
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the Tome of Alchemical Knowledge
|
* Render the Tome of Alchemical Knowledge
|
||||||
*/
|
*/
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
ItemStack alchenomicon = tileEntityResearchStation.getStackInSlot(TileEntityResearchStation.ALCHENOMICON_SLOT_INVENTORY_INDEX);
|
ItemStack alchenomicon = tileEntityResearchStation.getStackInSlot(
|
||||||
if (Minecraft.getMinecraft().gameSettings.fancyGraphics && alchenomicon != null)
|
TileEntityResearchStation.ALCHENOMICON_SLOT_INVENTORY_INDEX
|
||||||
{
|
);
|
||||||
EntityItem ghostEntityItem = new EntityItem(tileEntityResearchStation.getWorldObj());
|
if (Minecraft.getMinecraft().gameSettings.fancyGraphics
|
||||||
|
&& alchenomicon != null) {
|
||||||
|
EntityItem ghostEntityItem
|
||||||
|
= new EntityItem(tileEntityResearchStation.getWorldObj());
|
||||||
ghostEntityItem.hoverStart = 0.0F;
|
ghostEntityItem.hoverStart = 0.0F;
|
||||||
ghostEntityItem.setEntityItemStack(alchenomicon);
|
ghostEntityItem.setEntityItemStack(alchenomicon);
|
||||||
|
|
||||||
GL11.glTranslated(x + 0.6F, y + 1.015625F, z + 0.35F);
|
GL11.glTranslated(x + 0.6F, y + 1.015625F, z + 0.35F);
|
||||||
GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
|
GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
|
||||||
GL11.glRotatef(45F, 0.0F, 0.0F, 1.0F);
|
GL11.glRotatef(45F, 0.0F, 0.0F, 1.0F);
|
||||||
|
|
|
@ -13,16 +13,16 @@ import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.opengl.GL12;
|
import org.lwjgl.opengl.GL12;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class TileEntityRendererTransmutationTablet extends TileEntitySpecialRenderer
|
public class TileEntityRendererTransmutationTablet extends TileEntitySpecialRenderer {
|
||||||
{
|
private final ModelTransmutationTablet modelTransmutationTablet
|
||||||
private final ModelTransmutationTablet modelTransmutationTablet = new ModelTransmutationTablet();
|
= new ModelTransmutationTablet();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
public void
|
||||||
{
|
renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
|
||||||
if (tileEntity instanceof TileEntityTransmutationTablet)
|
if (tileEntity instanceof TileEntityTransmutationTablet) {
|
||||||
{
|
TileEntityTransmutationTablet tileEntityTransmutationTablet
|
||||||
TileEntityTransmutationTablet tileEntityTransmutationTablet = (TileEntityTransmutationTablet) tileEntity;
|
= (TileEntityTransmutationTablet) tileEntity;
|
||||||
|
|
||||||
this.bindTexture(Textures.Model.TRANSMUTATION_TABLET);
|
this.bindTexture(Textures.Model.TRANSMUTATION_TABLET);
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
@ -30,30 +30,21 @@ public class TileEntityRendererTransmutationTablet extends TileEntitySpecialRend
|
||||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||||
GL11.glTranslatef(0.5F, -0.375F, 0.5F);
|
GL11.glTranslatef(0.5F, -0.375F, 0.5F);
|
||||||
modelTransmutationTablet.renderBase(0.0625f);
|
modelTransmutationTablet.renderBase(0.0625f);
|
||||||
if (tileEntityTransmutationTablet.isStructureValid())
|
if (tileEntityTransmutationTablet.isStructureValid()) {
|
||||||
{
|
|
||||||
modelTransmutationTablet.renderTransmutationPad(0.0625f);
|
modelTransmutationTablet.renderTransmutationPad(0.0625f);
|
||||||
}
|
}
|
||||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
if (tileEntityTransmutationTablet.isStructureValid())
|
if (tileEntityTransmutationTablet.isStructureValid()) {
|
||||||
{
|
|
||||||
int rotationAngle = 0;
|
int rotationAngle = 0;
|
||||||
if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.NORTH)
|
if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.NORTH) {
|
||||||
{
|
|
||||||
rotationAngle = 0;
|
rotationAngle = 0;
|
||||||
}
|
} else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.EAST) {
|
||||||
else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.EAST)
|
|
||||||
{
|
|
||||||
rotationAngle = -90;
|
rotationAngle = -90;
|
||||||
}
|
} else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.SOUTH) {
|
||||||
else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.SOUTH)
|
|
||||||
{
|
|
||||||
rotationAngle = 180;
|
rotationAngle = 180;
|
||||||
}
|
} else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.WEST) {
|
||||||
else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.WEST)
|
|
||||||
{
|
|
||||||
rotationAngle = 90;
|
rotationAngle = 90;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +56,12 @@ public class TileEntityRendererTransmutationTablet extends TileEntitySpecialRend
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslated(x + 0.5d, y + 0.63d, z + 0.5d);
|
GL11.glTranslated(x + 0.5d, y + 0.63d, z + 0.5d);
|
||||||
GL11.glScalef(2f, 2f, 2f);
|
GL11.glScalef(2f, 2f, 2f);
|
||||||
GL11.glRotatef(rotationAngle, tileEntityTransmutationTablet.getOrientation().offsetX, tileEntityTransmutationTablet.getOrientation().offsetY, tileEntityTransmutationTablet.getOrientation().offsetZ);
|
GL11.glRotatef(
|
||||||
|
rotationAngle,
|
||||||
|
tileEntityTransmutationTablet.getOrientation().offsetX,
|
||||||
|
tileEntityTransmutationTablet.getOrientation().offsetY,
|
||||||
|
tileEntityTransmutationTablet.getOrientation().offsetZ
|
||||||
|
);
|
||||||
GL11.glRotatef(90, -1, 0, 0);
|
GL11.glRotatef(90, -1, 0, 0);
|
||||||
RenderUtils.renderQuad(Textures.AlchemyArray.TRANSMUTATION_ALCHEMY_ARRAY);
|
RenderUtils.renderQuad(Textures.AlchemyArray.TRANSMUTATION_ALCHEMY_ARRAY);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
|
@ -7,10 +7,13 @@ import net.minecraft.client.settings.KeyBinding;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class Keybindings
|
public class Keybindings {
|
||||||
{
|
public static KeyBinding charge
|
||||||
public static KeyBinding charge = new KeyBinding(Names.Keys.CHARGE, Keyboard.KEY_V, Names.Keys.CATEGORY);
|
= new KeyBinding(Names.Keys.CHARGE, Keyboard.KEY_V, Names.Keys.CATEGORY);
|
||||||
public static KeyBinding extra = new KeyBinding(Names.Keys.EXTRA, Keyboard.KEY_C, Names.Keys.CATEGORY);
|
public static KeyBinding extra
|
||||||
public static KeyBinding release = new KeyBinding(Names.Keys.RELEASE, Keyboard.KEY_R, Names.Keys.CATEGORY);
|
= new KeyBinding(Names.Keys.EXTRA, Keyboard.KEY_C, Names.Keys.CATEGORY);
|
||||||
public static KeyBinding toggle = new KeyBinding(Names.Keys.TOGGLE, Keyboard.KEY_G, Names.Keys.CATEGORY);
|
public static KeyBinding release
|
||||||
|
= new KeyBinding(Names.Keys.RELEASE, Keyboard.KEY_R, Names.Keys.CATEGORY);
|
||||||
|
public static KeyBinding toggle
|
||||||
|
= new KeyBinding(Names.Keys.TOGGLE, Keyboard.KEY_G, Names.Keys.CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,18 @@ package com.pahimar.ee3.client.util;
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
|
|
||||||
public class ClientParticleHelper
|
public class ClientParticleHelper {
|
||||||
{
|
public static void spawnParticleAtLocation(
|
||||||
public static void spawnParticleAtLocation(String particleName, double xCoord, double yCoord, double zCoord, double xVelocity, double yVelocity, double zVelocity)
|
String particleName,
|
||||||
{
|
double xCoord,
|
||||||
FMLClientHandler.instance().getWorldClient().spawnParticle(particleName, xCoord, yCoord, zCoord, xVelocity, yVelocity, zVelocity);
|
double yCoord,
|
||||||
|
double zCoord,
|
||||||
|
double xVelocity,
|
||||||
|
double yVelocity,
|
||||||
|
double zVelocity
|
||||||
|
) {
|
||||||
|
FMLClientHandler.instance().getWorldClient().spawnParticle(
|
||||||
|
particleName, xCoord, yCoord, zCoord, xVelocity, yVelocity, zVelocity
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,24 @@ import com.pahimar.ee3.util.ResourceLocationHelper;
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
import cpw.mods.fml.client.FMLClientHandler;
|
||||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
|
|
||||||
public class ClientSoundHelper
|
public class ClientSoundHelper {
|
||||||
{
|
public static void playSound(
|
||||||
public static void playSound(String soundName, float xCoord, float yCoord, float zCoord, float volume, float pitch)
|
String soundName,
|
||||||
{
|
float xCoord,
|
||||||
FMLClientHandler.instance().getClient().getSoundHandler().playSound(new PositionedSoundRecord(ResourceLocationHelper.getResourceLocation(soundName), volume, pitch, xCoord, yCoord, zCoord));
|
float yCoord,
|
||||||
|
float zCoord,
|
||||||
|
float volume,
|
||||||
|
float pitch
|
||||||
|
) {
|
||||||
|
FMLClientHandler.instance().getClient().getSoundHandler().playSound(
|
||||||
|
new PositionedSoundRecord(
|
||||||
|
ResourceLocationHelper.getResourceLocation(soundName),
|
||||||
|
volume,
|
||||||
|
pitch,
|
||||||
|
xCoord,
|
||||||
|
yCoord,
|
||||||
|
zCoord
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package com.pahimar.ee3.client.util;
|
package com.pahimar.ee3.client.util;
|
||||||
|
|
||||||
public class ColorUtils
|
public class ColorUtils {
|
||||||
{
|
public static byte[] convertIntColourToByteArray(int intColour) {
|
||||||
public static byte[] convertIntColourToByteArray(int intColour)
|
|
||||||
{
|
|
||||||
byte[] colourByteArray = new byte[3];
|
byte[] colourByteArray = new byte[3];
|
||||||
|
|
||||||
colourByteArray[0] = (byte) (intColour >> 16 & 255);
|
colourByteArray[0] = (byte) (intColour >> 16 & 255);
|
||||||
|
@ -13,8 +11,7 @@ public class ColorUtils
|
||||||
return colourByteArray;
|
return colourByteArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float[] convertIntColourToFloatArray(int intColour)
|
public static float[] convertIntColourToFloatArray(int intColour) {
|
||||||
{
|
|
||||||
float[] colourFloatArray = new float[3];
|
float[] colourFloatArray = new float[3];
|
||||||
|
|
||||||
colourFloatArray[0] = ((intColour >> 16 & 0xFF) / 255F);
|
colourFloatArray[0] = ((intColour >> 16 & 0xFF) / 255F);
|
||||||
|
@ -24,19 +21,21 @@ public class ColorUtils
|
||||||
return colourFloatArray;
|
return colourFloatArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[][] getByteBlendedColours(byte[] firstColour, byte[] secondColour, int steps)
|
public static byte[][] getByteBlendedColours(
|
||||||
{
|
byte[] firstColour, byte[] secondColour, int steps
|
||||||
if (firstColour.length == 3 && secondColour.length == 3 && steps > 0)
|
) {
|
||||||
{
|
if (firstColour.length == 3 && secondColour.length == 3 && steps > 0) {
|
||||||
byte[][] blendedColours = new byte[steps + 2][3];
|
byte[][] blendedColours = new byte[steps + 2][3];
|
||||||
|
|
||||||
byte redDifference = (byte) (((secondColour[0] & 0xFF) - (firstColour[0] & 0xFF)) / steps);
|
byte redDifference
|
||||||
byte greenDifference = (byte) (((secondColour[1] & 0xFF) - (firstColour[1] & 0xFF)) / steps);
|
= (byte) (((secondColour[0] & 0xFF) - (firstColour[0] & 0xFF)) / steps);
|
||||||
byte blueDifference = (byte) (((secondColour[2] & 0xFF) - (firstColour[2] & 0xFF)) / steps);
|
byte greenDifference
|
||||||
|
= (byte) (((secondColour[1] & 0xFF) - (firstColour[1] & 0xFF)) / steps);
|
||||||
|
byte blueDifference
|
||||||
|
= (byte) (((secondColour[2] & 0xFF) - (firstColour[2] & 0xFF)) / steps);
|
||||||
|
|
||||||
blendedColours[0] = firstColour;
|
blendedColours[0] = firstColour;
|
||||||
for (int i = 1; i < blendedColours.length - 1; i++)
|
for (int i = 1; i < blendedColours.length - 1; i++) {
|
||||||
{
|
|
||||||
blendedColours[i][0] = (byte) (firstColour[0] + i * redDifference);
|
blendedColours[i][0] = (byte) (firstColour[0] + i * redDifference);
|
||||||
blendedColours[i][1] = (byte) (firstColour[1] + i * greenDifference);
|
blendedColours[i][1] = (byte) (firstColour[1] + i * greenDifference);
|
||||||
blendedColours[i][2] = (byte) (firstColour[2] + i * blueDifference);
|
blendedColours[i][2] = (byte) (firstColour[2] + i * blueDifference);
|
||||||
|
@ -49,40 +48,38 @@ public class ColorUtils
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float[][] getFloatBlendedColours(byte[] firstColour, byte[] secondColour, int steps)
|
public static float[][] getFloatBlendedColours(
|
||||||
{
|
byte[] firstColour, byte[] secondColour, int steps
|
||||||
byte[][] byteBlendedColours = getByteBlendedColours(firstColour, secondColour, steps);
|
) {
|
||||||
|
byte[][] byteBlendedColours
|
||||||
|
= getByteBlendedColours(firstColour, secondColour, steps);
|
||||||
|
|
||||||
if (byteBlendedColours != null)
|
if (byteBlendedColours != null) {
|
||||||
{
|
|
||||||
float[][] floatBlendedColours = new float[byteBlendedColours.length][3];
|
float[][] floatBlendedColours = new float[byteBlendedColours.length][3];
|
||||||
|
|
||||||
for (int i = 0; i < byteBlendedColours.length; i++)
|
for (int i = 0; i < byteBlendedColours.length; i++) {
|
||||||
{
|
|
||||||
floatBlendedColours[i][0] = (byteBlendedColours[i][0] & 0xFF) / 255F;
|
floatBlendedColours[i][0] = (byteBlendedColours[i][0] & 0xFF) / 255F;
|
||||||
floatBlendedColours[i][1] = (byteBlendedColours[i][1] & 0xFF) / 255F;
|
floatBlendedColours[i][1] = (byteBlendedColours[i][1] & 0xFF) / 255F;
|
||||||
floatBlendedColours[i][2] = (byteBlendedColours[i][2] & 0xFF) / 255F;
|
floatBlendedColours[i][2] = (byteBlendedColours[i][2] & 0xFF) / 255F;
|
||||||
}
|
}
|
||||||
|
|
||||||
return floatBlendedColours;
|
return floatBlendedColours;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float[][] getFloatBlendedColours(int firstColour, int secondColour, int steps)
|
public static float[][] getFloatBlendedColours(
|
||||||
{
|
int firstColour, int secondColour, int steps
|
||||||
|
) {
|
||||||
byte[] firstColourByteArray = convertIntColourToByteArray(firstColour);
|
byte[] firstColourByteArray = convertIntColourToByteArray(firstColour);
|
||||||
byte[] secondColourByteArray = convertIntColourToByteArray(secondColour);
|
byte[] secondColourByteArray = convertIntColourToByteArray(secondColour);
|
||||||
|
|
||||||
if (firstColourByteArray != null && secondColourByteArray != null)
|
if (firstColourByteArray != null && secondColourByteArray != null) {
|
||||||
{
|
return getFloatBlendedColours(
|
||||||
return getFloatBlendedColours(firstColourByteArray, secondColourByteArray, steps);
|
firstColourByteArray, secondColourByteArray, steps
|
||||||
}
|
);
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,20 +11,29 @@ import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.opengl.GL12;
|
import org.lwjgl.opengl.GL12;
|
||||||
|
|
||||||
public class RenderUtils {
|
public class RenderUtils {
|
||||||
|
|
||||||
public static void bindTexture(ResourceLocation texture) {
|
public static void bindTexture(ResourceLocation texture) {
|
||||||
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(texture);
|
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getCenteredTextOffset(FontRenderer fontRenderer, String string, int width) {
|
public static int
|
||||||
|
getCenteredTextOffset(FontRenderer fontRenderer, String string, int width) {
|
||||||
return (width - fontRenderer.getStringWidth(string)) / 2;
|
return (width - fontRenderer.getStringWidth(string)) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderItemIntoGUI(FontRenderer fontRenderer, ItemStack itemStack, int x, int y, float opacity, float scale, int zLevel) {
|
public static void renderItemIntoGUI(
|
||||||
|
FontRenderer fontRenderer,
|
||||||
|
ItemStack itemStack,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
float opacity,
|
||||||
|
float scale,
|
||||||
|
int zLevel
|
||||||
|
) {
|
||||||
IIcon icon = itemStack.getIconIndex();
|
IIcon icon = itemStack.getIconIndex();
|
||||||
GL11.glDisable(GL11.GL_LIGHTING);
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TextureMap.locationItemsTexture);
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(
|
||||||
|
TextureMap.locationItemsTexture
|
||||||
|
);
|
||||||
int overlayColour = itemStack.getItem().getColorFromItemStack(itemStack, 0);
|
int overlayColour = itemStack.getItem().getColorFromItemStack(itemStack, 0);
|
||||||
float red = (overlayColour >> 16 & 255) / 255.0F;
|
float red = (overlayColour >> 16 & 255) / 255.0F;
|
||||||
float green = (overlayColour >> 8 & 255) / 255.0F;
|
float green = (overlayColour >> 8 & 255) / 255.0F;
|
||||||
|
@ -32,16 +41,21 @@ public class RenderUtils {
|
||||||
GL11.glColor4f(red, green, blue, opacity);
|
GL11.glColor4f(red, green, blue, opacity);
|
||||||
Tessellator tessellator = Tessellator.instance;
|
Tessellator tessellator = Tessellator.instance;
|
||||||
tessellator.startDrawingQuads();
|
tessellator.startDrawingQuads();
|
||||||
tessellator.addVertexWithUV(x, y + 16 * scale, zLevel, icon.getMinU(), icon.getMaxV());
|
tessellator.addVertexWithUV(
|
||||||
tessellator.addVertexWithUV(x + 16 * scale, y + 16 * scale, zLevel, icon.getMaxU(), icon.getMaxV());
|
x, y + 16 * scale, zLevel, icon.getMinU(), icon.getMaxV()
|
||||||
tessellator.addVertexWithUV(x + 16 * scale, y, zLevel, icon.getMaxU(), icon.getMinV());
|
);
|
||||||
|
tessellator.addVertexWithUV(
|
||||||
|
x + 16 * scale, y + 16 * scale, zLevel, icon.getMaxU(), icon.getMaxV()
|
||||||
|
);
|
||||||
|
tessellator.addVertexWithUV(
|
||||||
|
x + 16 * scale, y, zLevel, icon.getMaxU(), icon.getMinV()
|
||||||
|
);
|
||||||
tessellator.addVertexWithUV(x, y, zLevel, icon.getMinU(), icon.getMinV());
|
tessellator.addVertexWithUV(x, y, zLevel, icon.getMinU(), icon.getMinV());
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderQuad(ResourceLocation texture) {
|
public static void renderQuad(ResourceLocation texture) {
|
||||||
|
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
|
||||||
Tessellator tessellator = Tessellator.instance;
|
Tessellator tessellator = Tessellator.instance;
|
||||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||||
|
@ -58,8 +72,8 @@ public class RenderUtils {
|
||||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void renderPulsingQuad(ResourceLocation texture, float maxTransparency) {
|
public static void
|
||||||
|
renderPulsingQuad(ResourceLocation texture, float maxTransparency) {
|
||||||
float pulseTransparency = (float) getPulseValue() * maxTransparency;
|
float pulseTransparency = (float) getPulseValue() * maxTransparency;
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture);
|
||||||
Tessellator tessellator = Tessellator.instance;
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.pahimar.ee3.command;
|
package com.pahimar.ee3.command;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
import com.pahimar.ee3.reference.Messages;
|
import com.pahimar.ee3.reference.Messages;
|
||||||
import com.pahimar.ee3.reference.Names;
|
import com.pahimar.ee3.reference.Names;
|
||||||
|
@ -7,11 +10,7 @@ import net.minecraft.command.CommandBase;
|
||||||
import net.minecraft.command.ICommandSender;
|
import net.minecraft.command.ICommandSender;
|
||||||
import net.minecraft.command.WrongUsageException;
|
import net.minecraft.command.WrongUsageException;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CommandEE extends CommandBase {
|
public class CommandEE extends CommandBase {
|
||||||
|
|
||||||
private static List<CommandBase> modCommands = new ArrayList<>();
|
private static List<CommandBase> modCommands = new ArrayList<>();
|
||||||
private static List<String> commands = new ArrayList<>();
|
private static List<String> commands = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -27,14 +26,12 @@ public class CommandEE extends CommandBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processCommand(ICommandSender commandSender, String[] args) {
|
public void processCommand(ICommandSender commandSender, String[] args) {
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
||||||
if (args.length >= 1) {
|
if (args.length >= 1) {
|
||||||
|
|
||||||
for (CommandBase command : modCommands) {
|
for (CommandBase command : modCommands) {
|
||||||
|
if (command.getCommandName().equalsIgnoreCase(args[0])
|
||||||
if (command.getCommandName().equalsIgnoreCase(args[0]) && command.canCommandSenderUseCommand(commandSender)) {
|
&& command.canCommandSenderUseCommand(commandSender)) {
|
||||||
found = true;
|
found = true;
|
||||||
command.processCommand(commandSender, args);
|
command.processCommand(commandSender, args);
|
||||||
}
|
}
|
||||||
|
@ -42,17 +39,17 @@ public class CommandEE extends CommandBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
throw new WrongUsageException("Invalid command. Usage: /ee3 " + Joiner.on(" ").join(commands));
|
throw new WrongUsageException(
|
||||||
|
"Invalid command. Usage: /ee3 " + Joiner.on(" ").join(commands)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List addTabCompletionOptions(ICommandSender commandSender, String[] args) {
|
public List addTabCompletionOptions(ICommandSender commandSender, String[] args) {
|
||||||
|
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
return getListOfStringsFromIterableMatchingLastWord(args, commands);
|
return getListOfStringsFromIterableMatchingLastWord(args, commands);
|
||||||
}
|
} else if (args.length >= 2) {
|
||||||
else if (args.length >= 2) {
|
|
||||||
for (CommandBase command : modCommands) {
|
for (CommandBase command : modCommands) {
|
||||||
if (command.getCommandName().equalsIgnoreCase(args[0])) {
|
if (command.getCommandName().equalsIgnoreCase(args[0])) {
|
||||||
return command.addTabCompletionOptions(commandSender, args);
|
return command.addTabCompletionOptions(commandSender, args);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue