Compare commits

...

18 Commits

Author SHA1 Message Date
yueh 1cde7bc933 Changed to Null ItemStack instead of null. 2016-12-21 20:38:37 +01:00
yueh ed9e6dd21c Port to 1.11 2016-12-21 20:38:36 +01:00
yueh 589730bfad Fixes #2707: Calculuate the correct AABB for a rotated skychest. 2016-12-17 23:47:42 +01:00
yueh 8700a79ca6 Fixes #2684: Avoid transforming charged quartz when dead. 2016-12-17 23:04:35 +01:00
yueh a14cf2204d Fixes anchor rendering (#2698)
* Fixes #2680: Use a shorter cable anchor model when blocked by a facade.
* Fixes #2664: Prevent anchors from creating intersection.

Replaced the simple List<ResourceLocation> for the static models with a
new container also indicating a solid part, which can be used to prevent
the creation of an intersection.
2016-12-14 22:37:10 +01:00
yueh 8bed7f223e TheOneProbe integration (#2696)
Displayed information is equal to current the WAILA integration.

Added a preInit stage to IIntegrationModule.
Added a factory method to IntegrationType to avoid touching
IntegrationNode for every new integration.

Fixes #2650
2016-12-14 22:36:40 +01:00
yueh db85419702 Restructured registry packages (#2703)
Moved larger registries together with their related classes instead of putting unrelated classes into the same package.
2016-12-14 22:35:52 +01:00
yueh fb79fd284d Replaced Watcher using Collection with a more fitting interface (#2693)
Replaced the watchers for energy, storage and crafting with a more fitting interface compared to a common collection.

Fixes #229
2016-12-14 18:30:49 +01:00
yueh e3305c1963 Update Forge to latest RB
Updated JEI
2016-12-14 17:46:16 +01:00
yueh a3c85b4a59 Fixes #2699: Do not trust the stackSize in case of internal changes.
An external inventory might change the stacksize of the slot we currently
are extracting from. Thus we have to cache the initial stackSize for a later
calculation of the extracted amount per slot.
As other inventories might NOT change the stacksize after a modification,
we can not use the stack reaching 0 as conditions to break.
2016-12-14 11:25:49 +01:00
yueh a2b20f1d67 Fixes #2689: Do not pass our own blockstate to the adjacent block. 2016-12-08 21:29:46 +01:00
yueh 86908b1ae6 Fixes #2647: Prevent crafting status from crashing due to missing network. 2016-12-08 13:07:25 +01:00
dshadowwolf 6bf52b0b0f Fixes constant reequip animation on portable cells/terminals (#2690)
Fix for portable cell and wireless terminal going into re-equip animations when GUI is open.
2016-12-08 12:34:41 +01:00
yueh eb1e86cacb Refactored GrinderRegistry. (#2644)
* Refactored GrinderRegistry.

Changed IGrinderRegistry#getRecipes to return an unmodifiable collection.
Added a way to remove recipes explicitly instead the internal list.
Added a cache to lookup recipes instead of iterating a list.

Renamed IGrinderEntry to IGrinderRecipe
Made IGrindRecipe immutable for easy caching.

Improved GrinderLogging and Exception Handling
JEI Workaround as it expects a List instead Collection.

* Added blacklist of explicit oredict names for the grindstone.

This can be used should the automatic recipe generation create unintended
loopholes.
2016-12-02 23:47:50 +01:00
yueh c405e725b2 Fixes #2667: Use new IC2 item names for P2P attunement. 2016-12-02 22:16:29 +01:00
yueh d377af9a69 Fixes #2675: Set fullBlock correctly afterwards.
Reduces the visibility of some methods as these should be access through the public methods of Block or the overridden ones.
Removes now useless getCheckedSubBlocks.
2016-12-02 22:15:56 +01:00
yueh 12dbd17320 Fixes #2666: Restore inventory after powerloss and still avoid dupes. 2016-12-01 16:17:46 +01:00
yueh 5028c8025b Fixes #2669: Missing particle texture for pylons. 2016-12-01 10:56:01 +01:00
359 changed files with 6853 additions and 5500 deletions
+7 -6
View File
@@ -1,4 +1,4 @@
aeversion=rv4
aeversion=rv5
aechannel=alpha
aebuild=0
aegroup=appeng
@@ -7,9 +7,9 @@ aebasename=appliedenergistics2
#########################################################
# Versions #
#########################################################
minecraft_version=1.10.2
mcp_mappings=snapshot_20161111
forge_version=12.18.2.2139
minecraft_version=1.11
mcp_mappings=snapshot_20161206
forge_version=13.19.1.2189
#########################################################
# Installable #
@@ -19,6 +19,7 @@ waila_version=1.7.0-B3_1.9.4
#########################################################
# Provided APIs #
#########################################################
jei_version=3.13.3.373
tesla_version=1.10.2-1.2.1.50
jei_version=4.0.4.199
tesla_version=1.11-1.3.0.51
ic2_version=2.6.99-ex110
top_version=1.11-1.3.3-46
+11 -4
View File
@@ -38,6 +38,11 @@ repositories {
name = "IC2 repo"
url = "http://maven.ic2.player.to"
}
maven { // TheOneProbe
name 'tterrag maven'
url "http://maven.tterrag.com/"
}
}
configurations {
@@ -46,14 +51,16 @@ configurations {
dependencies {
// installable runtime dependencies
mods "mcp.mobius.waila:Waila:${waila_version}"
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
//mods "mcp.mobius.waila:Waila:${waila_version}"
//mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
mods "mcjty.theoneprobe:TheOneProbe:${top_version}"
// compile against provided APIs
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
compileOnly "mcp.mobius.waila:Waila:${waila_version}"
//compileOnly "mcp.mobius.waila:Waila:${waila_version}"
compileOnly "net.darkhax.tesla:Tesla:${tesla_version}"
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
//compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
compileOnly "mcjty.theoneprobe:TheOneProbe:${top_version}:api"
// at runtime, use the full JEI jar
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
+13 -1
View File
@@ -31,7 +31,7 @@ task deinstallWaila(type: Delete) {
delete fileTree(dir: minecraft.runDir + "/mods", include: "*Waila*.jar")
}
// IC²
// IC2
task installIC2(type: Copy, dependsOn: "deinstallIC2") {
from { configurations.mods }
include "**/*industrialcraft-2*.jar"
@@ -41,3 +41,15 @@ task installIC2(type: Copy, dependsOn: "deinstallIC2") {
task deinstallIC2(type: Delete) {
delete fileTree(dir: minecraft.runDir + "/mods", include: "*industrialcraft-2*.jar")
}
// TOP
task installTop(type: Copy, dependsOn: "deinstallTop") {
from { configurations.mods }
include "**/*TheOneProbe*.jar"
into file(minecraft.runDir + "/mods")
}
task deinstallTop(type: Delete) {
delete fileTree(dir: minecraft.runDir + "/mods", include: "*TheOneProbe*.jar")
}
@@ -76,9 +76,9 @@ public interface IParts
IItemDefinition p2PTunnelItems();
IItemDefinition p2PTunnelLiquids();
//IItemDefinition p2PTunnelLiquids();
IItemDefinition p2PTunnelEU();
//IItemDefinition p2PTunnelEU();
// IItemDefinition p2PTunnelRF();
@@ -24,13 +24,17 @@
package appeng.api.features;
import java.util.Optional;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
/**
* Registration Records for {@link IGrinderRegistry}
*/
public interface IGrinderEntry
public interface IGrinderRecipe
{
/**
@@ -38,66 +42,40 @@ public interface IGrinderEntry
*
* @return input that the grinder will accept.
*/
@Nonnull
ItemStack getInput();
/**
* lets you change the grinder recipe by changing its input.
*
* @param input input item
*/
void setInput( ItemStack input );
/**
* gets the current output
*
* @return output that the grinder will produce
*/
@Nonnull
ItemStack getOutput();
/**
* allows you to change the output.
* gets the current output
*
* @param output output item
* @return output that the grinder will produce
*/
void setOutput( ItemStack output );
@Nonnull
Optional<ItemStack> getOptionalOutput();
/**
* gets the current output
*
* @return output that the grinder will produce
*/
ItemStack getOptionalOutput();
/**
* gets the current output
*
* @return output that the grinder will produce
*/
ItemStack getSecondOptionalOutput();
/**
* stack, and 0.0-1.0 chance that it will be generated.
*
* @param output output item
* @param chance generation chance
*/
void setOptionalOutput( ItemStack output, float chance );
Optional<ItemStack> getSecondOptionalOutput();
/**
* 0.0 - 1.0 the chance that the optional output will be generated.
*
* @return chance of optional output
*/
@Nonnull
float getOptionalChance();
/**
* stack, and 0.0-1.0 chance that it will be generated.
*
* @param output second optional output item
* @param chance second optional output chance
*/
void setSecondOptionalOutput( ItemStack output, float chance );
/**
* 0.0 - 1.0 the chance that the optional output will be generated.
*
@@ -106,16 +84,10 @@ public interface IGrinderEntry
float getSecondOptionalChance();
/**
* Energy cost, in turns.
* Amount of turns required to process the item.
*
* @return number of turns it takes to produce the output from the input.
*/
int getEnergyCost();
int getRequiredTurns();
/**
* Allows you to adjust the number of turns
*
* @param c number of turns to produce output.
*/
void setEnergyCost( int c );
}
@@ -24,7 +24,10 @@
package appeng.api.features;
import java.util.List;
import java.util.Collection;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
@@ -36,51 +39,90 @@ public interface IGrinderRegistry
{
/**
* Current list of registered recipes, you can modify this if you want too.
* An immutable list of the currently registered recipes.
*
* @return currentlyRegisteredRecipes
*/
List<IGrinderEntry> getRecipes();
@Nonnull
Collection<IGrinderRecipe> getRecipes();
/**
* add a new recipe the easy way, in &#8594; out, how many turns., duplicates will not be added.
* Add a new recipe with a single input and output and how many turns it requires.
*
* Will ignore duplicate recipes with the same input item.
*
* @param in input
* @param out output
* @param turns amount of turns to turn the input into the output
* @param in The {@link ItemStack} to grind.
* @param out The {@link ItemStack} to output.
* @param turns Amount of turns to turn the input into the output, with turns > 0.
*/
void addRecipe( ItemStack in, ItemStack out, int turns );
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, int turns );
/**
* Add a new recipe with an input, output and a single optional output.
*
* Will ignore duplicate recipes with the same input item.
*
* @param in The {@link ItemStack} to grind.
* @param out The {@link ItemStack} to output.
* @param optional The optional {@link ItemStack} to output of a certain chance.
* @param chance Chance to get the optional output within 0.0 - 1.0
* @param turns Amount of turns to turn the input into the output, with turns > 0.
*/
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, @Nonnull ItemStack optional, float chance, int turns );
/**
* add a new recipe with optional outputs, duplicates will not be added.
*
* Will ignore duplicate recipes with the same input item.
*
* @param in input
* @param out output
* @param optional optional output
* @param chance chance to get the optional output within 0.0 - 1.0
* @param turns amount of turns to turn the input into the outputs
*/
void addRecipe( ItemStack in, ItemStack out, ItemStack optional, float chance, int turns );
/**
* add a new recipe with optional outputs, duplicates will not be added.
*
* @param in input
* @param out output
* @param optional optional output
* @param chance chance to get the optional output within 0.0 - 1.0
* @param optional2 second optional output
* @param in The {@link ItemStack} to grind.
* @param out The {@link ItemStack} to output.
* @param optional The first optional {@link ItemStack} to output of a certain chance.
* @param chance Chance to get the first optional output within 0.0 - 1.0
* @param optional2 The second optional {@link ItemStack} to output of a certain chance.
* @param chance2 chance to get the second optional output within 0.0 - 1.0
* @param turns amount of turns to turn the input into the outputs
* @param turns Amount of turns to turn the input into the output, with turns > 0.
*
*/
void addRecipe( ItemStack in, ItemStack out, ItemStack optional, float chance, ItemStack optional2, float chance2, int turns );
void addRecipe( @Nonnull ItemStack in, @Nonnull ItemStack out, @Nonnull ItemStack optional, float chance, @Nonnull ItemStack optional2, float chance2, int turns );
/**
* Remove the specific from the recipe list.
*
* @param recipe The recipe to be removed.
* @return true, if it was removed
*/
boolean removeRecipe( @Nonnull IGrinderRecipe recipe );
/**
* Searches for a recipe for a given input, and returns it.
*
* @param input input
* @param input The {@link ItemStack} to be grinded.
*
* @return identified recipe or null
*/
IGrinderEntry getRecipeForInput( ItemStack input );
@Nullable
IGrinderRecipe getRecipeForInput( @Nonnull ItemStack input );
/**
* Allows do add a custom ratio from an ore to dust when being grinded.
*
* The default ratio is 1 ore to 2 dusts.
*
* These have to be added before any recipe is registered. Otherwise it will use the default value.
*
* @param oredictName The name of the ore;
* @param ratio The amount, must be > 0;
*/
void addDustRatio( @Nonnull String oredictName, int ratio );
/**
* Remove a custom ratio for a specific ore name.
*
* Will use the default of 2 value afterwards.
*
* @param oredictName The name of the ore;
*/
boolean removeDustRatio( @Nonnull String oredictName );
}
@@ -24,12 +24,36 @@
package appeng.api.networking.crafting;
import java.util.Collection;
import appeng.api.storage.data.IAEStack;
public interface ICraftingWatcher extends Collection<IAEStack>
/**
* DO NOT IMPLEMENT.
*
* Will be injected when adding an {@link ICraftingWatcherHost} to a grid.
*/
public interface ICraftingWatcher
{
/**
* Add a specific {@link IAEStack} to watch.
*
* Supports multiple values, duplicate ones will not be added.
*
* @param stack
* @return true, if successfully added.
*/
boolean add( IAEStack<?> stack );
/**
* Remove a specific {@link IAEStack} from the watcher.
*
* @param stack
* @return true, if successfully removed.
*/
boolean remove( IAEStack<?> stack );
/**
* Removes all watched stacks and resets the watcher to a clean state.
*/
void reset();
}
@@ -24,10 +24,34 @@
package appeng.api.networking.energy;
import java.util.Collection;
public interface IEnergyWatcher extends Collection<Double>
/**
* DO NOT IMPLEMENT.
*
* Will be injected when adding an {@link IEnergyWatcherHost} to a grid.
*/
public interface IEnergyWatcher
{
/**
* Add a specific threshold to watch.
*
* Supports multiple values, duplicate ones will not be added.
*
* @param amount
* @return true, if successfully added.
*/
boolean add( double amount );
/**
* Remove a specific threshold from the watcher.
*
* @param amount
* @return true, if successfully removed.
*/
boolean remove( double amount );
/**
* Removes all thresholds and resets the watcher to a clean state.
*/
void reset();
}
@@ -24,12 +24,36 @@
package appeng.api.networking.storage;
import java.util.Collection;
import appeng.api.storage.data.IAEStack;
public interface IStackWatcher extends Collection<IAEStack>
/**
* DO NOT IMPLEMENT.
*
* Will be injected when adding an {@link IStackWatcherHost} to a grid.
*/
public interface IStackWatcher
{
/**
* Add a specific {@link IAEStack} to watch.
*
* Supports multiple values, duplicate ones will not be added.
*
* @param stack
* @return true, if successfully added.
*/
boolean add( IAEStack<?> stack );
/**
* Remove a specific {@link IAEStack} from the watcher.
*
* @param stack
* @return true, if successfully removed.
*/
boolean remove( IAEStack<?> stack );
/**
* Removes all watched stacks and resets the watcher to a clean state.
*/
void reset();
}
+19 -10
View File
@@ -25,10 +25,11 @@ package appeng.api.parts;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import javax.annotation.Nonnull;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
@@ -39,7 +40,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@@ -71,7 +71,8 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
ItemStack getItemStack( PartItemStack type );
/**
* Render dynamic portions of this part, as part of the cable bus TESR. This part has to return true for {@link #requireDynamicRender()} in order for
* Render dynamic portions of this part, as part of the cable bus TESR. This part has to return true for
* {@link #requireDynamicRender()} in order for
* this method to be called.
*/
@SideOnly( Side.CLIENT )
@@ -267,8 +268,10 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
boolean canBePlacedOn( BusSupport what );
/**
* This method is used when a chunk is rebuilt to determine how this part should be rendered. The returned models should represent the
* part oriented north. They will be automatically rotated to match the part's actual orientation. Tint indices 1-4 can be used in the
* This method is used when a chunk is rebuilt to determine how this part should be rendered. The returned models
* should represent the
* part oriented north. They will be automatically rotated to match the part's actual orientation. Tint indices 1-4
* can be used in the
* models to access the parts color.
*
* <dl>
@@ -279,18 +282,23 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
* <dt>Tint Index 3</dt>
* <dd>The {@link AEColor#whiteVariant bright variant color} of the cable that this part is attached to.</dd>
* <dt>Tint Index 4</dt>
* <dd>A color variant that is between the cable's {@link AEColor#mediumVariant color} and its {@link AEColor#whiteVariant bright variant}.</dd>
* <dd>A color variant that is between the cable's {@link AEColor#mediumVariant color} and its
* {@link AEColor#whiteVariant bright variant}.</dd>
* </dl>
*
* <b>Important:</b> All models must have been registered via the {@link IPartModels} API before use.
*/
default List<ResourceLocation> getStaticModels()
@Nonnull
default IPartModel getStaticModels()
{
return Collections.emptyList();
return new IPartModel()
{
};
}
/**
* Implement this method if your part exposes capabilitys. Any requests for capabilities on the cable bus will be forwarded to parts on the appropriate
* Implement this method if your part exposes capabilitys. Any requests for capabilities on the cable bus will be
* forwarded to parts on the appropriate
* side.
*
* @see TileEntity#hasCapability(Capability, EnumFacing)
@@ -303,7 +311,8 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
}
/**
* Implement this method if your part exposes capabilitys. Any requests for capabilities on the cable bus will be forwarded to parts on the appropriate
* Implement this method if your part exposes capabilitys. Any requests for capabilities on the cable bus will be
* forwarded to parts on the appropriate
* side.
*
* @see TileEntity#getCapability(Capability, EnumFacing)
@@ -0,0 +1,65 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 - 2015 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.parts;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.util.ResourceLocation;
/**
* A container to store a collection of {@link ResourceLocation} as models for a part as well as other properties.
*/
public interface IPartModel
{
/**
* A solid {@link IPartModel} indicates that the rendering requires a cable connection, which will also result in
* creating an intersection for the cable.
*
* This should be true for pretty much all parts.
*
* @return true for a solid part.
*/
default boolean requireCableConnection()
{
return true;
}
/**
* A collection of {@link ResourceLocation} used as models for a part.
*
* @return a collection of models, never null.
*/
@Nonnull
default List<ResourceLocation> getModels()
{
return Collections.emptyList();
}
}
+88 -105
View File
@@ -31,10 +31,8 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@@ -65,12 +63,6 @@ public abstract class AEBaseBlock extends Block
protected AxisAlignedBB boundingBox = FULL_BLOCK_AABB;
@Override
public boolean isVisuallyOpaque()
{
return this.isOpaque() && this.isFullSize();
}
protected AEBaseBlock( final Material mat )
{
super( mat );
@@ -96,13 +88,9 @@ public abstract class AEBaseBlock extends Block
this.setLightLevel( 0 );
this.setHardness( 2.2F );
this.setHarvestLevel( "pickaxe", 0 );
}
@Override
public String toString()
{
String regName = getRegistryName() != null ? getRegistryName().getResourcePath() : "unregistered";
return getClass().getSimpleName() + "[" + regName + "]";
// Workaround as vanilla sets it way too early.
this.fullBlock = this.isFullSize();
}
@Override
@@ -111,31 +99,12 @@ public abstract class AEBaseBlock extends Block
return new BlockStateContainer( this, this.getAEStates() );
}
protected IProperty[] getAEStates()
{
return new IProperty[0];
}
public boolean isOpaque()
{
return this.isOpaque;
}
@Override
public boolean isNormalCube( IBlockState state )
public final boolean isNormalCube( IBlockState state )
{
return this.isFullSize() && this.isOpaque();
}
protected ICustomCollision getCustomCollision( final World w, final BlockPos pos )
{
if( this instanceof ICustomCollision )
{
return (ICustomCollision) this;
}
return null;
}
@Override
public AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess source, BlockPos pos )
{
@@ -176,10 +145,10 @@ public abstract class AEBaseBlock extends Block
{
if( Platform.isClient() )
{
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
final EntityPlayer player = Minecraft.getMinecraft().player;
final LookDirection ld = Platform.getPlayerRay( player, Platform.getEyeOffset( player ) );
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, Minecraft.getMinecraft().thePlayer, true );
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, Minecraft.getMinecraft().player, true );
AxisAlignedBB br = null;
double lastDist = 0;
@@ -210,7 +179,8 @@ public abstract class AEBaseBlock extends Block
if( br != null )
{
br = new AxisAlignedBB( br.minX + pos.getX(), br.minY + pos.getY(), br.minZ + pos.getZ(), br.maxX + pos.getX(), br.maxY + pos.getY(), br.maxZ + pos.getZ() );
br = new AxisAlignedBB( br.minX + pos.getX(), br.minY + pos.getY(), br.minZ + pos.getZ(), br.maxX + pos.getX(), br.maxY + pos
.getY(), br.maxZ + pos.getZ() );
return br;
}
}
@@ -241,7 +211,8 @@ public abstract class AEBaseBlock extends Block
}
else
{
b = new AxisAlignedBB( b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos.getZ() );
b = new AxisAlignedBB( b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos
.getZ() );
}
return b;
@@ -303,19 +274,6 @@ public abstract class AEBaseBlock extends Block
return super.collisionRayTrace( state, w, pos, a, b );
}
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
return false;
}
@Override
@SideOnly( Side.CLIENT )
@SuppressWarnings( "unchecked" )
public final void getSubBlocks( final Item item, final CreativeTabs tabs, final List itemStacks )
{
this.getCheckedSubBlocks( item, tabs, itemStacks );
}
@Override
public boolean hasComparatorInputOverride( IBlockState state )
{
@@ -329,21 +287,11 @@ public abstract class AEBaseBlock extends Block
}
@Override
public boolean isNormalCube( IBlockState state, final IBlockAccess world, final BlockPos pos )
public final boolean isNormalCube( IBlockState state, final IBlockAccess world, final BlockPos pos )
{
return this.isFullSize();
}
public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
{
if( this instanceof IOrientableBlock )
{
IOrientableBlock orientable = (IOrientableBlock) this;
return orientable.getOrientable( w, pos );
}
return null;
}
@Override
public boolean rotateBlock( final World w, final BlockPos pos, final EnumFacing axis )
{
@@ -378,50 +326,24 @@ public abstract class AEBaseBlock extends Block
return super.rotateBlock( w, pos, axis );
}
protected boolean hasCustomRotation()
{
return false;
}
protected void customRotateBlock( final IOrientable rotatable, final EnumFacing axis )
{
}
public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
{
return true;
}
@Override
public EnumFacing[] getValidRotations( final World w, final BlockPos pos )
{
return new EnumFacing[0];
}
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
{
super.getSubBlocks( item, tabs, itemStacks );
}
public String getUnlocalizedName( final ItemStack is )
{
return this.getUnlocalizedName();
}
@Override
public void addInformation( final ItemStack is, final EntityPlayer player, final List<String> lines, final boolean advancedItemTooltips )
{
}
public boolean hasSubtypes()
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
return this.hasSubtypes;
return false;
}
public EnumFacing mapRotation( final IOrientable ori, final EnumFacing dir )
public final EnumFacing mapRotation( final IOrientable ori, final EnumFacing dir )
{
// case DOWN: return bottomIcon;
// case UP: return blockIcon;
@@ -486,36 +408,97 @@ public abstract class AEBaseBlock extends Block
return null;
}
public boolean isFullSize()
@Override
public String toString()
{
return this.isFullSize;
String regName = getRegistryName() != null ? getRegistryName().getResourcePath() : "unregistered";
return getClass().getSimpleName() + "[" + regName + "]";
}
public boolean setFullSize( final boolean isFullSize )
protected String getUnlocalizedName( final ItemStack is )
{
this.isFullSize = isFullSize;
return isFullSize;
return this.getUnlocalizedName();
}
public boolean setOpaque( final boolean isOpaque )
protected boolean hasCustomRotation()
{
return false;
}
protected void customRotateBlock( final IOrientable rotatable, final EnumFacing axis )
{
}
protected IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
{
if( this instanceof IOrientableBlock )
{
IOrientableBlock orientable = (IOrientableBlock) this;
return orientable.getOrientable( w, pos );
}
return null;
}
protected boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
{
return true;
}
protected ICustomCollision getCustomCollision( final World w, final BlockPos pos )
{
if( this instanceof ICustomCollision )
{
return (ICustomCollision) this;
}
return null;
}
protected IProperty[] getAEStates()
{
return new IProperty[0];
}
protected boolean isOpaque()
{
return this.isOpaque;
}
protected boolean setOpaque( final boolean isOpaque )
{
this.isOpaque = isOpaque;
return isOpaque;
}
public boolean isInventory()
protected boolean hasSubtypes()
{
return this.isInventory;
return this.hasSubtypes;
}
public void setInventory( final boolean isInventory )
{
this.isInventory = isInventory;
}
public void setHasSubtypes( final boolean hasSubtypes )
protected void setHasSubtypes( final boolean hasSubtypes )
{
this.hasSubtypes = hasSubtypes;
}
protected boolean isFullSize()
{
return this.isFullSize;
}
protected boolean setFullSize( final boolean isFullSize )
{
this.isFullSize = isFullSize;
return isFullSize;
}
protected boolean isInventory()
{
return this.isInventory;
}
protected void setInventory( final boolean isInventory )
{
this.isInventory = isInventory;
}
}
@@ -126,7 +126,7 @@ public class AEBaseItemBlock extends ItemBlock
{
up = EnumFacing.UP;
final byte rotation = (byte) ( MathHelper.floor_double( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
final byte rotation = (byte) ( MathHelper.floor( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
switch( rotation )
{
+13 -10
View File
@@ -269,13 +269,16 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
}
@Override
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
public boolean onBlockActivated( World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ )
{
if( player != null && heldItem != null )
ItemStack heldItem;
if( player != null && player.getHeldItemMainhand() != null )
{
heldItem = player.getHeldItemMainhand();
if( Platform.isWrench( player, heldItem, pos ) && player.isSneaking() )
{
final IBlockState blockState = w.getBlockState( pos );
final IBlockState blockState = world.getBlockState( pos );
final Block block = blockState.getBlock();
if( block == null )
@@ -283,7 +286,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
return false;
}
final AEBaseTile tile = this.getTileEntity( w, pos );
final AEBaseTile tile = this.getTileEntity( world, pos );
if( tile == null )
{
@@ -295,7 +298,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
return false;
}
final ItemStack[] itemDropCandidates = Platform.getBlockDrops( w, pos );
final ItemStack[] itemDropCandidates = Platform.getBlockDrops( world, pos );
final ItemStack op = new ItemStack( this );
for( final ItemStack ol : itemDropCandidates )
@@ -310,11 +313,11 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
}
}
if( block.removedByPlayer( blockState, w, pos, player, false ) )
if( block.removedByPlayer( blockState, world, pos, player, false ) )
{
final List<ItemStack> itemsToDrop = Lists.newArrayList( itemDropCandidates );
Platform.spawnDrops( w, pos, itemsToDrop );
w.setBlockToAir( pos );
Platform.spawnDrops( world, pos, itemsToDrop );
world.setBlockToAir( pos );
}
return false;
@@ -323,7 +326,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
if( heldItem.getItem() instanceof IMemoryCard && !( this instanceof BlockCableBus ) )
{
final IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem();
final AEBaseTile tileEntity = this.getTileEntity( w, pos );
final AEBaseTile tileEntity = this.getTileEntity( world, pos );
if( tileEntity == null )
{
@@ -361,7 +364,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
}
}
return this.onActivated( w, pos, player, hand, heldItem, side, hitX, hitY, hitZ );
return this.onActivated( world, pos, player, hand, player.getHeldItemMainhand(), facing, hitX, hitY, hitZ );
}
@Override
@@ -19,14 +19,13 @@
package appeng.block.crafting;
import java.util.List;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.property.ExtendedBlockState;
@@ -85,7 +84,7 @@ public class BlockCraftingMonitor extends BlockCraftingUnit
@Override
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
public void getSubBlocks( final Item item, final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks )
{
itemStacks.add( new ItemStack( this, 1, 0 ) );
}
@@ -21,8 +21,6 @@ package appeng.block.crafting;
import java.util.EnumSet;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
@@ -30,7 +28,6 @@ import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@@ -118,7 +115,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
}
@Override
public void neighborChanged( final IBlockState state, final World worldIn, final BlockPos pos, final Block neighborBlock )
public void neighborChanged( final IBlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos )
{
final TileCraftingTile cp = this.getTileEntity( worldIn, pos );
if( cp != null )
@@ -146,7 +143,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
}
@Override
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
final TileCraftingTile tg = this.getTileEntity( w, pos );
if( tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive() )
@@ -19,14 +19,11 @@
package appeng.block.crafting;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@@ -42,6 +39,7 @@ import appeng.core.sync.GuiBridge;
import appeng.tile.crafting.TileMolecularAssembler;
import appeng.util.Platform;
public class BlockMolecularAssembler extends AEBaseTileBlock
{
@@ -88,18 +86,18 @@ public class BlockMolecularAssembler extends AEBaseTileBlock
@SideOnly( Side.CLIENT )
@Override
public boolean canRenderInLayer( BlockRenderLayer layer )
public boolean canRenderInLayer( IBlockState state, BlockRenderLayer layer )
{
return layer == BlockRenderLayer.TRANSLUCENT;
}
public boolean isFullCube(IBlockState state)
public boolean isFullCube( IBlockState state )
{
return false;
}
@Override
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
final TileMolecularAssembler tg = this.getTileEntity( w, pos );
if( tg != null && !p.isSneaking() )
@@ -135,7 +135,7 @@ public class BlockCrank extends AEBaseTileBlock
}
@Override
public void neighborChanged( final IBlockState state, final World world, final BlockPos pos, final Block neighborBlock )
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final AEBaseTile tile = this.getTileEntity( world, pos );
@@ -22,6 +22,7 @@ package appeng.block.misc;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -51,7 +52,7 @@ import appeng.client.render.effects.LightningFX;
import appeng.client.render.renderable.ItemRenderable;
import appeng.client.render.tesr.ModularTESR;
import appeng.core.AEConfig;
import appeng.core.CommonHelper;
import appeng.core.AppEng;
import appeng.helpers.ICustomCollision;
import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileCharger;
@@ -117,7 +118,7 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
for( int bolts = 0; bolts < 3; bolts++ )
{
if( CommonHelper.proxy.shouldAddParticles( r ) )
if( AppEng.proxy.shouldAddParticles( r ) )
{
final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0D, 0.0D, 0.0D );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
@@ -148,12 +148,12 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
}
@Override
public void neighborChanged( IBlockState state, World w, BlockPos pos, Block blockIn )
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final EnumFacing up = this.getOrientable( w, pos ).getUp();
if( !this.canPlaceAt( (World) w, pos, up.getOpposite() ) )
final EnumFacing up = this.getOrientable( world, pos ).getUp();
if( !this.canPlaceAt( (World) world, pos, up.getOpposite() ) )
{
this.dropTorch( (World) w, pos );
this.dropTorch( (World) world, pos );
}
}
@@ -45,7 +45,7 @@ import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseBlock;
import appeng.client.render.effects.LightningFX;
import appeng.core.AEConfig;
import appeng.core.CommonHelper;
import appeng.core.AppEng;
import appeng.helpers.ICustomCollision;
import appeng.helpers.MetaRotation;
@@ -151,7 +151,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
final double zOff = -0.3 * up.getFrontOffsetZ();
for( int bolts = 0; bolts < 3; bolts++ )
{
if( CommonHelper.proxy.shouldAddParticles( r ) )
if( AppEng.proxy.shouldAddParticles( r ) )
{
final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0D, 0.0D, 0.0D );
@@ -161,12 +161,12 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
}
@Override
public void neighborChanged( final IBlockState state, final World w, final BlockPos pos,final Block neighborBlock )
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos)
{
final EnumFacing up = this.getOrientable( w, pos ).getUp();
if( !this.canPlaceAt( w, pos, up.getOpposite() ) )
final EnumFacing up = this.getOrientable( world, pos ).getUp();
if( !this.canPlaceAt( world, pos, up.getOpposite() ) )
{
this.dropTorch( w, pos );
this.dropTorch( world, pos );
}
}
@@ -38,7 +38,7 @@ import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.effects.LightningFX;
import appeng.core.AEConfig;
import appeng.core.CommonHelper;
import appeng.core.AppEng;
import appeng.tile.misc.TileQuartzGrowthAccelerator;
import appeng.util.Platform;
@@ -83,7 +83,7 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
final TileQuartzGrowthAccelerator cga = this.getTileEntity( w, pos );
if( cga != null && cga.isPowered() && CommonHelper.proxy.shouldAddParticles( r ) )
if( cga != null && cga.isPowered() && AppEng.proxy.shouldAddParticles( r ) )
{
final double d0 = r.nextFloat() - 0.5F;
final double d1 = r.nextFloat() - 0.5F;
@@ -78,13 +78,13 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
}
@Override
public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock )
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final TileSkyCompass sc = this.getTileEntity( w, pos );
final TileSkyCompass sc = this.getTileEntity( world, pos );
final EnumFacing forward = sc.getForward();
if( !this.canPlaceAt( w, pos, forward.getOpposite() ) )
if( !this.canPlaceAt( world, pos, forward.getOpposite() ) )
{
this.dropTorch( w, pos );
this.dropTorch( world, pos );
}
}
@@ -42,11 +42,8 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import appeng.block.AEBaseBlock;
import appeng.core.AppEng;
import appeng.entity.EntityIds;
import appeng.entity.EntityTinyTNTPrimed;
import appeng.helpers.ICustomCollision;
@@ -62,7 +59,8 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
this.setSoundType( SoundType.GROUND );
this.setHardness( 0F );
EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.get( EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true );
// TODO: 1.11
//EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.get( EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true );
}
@Override
@@ -86,18 +84,18 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
if( !w.isRemote )
{
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, igniter );
w.spawnEntityInWorld( primedTinyTNTEntity );
w.spawnEntity( primedTinyTNTEntity );
w.playSound( null, primedTinyTNTEntity.posX, primedTinyTNTEntity.posY, primedTinyTNTEntity.posZ, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1, 1 );
}
}
@Override
public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock )
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
if( w.isBlockIndirectlyGettingPowered( pos ) > 0 )
if( world.isBlockIndirectlyGettingPowered( pos ) > 0 )
{
this.startFuse( w, pos, null );
w.setBlockToAir( pos );
this.startFuse( world, pos, null );
world.setBlockToAir( pos );
}
}
@@ -142,7 +140,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
{
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, exp.getExplosivePlacedBy() );
primedTinyTNTEntity.setFuse( w.rand.nextInt( primedTinyTNTEntity.getFuse() / 4 ) + primedTinyTNTEntity.getFuse() / 8 );
w.spawnEntityInWorld( primedTinyTNTEntity );
w.spawnEntity( primedTinyTNTEntity );
}
}
@@ -22,6 +22,7 @@ package appeng.block.networking;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
@@ -45,6 +46,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
@@ -235,7 +237,7 @@ public class BlockCableBus extends AEBaseTileBlock
return sp.facade.getItemStack();
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -329,11 +331,11 @@ public class BlockCableBus extends AEBaseTileBlock
}
@Override
public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock )
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
if( Platform.isServer() )
{
this.cb( w, pos ).onNeighborChanged();
this.cb( world, pos ).onNeighborChanged();
}
}
@@ -376,7 +378,7 @@ public class BlockCableBus extends AEBaseTileBlock
@Override
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
public void getSubBlocks( final Item item, final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks )
{
// do nothing
}
@@ -170,9 +170,9 @@ public class BlockController extends AEBaseTileBlock
}
@Override
public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock )
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final TileController tc = this.getTileEntity( w, pos );
final TileController tc = this.getTileEntity( world, pos );
if( tc != null )
{
tc.onNeighborChange( false );
@@ -19,8 +19,6 @@
package appeng.block.networking;
import java.util.List;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
@@ -28,6 +26,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -63,9 +62,9 @@ public class BlockEnergyCell extends AEBaseTileBlock
@Override
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
public void getSubBlocks( final Item item, final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks )
{
super.getCheckedSubBlocks( item, tabs, itemStacks );
super.getSubBlocks( item, tabs, itemStacks );
final ItemStack charged = new ItemStack( this, 1 );
final NBTTagCompound tag = Platform.openNbtData( charged );
@@ -21,14 +21,12 @@ package appeng.block.networking;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@@ -46,6 +44,7 @@ import appeng.helpers.ICustomCollision;
import appeng.tile.networking.TileWireless;
import appeng.util.Platform;
public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
{
@@ -62,7 +61,6 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
}
}
public static final PropertyEnum<State> STATE = PropertyEnum.create( "state", State.class );
public BlockWireless()
@@ -110,7 +108,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
}
@Override
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
if( player.isSneaking() )
{
@@ -21,7 +21,6 @@ package appeng.block.paint;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
@@ -34,6 +33,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
@@ -94,13 +94,13 @@ public class BlockPaint extends AEBaseTileBlock
@Override
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
public void getSubBlocks( final Item item, final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks )
{
// do nothing
}
@Override
public AxisAlignedBB getCollisionBoundingBox( final IBlockState state, final World worldIn, final BlockPos pos )
public AxisAlignedBB getCollisionBoundingBox( IBlockState blockState, IBlockAccess worldIn, BlockPos pos )
{
return null;
}
@@ -112,9 +112,9 @@ public class BlockPaint extends AEBaseTileBlock
}
@Override
public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock )
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final TilePaint tp = this.getTileEntity( w, pos );
final TilePaint tp = this.getTileEntity( world, pos );
if( tp != null )
{
@@ -4,6 +4,7 @@ package appeng.block.paint;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.base.Function;
@@ -101,9 +101,9 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
}
@Override
public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock )
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final TileQuantumBridge bridge = this.getTileEntity( w, pos );
final TileQuantumBridge bridge = this.getTileEntity( world, pos );
if( bridge != null )
{
bridge.neighborUpdate();
@@ -37,7 +37,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.client.EffectType;
import appeng.core.CommonHelper;
import appeng.core.AppEng;
import appeng.core.sync.GuiBridge;
import appeng.helpers.AEGlassMaterial;
import appeng.tile.qnb.TileQuantumBridge;
@@ -60,9 +60,9 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
{
if( bridge.hasQES() )
{
if( CommonHelper.proxy.shouldAddParticles( rand ) )
if( AppEng.proxy.shouldAddParticles( rand ) )
{
CommonHelper.proxy.spawnEffect( EffectType.Energy, w, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, null );
AppEng.proxy.spawnEffect( EffectType.Energy, w, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, null );
}
}
}
@@ -4,6 +4,7 @@ package appeng.block.qnb;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Nullable;
import com.google.common.base.Function;
@@ -28,6 +28,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
@@ -53,7 +54,7 @@ public class BlockMatrixFrame extends AEBaseBlock implements ICustomCollision
@Override
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( final Item item, final CreativeTabs tabs, final List<ItemStack> itemStacks )
public void getSubBlocks( final Item item, final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks )
{
// do nothing
}
@@ -47,9 +47,9 @@ public class BlockSpatialIOPort extends AEBaseTileBlock
}
@Override
public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock )
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final TileSpatialIOPort te = this.getTileEntity( w, pos );
final TileSpatialIOPort te = this.getTileEntity( world, pos );
if( te != null )
{
te.updateRedstoneState();
@@ -62,9 +62,9 @@ public class BlockSpatialPylon extends AEBaseTileBlock
}
@Override
public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock )
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final TileSpatialPylon tsp = this.getTileEntity( w, pos );
final TileSpatialPylon tsp = this.getTileEntity( world, pos );
if( tsp != null )
{
tsp.neighborChanged();
@@ -118,7 +118,7 @@ public class BlockChest extends AEBaseTileBlock
}
else
{
p.addChatMessage( PlayerMessages.ChestCannotReadStorageCell.get() );
p.sendMessage( PlayerMessages.ChestCannotReadStorageCell.get() );
}
}
@@ -48,9 +48,9 @@ public class BlockIOPort extends AEBaseTileBlock
}
@Override
public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock )
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final TileIOPort te = this.getTileEntity( w, pos );
final TileIOPort te = this.getTileEntity( world, pos );
if( te != null )
{
te.updateRedstoneState();
@@ -47,6 +47,10 @@ import appeng.util.Platform;
public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
{
private static final double AABB_OFFSET_BOTTOM = .0625d;
private static final double AABB_OFFSET_SIDES = 0;
private static final double AABB_OFFSET_TOP = .125d;
public enum SkyChestType
{
STONE, BLOCK
@@ -71,7 +75,6 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Override
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
@@ -85,6 +88,21 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
{
final AxisAlignedBB aabb = computeAABB( w, pos );
return Collections.singletonList( aabb );
}
@Override
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
final AxisAlignedBB aabb = computeAABB( w, pos );
out.add( aabb );
}
private AxisAlignedBB computeAABB( final World w, final BlockPos pos )
{
final TileSkyChest sk = this.getTileEntity( w, pos );
EnumFacing o = EnumFacing.UP;
@@ -94,17 +112,19 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
o = sk.getUp();
}
final double offsetX = o.getFrontOffsetX() == 0 ? 0.06 : 0.0;
final double offsetY = o.getFrontOffsetY() == 0 ? 0.06 : 0.0;
final double offsetZ = o.getFrontOffsetZ() == 0 ? 0.06 : 0.0;
final double offsetX = o.getFrontOffsetX() == 0 ? AABB_OFFSET_BOTTOM : AABB_OFFSET_SIDES;
final double offsetY = o.getFrontOffsetY() == 0 ? AABB_OFFSET_BOTTOM : AABB_OFFSET_SIDES;
final double offsetZ = o.getFrontOffsetZ() == 0 ? AABB_OFFSET_BOTTOM : AABB_OFFSET_SIDES;
final double sc = 0.06;
return Collections.singletonList( new AxisAlignedBB( Math.max( 0.0, offsetX - o.getFrontOffsetX() * sc ), Math.max( 0.0, offsetY - o.getFrontOffsetY() * sc ), Math.max( 0.0, offsetZ - o.getFrontOffsetZ() * sc ), Math.min( 1.0, ( 1.0 - offsetX ) - o.getFrontOffsetX() * sc ), Math.min( 1.0, ( 1.0 - offsetY ) - o.getFrontOffsetY() * sc ), Math.min( 1.0, ( 1.0 - offsetZ ) - o.getFrontOffsetZ() * sc ) ) );
}
// x/z needs to be multiplied by -1, thus we simply add not substract.
final double minX = Math.max( 0.0, offsetX + o.getFrontOffsetX() * AABB_OFFSET_TOP );
final double minY = Math.max( 0.0, offsetY - o.getFrontOffsetY() * AABB_OFFSET_TOP );
final double minZ = Math.max( 0.0, offsetZ + o.getFrontOffsetZ() * AABB_OFFSET_TOP );
@Override
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
out.add( new AxisAlignedBB( 0.05, 0.05, 0.05, 0.95, 0.95, 0.95 ) );
final double maxX = Math.min( 1.0, ( 1.0 - offsetX ) + o.getFrontOffsetX() * AABB_OFFSET_TOP );
final double maxY = Math.min( 1.0, ( 1.0 - offsetY ) - o.getFrontOffsetY() * AABB_OFFSET_TOP );
final double maxZ = Math.min( 1.0, ( 1.0 - offsetZ ) + o.getFrontOffsetZ() * AABB_OFFSET_TOP );
return new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
}
}
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
@@ -241,9 +242,6 @@ class BlockDefinitionBuilder implements IBlockBuilder
factory.addPreInit( side -> {
Class<? extends AEBaseTile> tileEntityClass = tileBlock.getTileEntityClass();
AEBaseTile.registerTileItem( tileEntityClass, new BlockStackSrc( block, 0, ActivityState.Enabled ) );
// TODO: Change after transition phase
GameRegistry.registerTileEntityWithAlternatives( tileEntityClass, AppEng.MOD_ID.toLowerCase() + ":" + registryName, registryName );
} );
return (T) new TileDefinition( registryName, (AEBaseTileBlock) block, item );
@@ -43,10 +43,10 @@ public final class Capabilities
@CapabilityInject( IStorageMonitorableAccessor.class )
public static Capability<IStorageMonitorableAccessor> STORAGE_MONITORABLE_ACCESSOR;
@CapabilityInject(ITeslaConsumer.class)
@CapabilityInject( ITeslaConsumer.class )
public static Capability<ITeslaConsumer> TESLA_CONSUMER;
@CapabilityInject(ITeslaHolder.class)
@CapabilityInject( ITeslaHolder.class )
public static Capability<ITeslaHolder> TESLA_HOLDER;
/**
+22 -22
View File
@@ -58,7 +58,7 @@ import appeng.client.render.tesr.InscriberTESR;
import appeng.client.render.textures.ParticleTextures;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.CommonHelper;
import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketAssemblerAnimation;
import appeng.core.sync.packets.PacketValueConfig;
@@ -117,7 +117,7 @@ public class ClientHelper extends ServerHelper
{
if( Platform.isClient() )
{
return Minecraft.getMinecraft().theWorld;
return Minecraft.getMinecraft().world;
}
else
{
@@ -137,7 +137,7 @@ public class ClientHelper extends ServerHelper
if( Platform.isClient() )
{
final List<EntityPlayer> o = new ArrayList<>();
o.add( Minecraft.getMinecraft().thePlayer );
o.add( Minecraft.getMinecraft().player );
return o;
}
else
@@ -147,29 +147,29 @@ public class ClientHelper extends ServerHelper
}
@Override
public void spawnEffect( final EffectType effect, final World worldObj, final double posX, final double posY, final double posZ, final Object o )
public void spawnEffect( final EffectType effect, final World world, final double posX, final double posY, final double posZ, final Object o )
{
if( AEConfig.instance().isEnableEffects() )
{
switch( effect )
{
case Assembler:
this.spawnAssembler( worldObj, posX, posY, posZ, o );
this.spawnAssembler( world, posX, posY, posZ, o );
return;
case Vibrant:
this.spawnVibrant( worldObj, posX, posY, posZ );
this.spawnVibrant( world, posX, posY, posZ );
return;
case Crafting:
this.spawnCrafting( worldObj, posX, posY, posZ );
this.spawnCrafting( world, posX, posY, posZ );
return;
case Energy:
this.spawnEnergy( worldObj, posX, posY, posZ );
this.spawnEnergy( world, posX, posY, posZ );
return;
case Lightning:
this.spawnLightning( worldObj, posX, posY, posZ );
this.spawnLightning( world, posX, posY, posZ );
return;
case LightningArc:
this.spawnLightningArc( worldObj, posX, posY, posZ, (Vec3d) o );
this.spawnLightningArc( world, posX, posY, posZ, (Vec3d) o );
return;
default:
}
@@ -216,7 +216,7 @@ public class ClientHelper extends ServerHelper
}
final Minecraft mc = Minecraft.getMinecraft();
final EntityPlayer player = mc.thePlayer;
final EntityPlayer player = mc.player;
return this.renderModeForPlayer( player );
}
@@ -225,12 +225,12 @@ public class ClientHelper extends ServerHelper
public void triggerUpdates()
{
final Minecraft mc = Minecraft.getMinecraft();
if( mc == null || mc.thePlayer == null || mc.theWorld == null )
if( mc == null || mc.player == null || mc.world == null )
{
return;
}
final EntityPlayer player = mc.thePlayer;
final EntityPlayer player = mc.player;
final int x = (int) player.posX;
final int y = (int) player.posY;
@@ -238,7 +238,7 @@ public class ClientHelper extends ServerHelper
final int range = 16 * 16;
mc.theWorld.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range );
mc.world.markBlockRangeForRenderUpdate( x - range, y - range, z - range, x + range, y + range, z + range );
}
@Override
@@ -262,17 +262,17 @@ public class ClientHelper extends ServerHelper
}
}
private void spawnAssembler( final World worldObj, final double posX, final double posY, final double posZ, final Object o )
private void spawnAssembler( final World world, final double posX, final double posY, final double posZ, final Object o )
{
final PacketAssemblerAnimation paa = (PacketAssemblerAnimation) o;
final AssemblerFX fx = new AssemblerFX( worldObj, posX, posY, posZ, 0.0D, 0.0D, 0.0D, paa.rate, paa.is );
final AssemblerFX fx = new AssemblerFX( world, posX, posY, posZ, 0.0D, 0.0D, 0.0D, paa.rate, paa.is );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
private void spawnVibrant( final World w, final double x, final double y, final double z )
{
if( CommonHelper.proxy.shouldAddParticles( Platform.getRandom() ) )
if( AppEng.proxy.shouldAddParticles( Platform.getRandom() ) )
{
final double d0 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D;
final double d1 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D;
@@ -313,15 +313,15 @@ public class ClientHelper extends ServerHelper
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
private void spawnLightning( final World worldObj, final double posX, final double posY, final double posZ )
private void spawnLightning( final World world, final double posX, final double posY, final double posZ )
{
final LightningFX fx = new LightningFX( worldObj, posX, posY + 0.3f, posZ, 0.0f, 0.0f, 0.0f );
final LightningFX fx = new LightningFX( world, posX, posY + 0.3f, posZ, 0.0f, 0.0f, 0.0f );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
private void spawnLightningArc( final World worldObj, final double posX, final double posY, final double posZ, final Vec3d second )
private void spawnLightningArc( final World world, final double posX, final double posY, final double posZ, final Vec3d second )
{
final LightningFX fx = new LightningArcFX( worldObj, posX, posY, posZ, second.xCoord, second.yCoord, second.zCoord, 0.0f, 0.0f, 0.0f );
final LightningFX fx = new LightningArcFX( world, posX, posY, posZ, second.xCoord, second.yCoord, second.zCoord, 0.0f, 0.0f, 0.0f );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
@@ -334,7 +334,7 @@ public class ClientHelper extends ServerHelper
}
final Minecraft mc = Minecraft.getMinecraft();
final EntityPlayer player = mc.thePlayer;
final EntityPlayer player = mc.player;
if( player.isSneaking() )
{
final EnumHand hand;
+13 -14
View File
@@ -54,7 +54,6 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiScrollbar;
@@ -252,14 +251,14 @@ public abstract class AEBaseGui extends GuiContainer
{
if( fs.isEnabled() )
{
this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18,
this.drawTexturedModalRect( ox + fs.xPos - 1, oy + fs.yPos - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18,
18 );
}
else
{
GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F );
GlStateManager.enableBlend();
this.drawTexturedModalRect( ox + fs.xDisplayPosition - 1, oy + fs.yDisplayPosition - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18,
this.drawTexturedModalRect( ox + fs.xPos - 1, oy + fs.yPos - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18,
18 );
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
}
@@ -298,7 +297,7 @@ public abstract class AEBaseGui extends GuiContainer
protected void mouseClickMove( final int x, final int y, final int c, final long d )
{
final Slot slot = this.getSlot( x, y );
final ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack();
final ItemStack itemstack = this.mc.player.inventory.getItemStack();
if( this.getScrollBar() != null )
{
@@ -327,7 +326,7 @@ public abstract class AEBaseGui extends GuiContainer
@Override
protected void handleMouseClick( final Slot slot, final int slotIdx, final int mouseButton, final ClickType clickType )
{
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
final EntityPlayer player = Minecraft.getMinecraft().player;
if( slot instanceof SlotFake )
{
@@ -522,7 +521,7 @@ public abstract class AEBaseGui extends GuiContainer
for( final Slot inventorySlot : slots )
{
if( inventorySlot != null && inventorySlot.canTakeStack(
this.mc.thePlayer ) && inventorySlot.getHasStack() && inventorySlot.inventory == slot.inventory && Container.canAddItemToSlot(
this.mc.player ) && inventorySlot.getHasStack() && inventorySlot.inventory == slot.inventory && Container.canAddItemToSlot(
inventorySlot, this.dbl_whichItem, true ) )
{
this.handleMouseClick( inventorySlot, inventorySlot.slotNumber, 1, clickType );
@@ -541,7 +540,7 @@ public abstract class AEBaseGui extends GuiContainer
{
final Slot theSlot = this.getSlotUnderMouse();
if( this.mc.thePlayer.inventory.getItemStack() == null && theSlot != null )
if( this.mc.player.inventory.getItemStack() == null && theSlot != null )
{
for( int j = 0; j < 9; ++j )
{
@@ -595,7 +594,7 @@ public abstract class AEBaseGui extends GuiContainer
for( final Slot slot : slots )
{
// isPointInRegion
if( this.isPointInRegion( slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mouseX, mouseY ) )
if( this.isPointInRegion( slot.xPos, slot.yPos, 16, 16, mouseX, mouseY ) )
{
return slot;
}
@@ -705,7 +704,7 @@ public abstract class AEBaseGui extends GuiContainer
if( !this.isPowered() )
{
drawRect( s.xDisplayPosition, s.yDisplayPosition, 16 + s.xDisplayPosition, 16 + s.yDisplayPosition, 0x66111111 );
drawRect( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111 );
}
this.zLevel = 0.0F;
@@ -714,7 +713,7 @@ public abstract class AEBaseGui extends GuiContainer
// Annoying but easier than trying to splice into render item
super.drawSlot( new Size1Slot( s ) );
stackSizeRenderer.renderStackSize( fontRendererObj, ( (SlotME) s ).getAEStack(), s.getStack(), s.xDisplayPosition, s.yDisplayPosition );
stackSizeRenderer.renderStackSize( fontRendererObj, ( (SlotME) s ).getAEStack(), s.getStack(), s.xPos, s.yPos );
}
catch( final Exception err )
@@ -746,8 +745,8 @@ public abstract class AEBaseGui extends GuiContainer
GlStateManager.enableTexture2D();
GlStateManager.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
final float par1 = aes.xDisplayPosition;
final float par2 = aes.yDisplayPosition;
final float par1 = aes.xPos;
final float par2 = aes.yPos;
final float par3 = uv_x * 16;
final float par4 = uv_y * 16;
@@ -787,7 +786,7 @@ public abstract class AEBaseGui extends GuiContainer
{
try
{
isValid = ( (SlotRestrictedInput) s ).isValid( is, this.mc.theWorld );
isValid = ( (SlotRestrictedInput) s ).isValid( is, this.mc.world );
}
catch( final Exception err )
{
@@ -803,7 +802,7 @@ public abstract class AEBaseGui extends GuiContainer
this.itemRender.zLevel = 100.0F;
GlStateManager.disableLighting();
drawRect( s.xDisplayPosition, s.yDisplayPosition, 16 + s.xDisplayPosition, 16 + s.yDisplayPosition, 0x66ff6666 );
drawRect( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66ff6666 );
GlStateManager.enableLighting();
this.zLevel = 0.0F;
@@ -82,10 +82,10 @@ public abstract class AEBaseMEGui extends AEBaseGui
currentToolTip.add( TextFormatting.GRAY + format );
}
}
else if( stack.stackSize > BigNumber || ( stack.stackSize > 1 && stack.isItemDamaged() ) )
else if( stack.getCount() > BigNumber || ( stack.getCount() > 1 && stack.isItemDamaged() ) )
{
final String local = ButtonToolTips.ItemsStored.getLocal();
final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize );
final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( stack.getCount() );
final String format = String.format( local, formattedAmount );
currentToolTip.add( TextFormatting.GRAY + format );
@@ -119,7 +119,7 @@ public abstract class AEBaseMEGui extends AEBaseGui
if( myStack != null )
{
@SuppressWarnings( "unchecked" )
final List<String> currentToolTip = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
final List<String> currentToolTip = stack.getTooltip( this.mc.player, this.mc.gameSettings.advancedItemTooltips );
if( myStack.getStackSize() > BigNumber || ( myStack.getStackSize() > 1 && stack.isItemDamaged() ) )
{
@@ -134,10 +134,10 @@ public abstract class AEBaseMEGui extends AEBaseGui
this.drawTooltip( x, y, currentToolTip );
return;
}
else if( stack.stackSize > BigNumber )
else if( stack.getCount() > BigNumber )
{
List<String> var4 = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
var4.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.stackSize ) );
List<String> var4 = stack.getTooltip( this.mc.player, this.mc.gameSettings.advancedItemTooltips );
var4.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.getCount() ) );
this.drawTooltip( x, y, var4 );
return;
}
@@ -24,7 +24,7 @@ class Size1Slot extends Slot
public Size1Slot( Slot delegate )
{
super( delegate.inventory, delegate.getSlotIndex(), delegate.xDisplayPosition, delegate.yDisplayPosition );
super( delegate.inventory, delegate.getSlotIndex(), delegate.xPos, delegate.yPos );
this.delegate = delegate;
}
@@ -36,11 +36,11 @@ class Size1Slot extends Slot
if( orgStack != null )
{
ItemStack modifiedStack = orgStack.copy();
modifiedStack.stackSize = 1;
modifiedStack.setCount( 1 );
return modifiedStack;
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -232,7 +232,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
final String which = Integer.toString( x );
if( invData.hasKey( which ) )
{
current.getInventory().setInventorySlotContents( x, ItemStack.loadItemStackFromNBT( invData.getCompoundTag( which ) ) );
current.getInventory().setInventorySlotContents( x, new ItemStack( invData.getCompoundTag( which ) ) );
}
}
}
@@ -344,7 +344,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
for( int i = 0; i < outTag.tagCount(); i++ )
{
final ItemStack parsedItemStack = ItemStack.loadItemStackFromNBT( outTag.getCompoundTagAt( i ) );
final ItemStack parsedItemStack = new ItemStack( outTag.getCompoundTagAt( i ) );
if( parsedItemStack != null )
{
final String displayName = Platform.getItemDisplayName( AEApi.instance().storage().createItemStack( parsedItemStack ) ).toLowerCase();
@@ -323,7 +323,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
{
if( s instanceof AppEngSlot )
{
if( ( (Slot) s ).xDisplayPosition < 197 )
if( ( (Slot) s ).xPos < 197 )
{
this.repositionSlot( (AppEngSlot) s );
}
@@ -332,10 +332,10 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
if( s instanceof SlotCraftingMatrix || s instanceof SlotFakeCraftingMatrix )
{
final Slot g = (Slot) s;
if( g.xDisplayPosition > 0 && g.yDisplayPosition > 0 )
if( g.xPos > 0 && g.yPos > 0 )
{
craftingGridOffsetX = Math.min( craftingGridOffsetX, g.xDisplayPosition );
craftingGridOffsetY = Math.min( craftingGridOffsetY, g.yDisplayPosition );
craftingGridOffsetX = Math.min( craftingGridOffsetX, g.xPos );
craftingGridOffsetY = Math.min( craftingGridOffsetY, g.yPos );
}
}
}
@@ -443,7 +443,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
protected void repositionSlot( final AppEngSlot s )
{
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
s.yPos = s.getY() + this.ySize - 78 - 5;
}
@Override
@@ -253,7 +253,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
if( myStack != null )
{
List<String> currentToolTip = stack.getTooltip( this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips );
List<String> currentToolTip = stack.getTooltip( this.mc.player, this.mc.gameSettings.advancedItemTooltips );
while( currentToolTip.size() > 1 )
{
@@ -176,6 +176,6 @@ public class GuiPatternTerm extends GuiMEMonitorable
{
final int offsetPlayerSide = s.isPlayerSide() ? 5 : 3;
s.yDisplayPosition = s.getY() + this.ySize - 78 - offsetPlayerSide;
s.yPos = s.getY() + this.ySize - 78 - offsetPlayerSide;
}
}
@@ -22,6 +22,7 @@ package appeng.client.me;
import java.util.ArrayList;
import java.util.Collections;
import java.util.regex.Pattern;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
@@ -76,11 +76,6 @@ public class SlotDisconnected extends AppEngSlot
return super.getStack();
}
@Override
public void onPickupFromSlot( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack )
{
}
@Override
public boolean getHasStack()
{
@@ -96,7 +91,7 @@ public class SlotDisconnected extends AppEngSlot
@Override
public ItemStack decrStackSize( final int par1 )
{
return null;
return ItemStack.EMPTY;
}
@Override
@@ -47,11 +47,6 @@ public class SlotME extends Slot
return null;
}
@Override
public void onPickupFromSlot( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack )
{
}
@Override
public boolean isItemValid( final ItemStack par1ItemStack )
{
@@ -21,6 +21,7 @@ package appeng.client.render;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
@@ -22,6 +22,7 @@ package appeng.client.render;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
@@ -53,7 +53,7 @@ public class StackSizeRenderer
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
fontRenderer.setUnicodeFlag( false );
if( is.stackSize == 0 )
if( is.getCount() == 0 )
{
final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft.getLocal();
GlStateManager.disableLighting();
@@ -70,7 +70,7 @@ public class StackSizeRenderer
GlStateManager.enableBlend();
}
final long amount = aeStack != null ? aeStack.getStackSize() : is.stackSize;
final long amount = aeStack != null ? aeStack.getStackSize() : is.getCount();
if( amount != 0 )
{
final String stackSize = this.getToBeRenderedStackSize( amount );
@@ -25,6 +25,8 @@ import java.util.EnumMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
@@ -41,6 +43,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.property.IExtendedBlockState;
import appeng.api.parts.IPartModel;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.block.networking.BlockCableBus;
@@ -81,8 +84,9 @@ public class CableBusBakedModel implements IBakedModel
List<BakedQuad> quads = new ArrayList<>();
// The core parts of the cable will only be rendered in the CUTOUT layer. TRANSLUCENT is used only for translucent facades further down below.
if ( layer == BlockRenderLayer.CUTOUT )
// The core parts of the cable will only be rendered in the CUTOUT layer. TRANSLUCENT is used only for
// translucent facades further down below.
if( layer == BlockRenderLayer.CUTOUT )
{
// First, handle the cable at the center of the cable bus
addCableQuads( renderState, quads );
@@ -90,13 +94,13 @@ public class CableBusBakedModel implements IBakedModel
// Then handle attachments
for( EnumFacing facing : EnumFacing.values() )
{
List<ResourceLocation> models = renderState.getAttachments().get( facing );
if( models == null )
final IPartModel partModel = renderState.getAttachments().get( facing );
if( partModel == null )
{
continue;
}
for( ResourceLocation model : models )
for( ResourceLocation model : partModel.getModels() )
{
IBakedModel bakedModel = partModels.get( model );
@@ -122,8 +126,7 @@ public class CableBusBakedModel implements IBakedModel
renderState.getBoundingBoxes(),
renderState.getAttachments().keySet(),
rand,
quads
);
quads );
return quads;
}
@@ -131,25 +134,30 @@ public class CableBusBakedModel implements IBakedModel
// Determines whether a cable is connected to exactly two sides that are opposite each other
private static boolean isStraightLine( AECableType cableType, EnumMap<EnumFacing, AECableType> sides )
{
Iterator<EnumFacing> it = sides.keySet().iterator();
final Iterator<Entry<EnumFacing, AECableType>> it = sides.entrySet().iterator();
if( !it.hasNext() )
{
return false; // No connections
}
EnumFacing firstSide = it.next();
AECableType firstType = sides.get( firstSide );
final Entry<EnumFacing, AECableType> nextConnection = it.next();
final EnumFacing firstSide = nextConnection.getKey();
final AECableType firstType = nextConnection.getValue();
if( !it.hasNext() )
{
return false; // Only a single connection
}
if( firstSide.getOpposite() != it.next() )
if( firstSide.getOpposite() != it.next().getKey() )
{
return false; // Connected to two sides that are not opposite each other
}
if (it.hasNext()) {
if( it.hasNext() )
{
return false; // Must not have any other connection points
}
AECableType secondType = sides.get( firstSide.getOpposite() );
final AECableType secondType = sides.get( firstSide.getOpposite() );
// Certain cable types have restrictions on when they're rendered as a straight connection
switch( cableType )
@@ -176,8 +184,8 @@ public class CableBusBakedModel implements IBakedModel
// If the connection is straight, no busses are attached, and no covered core has been forced (in case of glass
// cables), then render the cable as a simplified straight line.
boolean noAttachments = renderState.getAttachments().isEmpty();
if( isStraightLine( cableType, connectionTypes ) && noAttachments )
boolean noAttachments = !renderState.getAttachments().values().stream().anyMatch( IPartModel::requireCableConnection );
if( noAttachments && isStraightLine( cableType, connectionTypes ) )
{
EnumFacing facing = connectionTypes.keySet().iterator().next();
@@ -227,11 +235,12 @@ public class CableBusBakedModel implements IBakedModel
}
// Render all outgoing connections using the appropriate type
for( EnumFacing facing : connectionTypes.keySet() )
for( final Entry<EnumFacing, AECableType> connection : connectionTypes.entrySet() )
{
AECableType connectionType = connectionTypes.get( facing );
boolean cableBusAdjacent = renderState.getCableBusAdjacent().contains( facing );
int channels = renderState.getChannelsOnSide().get( facing );
final EnumFacing facing = connection.getKey();
final AECableType connectionType = connection.getValue();
final boolean cableBusAdjacent = renderState.getCableBusAdjacent().contains( facing );
final int channels = renderState.getChannelsOnSide().get( facing );
switch( cableType )
{
@@ -269,9 +278,9 @@ public class CableBusBakedModel implements IBakedModel
// If no core is present, just use the first part that comes into play
for( EnumFacing side : renderState.getAttachments().keySet() )
{
List<ResourceLocation> models = renderState.getAttachments().get( side );
IPartModel partModel = renderState.getAttachments().get( side );
for( ResourceLocation model : models )
for( ResourceLocation model : partModel.getModels() )
{
IBakedModel bakedModel = partModels.get( model );
@@ -282,9 +291,11 @@ public class CableBusBakedModel implements IBakedModel
TextureAtlasSprite particleTexture = bakedModel.getParticleTexture();
// If a part sub-model has no particle texture (indicated by it being the missing texture), don't add it,
// If a part sub-model has no particle texture (indicated by it being the missing texture), don't
// add
// it,
// so we don't get ugly missing texture break particles.
if ( textureMap.getMissingSprite() != particleTexture )
if( textureMap.getMissingSprite() != particleTexture )
{
result.add( particleTexture );
}
@@ -25,9 +25,9 @@ import java.util.EnumSet;
import java.util.List;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import appeng.api.parts.IPartModel;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
@@ -60,7 +60,7 @@ public class CableBusRenderState
// connections contains a corresponding entry.
private EnumMap<EnumFacing, Integer> channelsOnSide = new EnumMap<>( EnumFacing.class );
private EnumMap<EnumFacing, List<ResourceLocation>> attachments = new EnumMap<>( EnumFacing.class );
private EnumMap<EnumFacing, IPartModel> attachments = new EnumMap<>( EnumFacing.class );
// For each attachment, this contains the distance from the edge until which a cable connection should be drawn
private EnumMap<EnumFacing, Integer> attachmentConnections = new EnumMap<>( EnumFacing.class );
@@ -68,7 +68,8 @@ public class CableBusRenderState
// Contains the facade to use for each side that has a facade attached
private EnumMap<EnumFacing, FacadeRenderState> facades = new EnumMap<>( EnumFacing.class );
// Contains the bounding boxes of all parts on the cable bus to allow facades to cut out holes for the parts. This list is only populated if there are
// Contains the bounding boxes of all parts on the cable bus to allow facades to cut out holes for the parts. This
// list is only populated if there are
// facades on this cable bus
private List<AxisAlignedBB> boundingBoxes = new ArrayList<>();
@@ -132,7 +133,7 @@ public class CableBusRenderState
this.cableBusAdjacent = cableBusAdjacent;
}
public EnumMap<EnumFacing, List<ResourceLocation>> getAttachments()
public EnumMap<EnumFacing, IPartModel> getAttachments()
{
return attachments;
}
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.List;
import javax.vecmath.Vector4f;
import com.google.common.base.Preconditions;
@@ -173,10 +174,10 @@ public class CubeBuilder
putVertexTR( builder, face, x2, y2, z1, uv );
break;
case NORTH:
putVertexBR( builder, face, x2, y2, z1, uv );
putVertexTR( builder, face, x2, y1, z1, uv );
putVertexTL( builder, face, x2, y2, z1, uv );
putVertexTL( builder, face, x2, y1, z1, uv );
putVertexTL( builder, face, x1, y1, z1, uv );
putVertexBL( builder, face, x1, y2, z1, uv );
putVertexTL( builder, face, x1, y2, z1, uv );
break;
case SOUTH:
putVertexBL( builder, face, x1, y2, z2, uv );
@@ -26,6 +26,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import javax.vecmath.Vector3f;
@@ -2,6 +2,7 @@ package appeng.client.render.crafting;
import java.util.List;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
@@ -26,7 +26,7 @@ import net.minecraft.world.World;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.EffectType;
import appeng.core.CommonHelper;
import appeng.core.AppEng;
import appeng.entity.EntityFloatingItem;
import appeng.entity.ICanDie;
@@ -46,7 +46,7 @@ public class AssemblerFX extends Particle implements ICanDie
this.motionZ = 0;
this.speed = speed;
this.fi = new EntityFloatingItem( this, w, x, y, z, is.getItemStack() );
w.spawnEntityInWorld( this.fi );
w.spawnEntity( this.fi );
this.particleMaxAge = (int) Math.ceil( Math.max( 1, 100.0f / speed ) ) + 2;
}
@@ -76,7 +76,7 @@ public class AssemblerFX extends Particle implements ICanDie
}
this.motionY -= 0.04D * (double)this.particleGravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
@@ -99,10 +99,10 @@ public class AssemblerFX extends Particle implements ICanDie
if( this.time > 4.0 )
{
this.time -= 4.0;
// if ( CommonHelper.proxy.shouldAddParticles( r ) )
// if ( AppEng.proxy.shouldAddParticles( r ) )
for( int x = 0; x < (int) Math.ceil( this.speed / 5 ); x++ )
{
CommonHelper.proxy.spawnEffect( EffectType.Crafting, this.worldObj, this.posX, this.posY, this.posZ, null );
AppEng.proxy.spawnEffect( EffectType.Crafting, this.world, this.posX, this.posY, this.posZ, null );
}
}
}
@@ -55,9 +55,9 @@ public class CraftingFx extends ParticleBreaking
this.particleTextureIndex = ParticleTextures.BlockEnergyParticle;
this.particleMaxAge /= 1.2;
this.startBlkX = MathHelper.floor_double( this.posX );
this.startBlkY = MathHelper.floor_double( this.posY );
this.startBlkZ = MathHelper.floor_double( this.posZ );
this.startBlkX = MathHelper.floor( this.posX );
this.startBlkY = MathHelper.floor( this.posY );
this.startBlkZ = MathHelper.floor( this.posZ );
}
@Override
@@ -84,9 +84,9 @@ public class CraftingFx extends ParticleBreaking
float offY = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * partialTick );
float offZ = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * partialTick );
final int blkX = MathHelper.floor_double( offX );
final int blkY = MathHelper.floor_double( offY );
final int blkZ = MathHelper.floor_double( offZ );
final int blkX = MathHelper.floor( offX );
final int blkY = MathHelper.floor( offY );
final int blkZ = MathHelper.floor( offZ );
if( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
{
offX -= interpPosX;
@@ -127,7 +127,7 @@ public class CraftingFx extends ParticleBreaking
}
this.motionY -= 0.04D * (double) this.particleGravity;
this.moveEntity( this.motionX, this.motionY, this.motionZ );
this.move( this.motionX, this.motionY, this.motionZ );
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
@@ -54,9 +54,9 @@ public class EnergyFx extends ParticleBreaking
this.particleScale = 3.5f;
this.particleTextureIndex = ParticleTextures.BlockEnergyParticle;
this.startBlkX = MathHelper.floor_double( this.posX );
this.startBlkY = MathHelper.floor_double( this.posY );
this.startBlkZ = MathHelper.floor_double( this.posZ );
this.startBlkX = MathHelper.floor( this.posX );
this.startBlkY = MathHelper.floor( this.posY );
this.startBlkZ = MathHelper.floor( this.posZ );
}
@Override
@@ -78,9 +78,9 @@ public class EnergyFx extends ParticleBreaking
final float f12 = (float) ( this.prevPosY + ( this.posY - this.prevPosY ) * partialTicks - interpPosY );
final float f13 = (float) ( this.prevPosZ + ( this.posZ - this.prevPosZ ) * partialTicks - interpPosZ );
final int blkX = MathHelper.floor_double( this.posX );
final int blkY = MathHelper.floor_double( this.posY );
final int blkZ = MathHelper.floor_double( this.posZ );
final int blkX = MathHelper.floor( this.posX );
final int blkY = MathHelper.floor( this.posY );
final int blkZ = MathHelper.floor( this.posZ );
if( blkX == this.startBlkX && blkY == this.startBlkY && blkZ == this.startBlkZ )
{
@@ -117,7 +117,7 @@ public class EnergyFx extends ParticleBreaking
}
this.motionY -= 0.04D * (double) this.particleGravity;
this.moveEntity( this.motionX, this.motionY, this.motionZ );
this.move( this.motionX, this.motionY, this.motionZ );
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
@@ -89,7 +89,7 @@ public class LightningFX extends Particle
}
this.motionY -= 0.04D * (double)this.particleGravity;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
@@ -125,7 +125,7 @@ public class LightningFX extends Particle
double oy = 0;
double oz = 0;
final EntityPlayer p = Minecraft.getMinecraft().thePlayer;
final EntityPlayer p = Minecraft.getMinecraft().player;
double offX = -rZ;
double offY = MathHelper.cos( (float) ( Math.PI / 2.0f + p.rotationPitch * 0.017453292F ) );
double offZ = rX;
@@ -68,7 +68,7 @@ public class MatterCannonFX extends ParticleBreaking
}
this.motionY -= 0.04D * (double) this.particleGravity;
this.moveEntity( this.motionX, this.motionY, this.motionZ );
this.move( this.motionX, this.motionY, this.motionZ );
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
@@ -21,6 +21,7 @@ package appeng.client.render.model;
import java.util.ArrayList;
import java.util.List;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
@@ -4,6 +4,7 @@ package appeng.client.render.model;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
@@ -212,10 +212,10 @@ class GlassBakedModel implements IBakedModel
// Apply the u,v shift.
// This mirrors the logic from OffsetIcon from 1.7
float u1 = MathHelper.clamp_float( 0 - uOffset, 0, 16 );
float u2 = MathHelper.clamp_float( 16 - uOffset, 0, 16 );
float v1 = MathHelper.clamp_float( 0 - vOffset, 0, 16 );
float v2 = MathHelper.clamp_float( 16 - vOffset, 0, 16 );
float u1 = MathHelper.clamp( 0 - uOffset, 0, 16 );
float u2 = MathHelper.clamp( 16 - uOffset, 0, 16 );
float v1 = MathHelper.clamp( 0 - vOffset, 0, 16 );
float v2 = MathHelper.clamp( 16 - vOffset, 0, 16 );
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder( vertexFormat );
builder.setTexture( sprite );
@@ -32,6 +32,7 @@ import java.lang.reflect.Type;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;
import com.google.common.base.Charsets;
@@ -233,7 +233,7 @@ class SpatialPylonBakedModel implements IBakedModel
@Override
public TextureAtlasSprite getParticleTexture()
{
return null;
return this.textures.get( SpatialPylonTextureType.DIM );
}
@Override
@@ -50,7 +50,7 @@ public class SkyCompassTESR extends FastTESR<TileSkyCompass>
public void renderTileEntityFast( TileSkyCompass te, double x, double y, double z, float partialTicks, int destroyStage, VertexBuffer buffer )
{
if( !te.hasWorldObj() )
if( !te.hasWorld() )
{
return;
}
@@ -63,7 +63,7 @@ public class SkyCompassTESR extends FastTESR<TileSkyCompass>
BlockPos pos = te.getPos();
IBlockAccess world = MinecraftForgeClient.getRegionRenderCache( te.getWorld(), pos );
IBlockState state = world.getBlockState( pos );
if( state.getPropertyNames().contains( Properties.StaticProperty ) )
if( state.getPropertyKeys().contains( Properties.StaticProperty ) )
{
state = state.withProperty( Properties.StaticProperty, false );
}
@@ -203,7 +203,7 @@ public abstract class AEBaseContainer extends Container
final NBTTagCompound data = CompressedStreamTools.readCompressed( new ByteArrayInputStream( buffer ) );
if( data != null )
{
this.setTargetStack( AEApi.instance().storage().createItemStack( ItemStack.loadItemStackFromNBT( data ) ) );
this.setTargetStack( AEApi.instance().storage().createItemStack( new ItemStack( data ) ) );
}
}
catch( final IOException e )
@@ -455,7 +455,7 @@ public abstract class AEBaseContainer extends Container
{
if( Platform.isClient() )
{
return null;
return ItemStack.EMPTY;
}
boolean hasMETiles = false;
@@ -470,14 +470,14 @@ public abstract class AEBaseContainer extends Container
if( hasMETiles && Platform.isClient() )
{
return null;
return ItemStack.EMPTY;
}
final AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get( idx ); // require AE SLots!
if( clickSlot instanceof SlotDisabled || clickSlot instanceof SlotInaccessible )
{
return null;
return ItemStack.EMPTY;
}
if( clickSlot != null && clickSlot.getHasStack() )
{
@@ -485,7 +485,7 @@ public abstract class AEBaseContainer extends Container
if( tis == null )
{
return null;
return ItemStack.EMPTY;
}
final List<Slot> selectedSlots = new ArrayList<Slot>();
@@ -583,17 +583,17 @@ public abstract class AEBaseContainer extends Container
maxSize = d.getSlotStackLimit();
}
int placeAble = maxSize - t.stackSize;
int placeAble = maxSize - t.getCount();
if( tis.stackSize < placeAble )
if( tis.getCount() < placeAble )
{
placeAble = tis.stackSize;
placeAble = tis.getCount();
}
t.stackSize += placeAble;
tis.stackSize -= placeAble;
t.setCount( t.getCount() + placeAble );
tis.setCount( tis.getCount() - placeAble );
if( tis.stackSize <= 0 )
if( tis.getCount() <= 0 )
{
clickSlot.putStack( null );
d.onSlotChanged();
@@ -602,7 +602,7 @@ public abstract class AEBaseContainer extends Container
this.updateSlot( clickSlot );
this.updateSlot( d );
return null;
return ItemStack.EMPTY;
}
else
{
@@ -635,17 +635,17 @@ public abstract class AEBaseContainer extends Container
maxSize = d.getSlotStackLimit();
}
int placeAble = maxSize - t.stackSize;
int placeAble = maxSize - t.getCount();
if( tis.stackSize < placeAble )
if( tis.getCount() < placeAble )
{
placeAble = tis.stackSize;
placeAble = tis.getCount();
}
t.stackSize += placeAble;
tis.stackSize -= placeAble;
t.setCount( t.getCount() + placeAble );
tis.setCount( tis.getCount() - placeAble );
if( tis.stackSize <= 0 )
if( tis.getCount() <= 0 )
{
clickSlot.putStack( null );
d.onSlotChanged();
@@ -656,7 +656,7 @@ public abstract class AEBaseContainer extends Container
this.updateSlot( clickSlot );
this.updateSlot( d );
return null;
return ItemStack.EMPTY;
}
else
{
@@ -673,15 +673,15 @@ public abstract class AEBaseContainer extends Container
}
final ItemStack tmp = tis.copy();
if( tmp.stackSize > maxSize )
if( tmp.getCount() > maxSize )
{
tmp.stackSize = maxSize;
tmp.setCount( maxSize );
}
tis.stackSize -= tmp.stackSize;
tis.setCount( tis.getCount() - tmp.getCount() );
d.putStack( tmp );
if( tis.stackSize <= 0 )
if( tis.getCount() <= 0 )
{
clickSlot.putStack( null );
d.onSlotChanged();
@@ -692,7 +692,7 @@ public abstract class AEBaseContainer extends Container
this.updateSlot( clickSlot );
this.updateSlot( d );
return null;
return ItemStack.EMPTY;
}
else
{
@@ -707,7 +707,7 @@ public abstract class AEBaseContainer extends Container
}
this.updateSlot( clickSlot );
return null;
return ItemStack.EMPTY;
}
@Override
@@ -726,7 +726,7 @@ public abstract class AEBaseContainer extends Container
{
if( this.tileEntity instanceof IInventory )
{
return ( (IInventory) this.tileEntity ).isUseableByPlayer( entityplayer );
return ( (IInventory) this.tileEntity ).isUsableByPlayer( entityplayer );
}
return true;
}
@@ -781,7 +781,7 @@ public abstract class AEBaseContainer extends Container
if( hand != null )
{
final ItemStack is = hand.copy();
is.stackSize = 1;
is.setCount( 1 );
s.putStack( is );
}
@@ -793,16 +793,16 @@ public abstract class AEBaseContainer extends Container
{
if( hand == null )
{
is.stackSize = Math.max( 1, is.stackSize - 1 );
is.setCount( Math.max( 1, is.getCount() - 1 ) );
}
else if( hand.isItemEqual( is ) )
{
is.stackSize = Math.min( is.getMaxStackSize(), is.stackSize + 1 );
is.setCount(Math.min( is.getMaxStackSize(), is.getCount() + 1 ));
}
else
{
is = hand.copy();
is.stackSize = 1;
is.setCount( 1 );
}
s.putStack( is );
@@ -810,7 +810,7 @@ public abstract class AEBaseContainer extends Container
else if( hand != null )
{
is = hand.copy();
is.stackSize = 1;
is.setCount( 1 );
s.putStack( is );
}
@@ -863,12 +863,12 @@ public abstract class AEBaseContainer extends Container
ais.setStackSize( myItem.getMaxStackSize() );
final InventoryAdaptor adp = InventoryAdaptor.getAdaptor( player, EnumFacing.UP );
myItem.stackSize = (int) ais.getStackSize();
myItem.setCount( (int) ais.getStackSize() );
myItem = adp.simulateAdd( myItem );
if( myItem != null )
{
ais.setStackSize( ais.getStackSize() - myItem.stackSize );
ais.setStackSize( ais.getStackSize() - myItem.getCount() );
}
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
@@ -923,7 +923,7 @@ public abstract class AEBaseContainer extends Container
if( item != null )
{
if( item.stackSize >= item.getMaxStackSize() )
if( item.getCount() >= item.getMaxStackSize() )
{
liftQty = 0;
}
@@ -1034,8 +1034,8 @@ public abstract class AEBaseContainer extends Container
if( ais == null )
{
final ItemStack is = player.inventory.getItemStack();
is.stackSize--;
if( is.stackSize <= 0 )
is.setCount( is.getCount() - 1 );
if( is.getCount() <= 0 )
{
player.inventory.setItemStack( null );
}
@@ -1048,7 +1048,7 @@ public abstract class AEBaseContainer extends Container
if( player.capabilities.isCreativeMode && slotItem != null )
{
final ItemStack is = slotItem.getItemStack();
is.stackSize = is.getMaxStackSize();
is.setCount( is.getMaxStackSize() );
player.inventory.setItemStack( is );
this.updateHeld( player );
}
@@ -1071,12 +1071,12 @@ public abstract class AEBaseContainer extends Container
ais.setStackSize( myItem.getMaxStackSize() );
final InventoryAdaptor adp = InventoryAdaptor.getAdaptor( player, EnumFacing.UP );
myItem.stackSize = (int) ais.getStackSize();
myItem.setCount( (int) ais.getStackSize() );
myItem = adp.simulateAdd( myItem );
if( myItem != null )
{
ais.setStackSize( ais.getStackSize() - myItem.stackSize );
ais.setStackSize( ais.getStackSize() - myItem.getCount() );
}
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
@@ -1103,7 +1103,8 @@ public abstract class AEBaseContainer extends Container
{
try
{
NetworkHandler.instance().sendTo( new PacketInventoryAction( InventoryAction.UPDATE_HAND, 0, AEItemStack.create( p.inventory.getItemStack() ) ), p );
NetworkHandler.instance().sendTo( new PacketInventoryAction( InventoryAction.UPDATE_HAND, 0, AEItemStack.create( p.inventory.getItemStack() ) ),
p );
}
catch( final IOException e )
{
@@ -1118,7 +1119,8 @@ public abstract class AEBaseContainer extends Container
{
return input;
}
final IAEItemStack ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), AEApi.instance().storage().createItemStack( input ), this.getActionSource() );
final IAEItemStack ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), AEApi.instance().storage().createItemStack( input ),
this.getActionSource() );
if( ais == null )
{
return null;
@@ -1172,7 +1174,8 @@ public abstract class AEBaseContainer extends Container
{
try
{
NetworkHandler.instance().sendTo( new PacketValueConfig( "CustomName", this.getCustomName() ), (EntityPlayerMP) this.getInventoryPlayer().player );
NetworkHandler.instance().sendTo( new PacketValueConfig( "CustomName", this.getCustomName() ),
(EntityPlayerMP) this.getInventoryPlayer().player );
}
catch( final IOException e )
{
@@ -1232,32 +1235,32 @@ public abstract class AEBaseContainer extends Container
ItemStack testB = isA == null ? null : isA.copy();
// can put some back?
if( testA != null && testA.stackSize > a.getSlotStackLimit() )
if( testA != null && testA.getCount() > a.getSlotStackLimit() )
{
if( testB != null )
{
return;
}
final int totalA = testA.stackSize;
testA.stackSize = a.getSlotStackLimit();
final int totalA = testA.getCount();
testA.setCount( a.getSlotStackLimit() );
testB = testA.copy();
testB.stackSize = totalA - testA.stackSize;
testB.setCount( totalA - testA.getCount() );
}
if( testB != null && testB.stackSize > b.getSlotStackLimit() )
if( testB != null && testB.getCount() > b.getSlotStackLimit() )
{
if( testA != null )
{
return;
}
final int totalB = testB.stackSize;
testB.stackSize = b.getSlotStackLimit();
final int totalB = testB.getCount();
testB.setCount( b.getSlotStackLimit() );
testA = testB.copy();
testA.stackSize = totalB - testA.stackSize;
testA.setCount( totalB - testA.getCount() );
}
a.putStack( testA );
@@ -243,7 +243,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
if( i.hasNext() )
{
final ItemStack g = i.next().getItemStack();
g.stackSize = 1;
g.setCount( 1 );
inv.setInventorySlotContents( x, g );
}
else
@@ -331,7 +331,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
}
@Override
public boolean isUseableByPlayer( final EntityPlayer entityplayer )
public boolean isUsableByPlayer( EntityPlayer player )
{
return false;
}
@@ -383,5 +383,12 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
{
ContainerCellWorkbench.this.getCellUpgradeInventory().clear();
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
}
@@ -66,7 +66,7 @@ public class ContainerCraftAmount extends AEBaseContainer
public World getWorld()
{
return this.getPlayerInv().player.worldObj;
return this.getPlayerInv().player.world;
}
public BaseActionSource getActionSrc()
@@ -279,7 +279,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
}
catch( final Throwable e )
{
this.getPlayerInv().player.addChatMessage( new TextComponentString( "Error: " + e.toString() ) );
this.getPlayerInv().player.sendMessage( new TextComponentString( "Error: " + e.toString() ) );
AELog.debug( e );
this.setValidContainer( false );
this.result = null;
@@ -389,7 +389,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
public World getWorld()
{
return this.getPlayerInv().player.worldObj;
return this.getPlayerInv().player.world;
}
public boolean isAutoStart()
@@ -31,6 +31,7 @@ import appeng.api.networking.crafting.ICraftingCPU;
import appeng.api.networking.crafting.ICraftingGrid;
import appeng.api.storage.ITerminalHost;
import appeng.container.guisync.GuiSync;
import appeng.util.Platform;
public class ContainerCraftingStatus extends ContainerCraftingCPU
@@ -52,50 +53,53 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
@Override
public void detectAndSendChanges()
{
final ICraftingGrid cc = this.getNetwork().getCache( ICraftingGrid.class );
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
int matches = 0;
boolean changed = false;
for( final ICraftingCPU c : cpuSet )
if( Platform.isServer() && this.getNetwork() != null )
{
boolean found = false;
for( final CraftingCPURecord ccr : this.cpus )
{
if( ccr.getCpu() == c )
{
found = true;
}
}
final ICraftingGrid cc = this.getNetwork().getCache( ICraftingGrid.class );
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
final boolean matched = this.cpuMatches( c );
if( matched )
{
matches++;
}
if( found == !matched )
{
changed = true;
}
}
if( changed || this.cpus.size() != matches )
{
this.cpus.clear();
int matches = 0;
boolean changed = false;
for( final ICraftingCPU c : cpuSet )
{
if( this.cpuMatches( c ) )
boolean found = false;
for( final CraftingCPURecord ccr : this.cpus )
{
this.cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
if( ccr.getCpu() == c )
{
found = true;
}
}
final boolean matched = this.cpuMatches( c );
if( matched )
{
matches++;
}
if( found == !matched )
{
changed = true;
}
}
this.sendCPUs();
}
if( changed || this.cpus.size() != matches )
{
this.cpus.clear();
for( final ICraftingCPU c : cpuSet )
{
if( this.cpuMatches( c ) )
{
this.cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
}
}
this.noCPU = this.cpus.isEmpty();
this.sendCPUs();
}
this.noCPU = this.cpus.isEmpty();
}
super.detectAndSendChanges();
}
@@ -80,7 +80,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
ic.setInventorySlotContents( x, this.craftingSlots[x].getStack() );
}
this.outputSlot.putStack( CraftingManager.getInstance().findMatchingRecipe( ic, this.getPlayerInv().player.worldObj ) );
this.outputSlot.putStack( CraftingManager.getInstance().findMatchingRecipe( ic, this.getPlayerInv().player.world ) );
}
@Override
@@ -268,7 +268,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
}
else if( is != null )
{
ItemStack extra = interfaceSlot.removeItems( ( is.stackSize + 1 ) / 2, null, null );
ItemStack extra = interfaceSlot.removeItems( ( is.getCount() + 1 ) / 2, null, null );
if( extra != null )
{
extra = playerHand.addItems( extra );
@@ -125,35 +125,28 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
if( !this.isCraftingMode() )
{
this.craftSlot.xDisplayPosition = -9000;
this.craftSlot.xPos = -9000;
for( int y = 0; y < 3; y++ )
{
this.outputSlots[y].xDisplayPosition = this.outputSlots[y].getX();
this.outputSlots[y].xPos = this.outputSlots[y].getX();
}
}
else
{
this.craftSlot.xDisplayPosition = this.craftSlot.getX();
this.craftSlot.xPos = this.craftSlot.getX();
for( int y = 0; y < 3; y++ )
{
this.outputSlots[y].xDisplayPosition = -9000;
this.outputSlots[y].xPos = -9000;
}
}
}
@Override
public void putStackInSlot( final int par1, final ItemStack par2ItemStack )
public void putStackInSlot( int slotID, ItemStack stack )
{
super.putStackInSlot( par1, par2ItemStack );
this.getAndUpdateOutput();
}
@Override
public void putStacksInSlots( final ItemStack[] par1ArrayOfItemStack )
{
super.putStacksInSlots( par1ArrayOfItemStack );
super.putStackInSlot( slotID, stack );
this.getAndUpdateOutput();
}
@@ -166,7 +159,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
ic.setInventorySlotContents( x, this.crafting.getStackInSlot( x ) );
}
final ItemStack is = CraftingManager.getInstance().findMatchingRecipe( ic, this.getPlayerInv().player.worldObj );
final ItemStack is = CraftingManager.getInstance().findMatchingRecipe( ic, this.getPlayerInv().player.world );
this.cOut.setInventorySlotContents( 0, is );
return is;
}
@@ -210,8 +203,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
}
// remove one, and clear the input slot.
output.stackSize--;
if( output.stackSize == 0 )
output.setCount( output.getCount() );
if( output.getCount() == 0 )
{
this.patternSlotIN.putStack( null );
}
@@ -277,7 +270,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
final ItemStack out = this.getAndUpdateOutput();
if( out != null && out.stackSize > 0 )
if( out != null && out.getCount() > 0 )
{
return new ItemStack[] { out };
}
@@ -291,7 +284,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
final ItemStack out = outputSlot.getStack();
if( out != null && out.stackSize > 0 )
if( out != null && out.getCount() > 0 )
{
list.add( out );
hasValue = true;
@@ -391,7 +384,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
ic.setInventorySlotContents( x, packetPatternSlot.pattern[x] == null ? null : packetPatternSlot.pattern[x].getItemStack() );
}
final IRecipe r = Platform.findMatchingRecipe( ic, p.worldObj );
final IRecipe r = Platform.findMatchingRecipe( ic, p.world );
if( r == null )
{
@@ -407,17 +400,17 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
if( ic.getStackInSlot( x ) != null )
{
final ItemStack pulled = Platform.extractItemsByRecipe( this.getPowerSource(), this.getActionSource(), storage, p.worldObj, r, is, ic, ic.getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.getViewCells() ) );
final ItemStack pulled = Platform.extractItemsByRecipe( this.getPowerSource(), this.getActionSource(), storage, p.world, r, is, ic, ic.getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.getViewCells() ) );
real.setInventorySlotContents( x, pulled );
}
}
final IRecipe rr = Platform.findMatchingRecipe( real, p.worldObj );
final IRecipe rr = Platform.findMatchingRecipe( real, p.world );
if( rr == r && Platform.itemComparisons().isSameItem( rr.getCraftingResult( real ), is ) )
{
final SlotCrafting sc = new SlotCrafting( p, real, this.cOut, 0, 0, 0 );
sc.onPickupFromSlot( p, is );
sc.onTake( p, is );
for( int x = 0; x < real.getSizeInventory(); x++ )
{
@@ -128,9 +128,9 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
public ItemStack getStackInSlot( final int var1 )
{
final ItemStack input = this.inSlot.getStackInSlot( 0 );
if( input == null )
if( input == ItemStack.EMPTY )
{
return null;
return ItemStack.EMPTY;
}
if( SlotRestrictedInput.isMetalIngot( input ) )
@@ -147,7 +147,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
}
}
return null;
return ItemStack.EMPTY;
}
@Override
@@ -161,7 +161,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
return is;
}
}
return null;
return ItemStack.EMPTY;
}
private boolean makePlate()
@@ -171,9 +171,9 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
final ItemStack item = this.toolInv.getItemStack();
item.damageItem( 1, this.getPlayerInv().player );
if( item.stackSize == 0 )
if( item.getCount() == 0 )
{
this.getPlayerInv().mainInventory[this.getPlayerInv().currentItem] = null;
this.getPlayerInv().mainInventory.add( this.getPlayerInv().currentItem, null );
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( this.getPlayerInv().player, item, null ) );
}
@@ -185,7 +185,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
@Override
public ItemStack removeStackFromSlot( final int var1 )
{
return null;
return ItemStack.EMPTY;
}
@Override
@@ -222,7 +222,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
}
@Override
public boolean isUseableByPlayer( final EntityPlayer var1 )
public boolean isUsableByPlayer( EntityPlayer player )
{
return false;
}
@@ -274,4 +274,11 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
{
this.inSlot.setInventorySlotContents( 0, null );
}
@Override
public boolean isEmpty()
{
// TODO Auto-generated method stub
return false;
}
}
@@ -160,7 +160,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
if( i.hasNext() && this.isSlotEnabled( ( x / 9 ) - 2 ) )
{
final ItemStack g = i.next().getItemStack();
g.stackSize = 1;
g.setCount( 1 );
inv.setInventorySlotContents( x, g );
}
else
@@ -51,7 +51,7 @@ public class ContainerWireless extends AEBaseContainer
@Override
public void detectAndSendChanges()
{
final int boosters = this.boosterSlot.getStack() == null ? 0 : this.boosterSlot.getStack().stackSize;
final int boosters = this.boosterSlot.getStack() == null ? 0 : this.boosterSlot.getStack().getCount();
this.setRange( (long) ( 10 * AEConfig.instance().wireless_getMaxRange( boosters ) ) );
this.setDrain( (long) ( 100 * AEConfig.instance().wireless_getPowerDrain( boosters ) ) );
@@ -47,7 +47,7 @@ public class ContainerWirelessTerm extends ContainerMEPortableCell
{
if( Platform.isServer() && this.isValidContainer() )
{
this.getPlayerInv().player.addChatMessage( PlayerMessages.OutOfRange.get() );
this.getPlayerInv().player.sendMessage( PlayerMessages.OutOfRange.get() );
}
this.setValidContainer( false );
@@ -32,6 +32,7 @@ import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.stats.AchievementList;
import net.minecraft.util.NonNullList;
public class AppEngCraftingSlot extends AppEngSlot
@@ -85,7 +86,7 @@ public class AppEngCraftingSlot extends AppEngSlot
@Override
protected void onCrafting( final ItemStack par1ItemStack )
{
par1ItemStack.onCrafting( this.thePlayer.worldObj, this.thePlayer, this.amountCrafted );
par1ItemStack.onCrafting( this.thePlayer.world, this.thePlayer, this.amountCrafted );
this.amountCrafted = 0;
if( par1ItemStack.getItem() == Item.getItemFromBlock( Blocks.CRAFTING_TABLE ) )
@@ -140,7 +141,7 @@ public class AppEngCraftingSlot extends AppEngSlot
}
@Override
public void onPickupFromSlot( final EntityPlayer playerIn, final ItemStack stack )
public ItemStack onTake( final EntityPlayer playerIn, final ItemStack stack )
{
net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent( playerIn, stack, this.craftMatrix );
this.onCrafting( stack );
@@ -152,7 +153,7 @@ public class AppEngCraftingSlot extends AppEngSlot
ic.setInventorySlotContents( x, this.craftMatrix.getStackInSlot( x ) );
}
final ItemStack[] aitemstack = CraftingManager.getInstance().getRemainingItems( ic, playerIn.worldObj );
final NonNullList<ItemStack> aitemstack = CraftingManager.getInstance().getRemainingItems( ic, playerIn.world );
for( int x = 0; x < this.craftMatrix.getSizeInventory(); x++ )
{
@@ -161,10 +162,10 @@ public class AppEngCraftingSlot extends AppEngSlot
net.minecraftforge.common.ForgeHooks.setCraftingPlayer( null );
for( int i = 0; i < aitemstack.length; ++i )
for( int i = 0; i < aitemstack.size(); ++i )
{
final ItemStack itemstack1 = this.craftMatrix.getStackInSlot( i );
final ItemStack itemstack2 = aitemstack[i];
final ItemStack itemstack2 = aitemstack.get( i );
if( itemstack1 != null )
{
@@ -183,6 +184,8 @@ public class AppEngCraftingSlot extends AppEngSlot
}
}
}
return stack;
}
/**
@@ -194,7 +197,7 @@ public class AppEngCraftingSlot extends AppEngSlot
{
if( this.getHasStack() )
{
this.amountCrafted += Math.min( par1, this.getStack().stackSize );
this.amountCrafted += Math.min( par1, this.getStack().getCount() );
}
return super.decrStackSize( par1 );
@@ -85,12 +85,12 @@ public class AppEngSlot extends Slot
{
if( !this.isEnabled() )
{
return null;
return ItemStack.EMPTY;
}
if( this.inventory.getSizeInventory() <= this.getSlotIndex() )
{
return null;
return ItemStack.EMPTY;
}
if( this.isDisplay() )
@@ -40,9 +40,9 @@ public class NullSlot extends Slot
}
@Override
public void onPickupFromSlot( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack )
public ItemStack onTake( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack )
{
return par2ItemStack;
}
@Override
@@ -54,7 +54,7 @@ public class NullSlot extends Slot
@Override
public ItemStack getStack()
{
return null;
return ItemStack.EMPTY;
}
@Override
@@ -78,7 +78,7 @@ public class NullSlot extends Slot
@Override
public ItemStack decrStackSize( final int par1 )
{
return null;
return ItemStack.EMPTY;
}
@Override
@@ -37,13 +37,13 @@ public class OptionalSlotFakeTypeOnly extends OptionalSlotFake
if( is != null )
{
is = is.copy();
if( is.stackSize > 1 )
if( is.getCount() > 1 )
{
is.stackSize = 1;
is.setCount( 1 );
}
else if( is.stackSize < -1 )
else if( is.getCount() < -1 )
{
is.stackSize = -1;
is.setCount( -1 );
}
}
@@ -81,8 +81,9 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
}
@Override
public void onPickupFromSlot( final EntityPlayer p, final ItemStack is )
public ItemStack onTake( final EntityPlayer p, final ItemStack is )
{
return is;
}
public void doClick( final InventoryAction action, final EntityPlayer who )
@@ -97,7 +98,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
}
final IMEMonitor<IAEItemStack> inv = this.storage.getItemInventory();
final int howManyPerCraft = this.getStack().stackSize;
final int howManyPerCraft = this.getStack().getCount();
int maxTimesToCraft = 0;
InventoryAdaptor ia = null;
@@ -141,7 +142,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
{
final List<ItemStack> drops = new ArrayList<ItemStack>();
drops.add( extra );
Platform.spawnDrops( who.worldObj, new BlockPos( (int) who.posX, (int) who.posY, (int) who.posZ ), drops );
Platform.spawnDrops( who.world, new BlockPos( (int) who.posX, (int) who.posY, (int) who.posZ ), drops );
return;
}
}
@@ -171,7 +172,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
ic.setInventorySlotContents( x, this.getPattern().getStackInSlot( x ) );
}
final IRecipe r = Platform.findMatchingRecipe( ic, p.worldObj );
final IRecipe r = Platform.findMatchingRecipe( ic, p.world );
if( r == null )
{
@@ -193,13 +194,13 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
}
if( !isBad )
{
super.onPickupFromSlot( p, is );
super.onTake( p, is );
// actually necessary to cleanup this case...
p.openContainer.onCraftMatrixChanged( this.craftInv );
return request;
}
}
return null;
return ItemStack.EMPTY;
}
is = r.getCraftingResult( ic );
@@ -210,7 +211,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
{
if( this.getPattern().getStackInSlot( x ) != null )
{
set[x] = Platform.extractItemsByRecipe( this.energySrc, this.mySrc, inv, p.worldObj, r, is, ic, this.getPattern().getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.container.getViewCells() ) );
set[x] = Platform.extractItemsByRecipe( this.energySrc, this.mySrc, inv, p.world, r, is, ic, this.getPattern().getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.container.getViewCells() ) );
ic.setInventorySlotContents( x, set[x] );
}
}
@@ -230,7 +231,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
return is;
}
return null;
return ItemStack.EMPTY;
}
private boolean preCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result )
@@ -240,7 +241,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
private void makeItem( final EntityPlayer p, final ItemStack is )
{
super.onPickupFromSlot( p, is );
super.onTake( p, is );
}
private void postCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result )
@@ -271,7 +272,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
if( drops.size() > 0 )
{
Platform.spawnDrops( p.worldObj, new BlockPos( (int) p.posX, (int) p.posY, (int) p.posZ ), drops );
Platform.spawnDrops( p.world, new BlockPos( (int) p.posX, (int) p.posY, (int) p.posZ ), drops );
}
}
@@ -33,14 +33,15 @@ public class SlotFake extends AppEngSlot
}
@Override
public void onPickupFromSlot( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack )
public ItemStack onTake( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack )
{
return par2ItemStack;
}
@Override
public ItemStack decrStackSize( final int par1 )
{
return null;
return ItemStack.EMPTY;
}
@Override
@@ -47,7 +47,7 @@ public class SlotFakeBlacklist extends SlotFakeTypeOnly
{
if( this.getHasStack() )
{
return this.getStack().stackSize > 0 ? 16 + 14 : 14;
return this.getStack().getCount() > 0 ? 16 + 14 : 14;
}
return -1;
}
@@ -37,13 +37,13 @@ public class SlotFakeTypeOnly extends SlotFake
if( is != null )
{
is = is.copy();
if( is.stackSize > 1 )
if( is.getCount() > 1 )
{
is.stackSize = 1;
is.setCount( 1 );
}
else if( is.stackSize < -1 )
else if( is.getCount() < -1 )
{
is.stackSize = -1;
is.setCount( -1 );
}
}
@@ -130,7 +130,7 @@ public class SlotRestrictedInput extends AppEngSlot
if( i.getItem() instanceof ICraftingPatternItem )
{
final ICraftingPatternItem b = (ICraftingPatternItem) i.getItem();
final ICraftingPatternDetails de = b.getPatternForItem( i, this.p.player.worldObj );
final ICraftingPatternDetails de = b.getPatternForItem( i, this.p.player.world );
if( de != null )
{
return de.isCraftable();
+19 -2
View File
@@ -24,8 +24,11 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Stream;
import com.google.common.collect.Sets;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
@@ -99,6 +102,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
// Grindstone
private String[] grinderOres = Stream.of( ORES_VANILLA, ORES_AE, ORES_COMMON, ORES_MISC ).flatMap( Stream::of ).toArray( String[]::new );
private Set<String> grinderBlackList;
private double oreDoublePercentage = 90.0;
// Batteries
@@ -153,8 +157,16 @@ public final class AEConfig extends Configuration implements IConfigurableObject
this.removeCrashingItemsOnLoad = this.get( "general", "removeCrashingItemsOnLoad", false,
"Will auto-remove items that crash when being loaded from storage. This will destroy those items instead of crashing the game!" ).getBoolean();
this.grinderOres = this.get( "GrindStone", "grinderOres", this.grinderOres ).getStringList();
this.oreDoublePercentage = this.get( "GrindStone", "oreDoublePercentage", this.oreDoublePercentage ).getDouble( this.oreDoublePercentage );
this.setCategoryComment( "GrindStone",
"Creates recipe of the following pattern automatically: '1 oreTYPE => 2 dustTYPE' and '(1 ingotTYPE or 1 crystalTYPE or 1 gemTYPE) => 1 dustTYPE'" );
this.grinderOres = this.get( "GrindStone", "grinderOres", this.grinderOres, "The list of types to handle. Specify without a prefix like ore or dust." )
.getStringList();
this.grinderBlackList = Sets.newHashSet(
this.get( "GrindStone", "blacklist", new String[] {}, "Blacklists the exact oredict name from being handled by any recipe." )
.getStringList() );
this.oreDoublePercentage = this
.get( "GrindStone", "oreDoublePercentage", this.oreDoublePercentage, "Chance to actually get an output with stacksize > 1." )
.getDouble( this.oreDoublePercentage );
this.settings.registerSetting( Settings.SEARCH_TOOLTIPS, YesNo.YES );
this.settings.registerSetting( Settings.TERMINAL_STYLE, TerminalStyle.TALL );
@@ -632,6 +644,11 @@ public final class AEConfig extends Configuration implements IConfigurableObject
return grinderOres;
}
public Set<String> getGrinderBlackList()
{
return this.grinderBlackList;
}
public double getOreDoublePercentage()
{
return oreDoublePercentage;
+2 -2
View File
@@ -290,11 +290,11 @@ public final class AELog
*
* @param message String to be logged
*/
public static void grinder( @Nonnull final String message )
public static void grinder( @Nonnull final String message, final Object... params )
{
if( AEConfig.instance().isFeatureEnabled( AEFeature.GRINDER_LOGGING ) )
{
log( Level.DEBUG, "grinder: " + message );
log( Level.DEBUG, "grinder: " + message, params );
}
}
+14 -9
View File
@@ -22,6 +22,7 @@ package appeng.core;
import java.io.File;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnull;
import com.google.common.base.Stopwatch;
@@ -32,6 +33,7 @@ import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
@@ -63,9 +65,12 @@ import appeng.services.version.VersionCheckerConfig;
import appeng.util.Platform;
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.10.2]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.11]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
public final class AppEng
{
@SidedProxy( clientSide = "appeng.client.ClientHelper", serverSide = "appeng.server.ServerHelper", modId = AppEng.MOD_ID )
public static CommonHelper proxy;
public static final String MOD_ID = "appliedenergistics2";
public static final String MOD_NAME = "Applied Energistics 2";
@@ -77,11 +82,11 @@ public final class AppEng
// "after:gregtech_addon;after:Mekanism;after:IC2;after:ThermalExpansion;after:BuildCraft|Core;" +
// depend on version of forge used for build.
"after:appliedenergistics2-core;" + "required-after:Forge@[" // require forge.
+ net.minecraftforge.common.ForgeVersion.majorVersion + '.' // majorVersion
+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion + ",)"; // buildVersion
"after:appliedenergistics2-core;";// + "required-after:Forge@[" // require forge.
//+ net.minecraftforge.common.ForgeVersion.majorVersion + '.' // majorVersion
//+ net.minecraftforge.common.ForgeVersion.minorVersion + '.' // minorVersion
//+ net.minecraftforge.common.ForgeVersion.revisionVersion + '.' // revisionVersion
//+ net.minecraftforge.common.ForgeVersion.buildVersion + ",)"; // buildVersion
@Nonnull
private static final AppEng INSTANCE = new AppEng();
@@ -128,7 +133,7 @@ public final class AppEng
{
if( !Loader.isModLoaded( "appliedenergistics2-core" ) )
{
CommonHelper.proxy.missingCoreMod();
AppEng.proxy.missingCoreMod();
}
final Stopwatch watch = Stopwatch.createStarted();
@@ -160,7 +165,7 @@ public final class AppEng
if( Platform.isClient() )
{
CommonHelper.proxy.preinit();
AppEng.proxy.preinit();
}
if( versionCheckerConfig.isVersionCheckingEnabled() )
@@ -225,7 +230,7 @@ public final class AppEng
IntegrationRegistry.INSTANCE.postInit();
FMLCommonHandler.instance().registerCrashCallable( new IntegrationCrashEnhancement() );
CommonHelper.proxy.postInit();
AppEng.proxy.postInit();
AEConfig.instance().save();
NetworkRegistry.INSTANCE.registerGuiHandler( this, GuiBridge.GUI_Handler );
+1 -4
View File
@@ -26,7 +26,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.SidedProxy;
import appeng.api.parts.CableRenderMode;
import appeng.block.AEBaseBlock;
@@ -37,8 +36,6 @@ import appeng.core.sync.AppEngPacket;
public abstract class CommonHelper
{
@SidedProxy( clientSide = "appeng.client.ClientHelper", serverSide = "appeng.server.ServerHelper" )
public static CommonHelper proxy;
public abstract void preinit();
@@ -52,7 +49,7 @@ public abstract class CommonHelper
public abstract void sendToAllNearExcept( EntityPlayer p, double x, double y, double z, double dist, World w, AppEngPacket packet );
public abstract void spawnEffect( EffectType effect, World worldObj, double posX, double posY, double posZ, Object extra );
public abstract void spawnEffect( EffectType effect, World world, double posX, double posY, double posZ, Object extra );
public abstract boolean shouldAddParticles( Random r );
+2 -3
View File
@@ -23,7 +23,6 @@ import java.util.Optional;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
@@ -49,9 +48,9 @@ public final class CreativeTab extends CreativeTabs
}
@Override
public Item getTabIconItem()
public ItemStack getTabIconItem()
{
return this.getIconItemStack().getItem();
return this.getIconItemStack();
}
@Override
@@ -46,9 +46,9 @@ public final class CreativeTabFacade extends CreativeTabs
}
@Override
public Item getTabIconItem()
public ItemStack getTabIconItem()
{
return this.getIconItemStack().getItem();
return this.getIconItemStack();
}
@Override
+3 -2
View File
@@ -22,6 +22,7 @@ package appeng.core;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nonnull;
import com.google.common.base.Preconditions;
@@ -57,8 +58,8 @@ import appeng.api.parts.IPartHelper;
import appeng.capabilities.Capabilities;
import appeng.core.features.AEFeature;
import appeng.core.features.registries.P2PTunnelRegistry;
import appeng.core.features.registries.entries.BasicCellHandler;
import appeng.core.features.registries.entries.CreativeCellHandler;
import appeng.core.features.registries.cell.BasicCellHandler;
import appeng.core.features.registries.cell.CreativeCellHandler;
import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
import appeng.core.stats.PlayerStatsRegistration;

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