Merge branch '1.9.4'

This commit is contained in:
cpw committed 2016-05-31 00:34:03 -04:00
commit caa61e1be9
332 files changed
+3806 -3131

No files matched your search

@@ -99,7 +99,7 @@ public class ClientCommandHandler extends CommandHandler
private TextComponentTranslation format(TextFormatting color, String str, Object... args)
{
TextComponentTranslation ret = new TextComponentTranslation(str, args);
ret.getChatStyle().setColor(color);
ret.getStyle().setColor(color);
return ret;
}
@@ -2,35 +2,42 @@ package net.minecraftforge.client;
import net.minecraft.util.Util.EnumOS;
import net.minecraft.world.WorldSettings.GameType;
import net.minecraft.client.settings.GameSettings.Options;
import net.minecraft.client.settings.GameSettings.Options;
import net.minecraftforge.common.util.EnumHelper;
public class EnumHelperClient extends EnumHelper
{
private static Class<?>[][] clientTypes =
{
{GameType.class, int.class, String.class},
{GameType.class, int.class, String.class, String.class},
{Options.class, String.class, boolean.class, boolean.class},
{EnumOS.class}
};
public static GameType addGameType(String name, int id, String displayName)
public static GameType addGameType(String name, int id, String displayName, String shortName)
{
return addEnum(GameType.class, name, id, displayName);
return addEnum(GameType.class, name, id, displayName, shortName);
}
public static Options addOptions(String name, String langName, boolean isSlider, boolean isToggle)
{
return addEnum(Options.class, name, langName, isSlider, isToggle);
}
public static Options addOptions(String name, String langName, boolean isSlider, boolean isToggle, float valMin, float valMax, float valStep)
{
return addEnum(Options.class, name,
new Class<?>[]{String.class, boolean.class, boolean.class, float.class, float.class, float.class},
langName, isSlider, isToggle, valMin, valMax, valStep);
}
public static EnumOS addOS2(String name)
{
return addEnum(EnumOS.class, name);
}
public static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
private static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
{
return addEnum(clientTypes, enumType, enumName, paramValues);
}
}
}
@@ -69,7 +69,7 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.BossInfoLerping;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import net.minecraftforge.client.event.EntityViewRenderEvent;
import net.minecraftforge.client.event.FOVUpdateEvent;
@@ -249,7 +249,7 @@ public class ForgeHooksClient
for (int z = -distance; z <= distance; ++z)
{
BlockPos pos = center.add(x, 0, z);
BiomeGenBase biome = world.getBiomeGenForCoords(pos);
Biome biome = world.getBiomeGenForCoords(pos);
int colour = biome.getSkyColorByTemp(biome.getFloatTemperature(pos));
r += (colour & 0xFF0000) >> 16;
g += (colour & 0x00FF00) >> 8;
@@ -113,7 +113,7 @@ public class GuiIngameForge extends GuiIngame
if (renderHelmet) renderHelmet(res, partialTicks);
if (renderPortal && !mc.thePlayer.isPotionActive(MobEffects.confusion))
if (renderPortal && !mc.thePlayer.isPotionActive(MobEffects.NAUSEA))
{
renderPortal(res, partialTicks);
}
@@ -193,7 +193,7 @@ public class GuiIngameForge extends GuiIngame
protected void renderCrosshairs(float partialTicks)
{
if (pre(CROSSHAIRS)) return;
bind(Gui.icons);
bind(Gui.ICONS);
GlStateManager.enableBlend();
super.renderAttackIndicator(partialTicks, res);
post(CROSSHAIRS);
@@ -217,7 +217,7 @@ public class GuiIngameForge extends GuiIngame
protected void renderBossHealth()
{
if (pre(BOSSHEALTH)) return;
bind(Gui.icons);
bind(Gui.ICONS);
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
mc.mcProfiler.startSection("bossHealth");
GlStateManager.enableBlend();
@@ -235,7 +235,7 @@ public class GuiIngameForge extends GuiIngame
if (this.mc.gameSettings.thirdPersonView == 0 && itemstack != null && itemstack.getItem() != null)
{
if (itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin))
if (itemstack.getItem() == Item.getItemFromBlock(Blocks.PUMPKIN))
{
renderPumpkinOverlay(res);
}
@@ -321,7 +321,7 @@ public class GuiIngameForge extends GuiIngame
int left = width / 2 + 91;
int top = height - right_height;
if (player.isInsideOfMaterial(Material.water))
if (player.isInsideOfMaterial(Material.WATER))
{
int air = player.getAir();
int full = MathHelper.ceiling_double_int((double)(air - 2) * 10.0D / 300.0D);
@@ -341,7 +341,7 @@ public class GuiIngameForge extends GuiIngame
public void renderHealth(int width, int height)
{
bind(icons);
bind(ICONS);
if (pre(HEALTH)) return;
mc.mcProfiler.startSection("health");
GlStateManager.enableBlend();
@@ -386,7 +386,7 @@ public class GuiIngameForge extends GuiIngame
if (rowHeight != 10) left_height += 10 - rowHeight;
int regen = -1;
if (player.isPotionActive(MobEffects.regeneration))
if (player.isPotionActive(MobEffects.REGENERATION))
{
regen = updateCounter % 25;
}
@@ -394,8 +394,8 @@ public class GuiIngameForge extends GuiIngame
final int TOP = 9 * (mc.theWorld.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0);
final int BACKGROUND = (highlight ? 25 : 16);
int MARGIN = 16;
if (player.isPotionActive(MobEffects.poison)) MARGIN += 36;
else if (player.isPotionActive(MobEffects.wither)) MARGIN += 72;
if (player.isPotionActive(MobEffects.POISON)) MARGIN += 36;
else if (player.isPotionActive(MobEffects.WITHER)) MARGIN += 72;
float absorbRemaining = absorb;
for (int i = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F) - 1; i >= 0; --i)
@@ -469,7 +469,7 @@ public class GuiIngameForge extends GuiIngame
int icon = 16;
byte background = 0;
if (mc.thePlayer.isPotionActive(MobEffects.hunger))
if (mc.thePlayer.isPotionActive(MobEffects.HUNGER))
{
icon += 36;
background = 13;
@@ -526,7 +526,7 @@ public class GuiIngameForge extends GuiIngame
protected void renderExperience(int width, int height)
{
bind(icons);
bind(ICONS);
if (pre(EXPERIENCE)) return;
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
@@ -577,7 +577,7 @@ public class GuiIngameForge extends GuiIngame
protected void renderJumpBar(int width, int height)
{
bind(icons);
bind(ICONS);
if (pre(JUMPBAR)) return;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
@@ -792,7 +792,7 @@ public class GuiIngameForge extends GuiIngame
protected void renderPlayerList(int width, int height)
{
ScoreObjective scoreobjective = this.mc.theWorld.getScoreboard().getObjectiveInDisplaySlot(0);
NetHandlerPlayClient handler = mc.thePlayer.sendQueue;
NetHandlerPlayClient handler = mc.thePlayer.connection;
if (mc.gameSettings.keyBindPlayerList.isKeyDown() && (!mc.isIntegratedServerRunning() || handler.getPlayerInfoMap().size() > 1 || scoreobjective != null))
{
@@ -813,7 +813,7 @@ public class GuiIngameForge extends GuiIngame
Entity tmp = player.getRidingEntity();
if (!(tmp instanceof EntityLivingBase)) return;
bind(icons);
bind(ICONS);
if (pre(HEALTHMOUNT)) return;
@@ -8,9 +8,9 @@ package net.minecraftforge.client;
import java.util.BitSet;
import java.util.concurrent.TimeUnit;
import net.minecraft.client.renderer.RegionRenderCache;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ChunkCache;
import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.Pair;
@@ -68,24 +68,24 @@ public class MinecraftForgeClient
}
}
private static final LoadingCache<Pair<World, BlockPos>, RegionRenderCache> regionCache = CacheBuilder.newBuilder()
private static final LoadingCache<Pair<World, BlockPos>, ChunkCache> regionCache = CacheBuilder.newBuilder()
.maximumSize(500)
.concurrencyLevel(5)
.expireAfterAccess(1, TimeUnit.SECONDS)
.build(new CacheLoader<Pair<World, BlockPos>, RegionRenderCache>()
.build(new CacheLoader<Pair<World, BlockPos>, ChunkCache>()
{
public RegionRenderCache load(Pair<World, BlockPos> key) throws Exception
public ChunkCache load(Pair<World, BlockPos> key) throws Exception
{
return new RegionRenderCache(key.getLeft(), key.getRight().add(-1, -1, -1), key.getRight().add(16, 16, 16), 1);
return new ChunkCache(key.getLeft(), key.getRight().add(-1, -1, -1), key.getRight().add(16, 16, 16), 1);
}
});
public static void onRebuildChunk(World world, BlockPos position, RegionRenderCache cache)
public static void onRebuildChunk(World world, BlockPos position, ChunkCache cache)
{
regionCache.put(Pair.of(world, position), cache);
}
public static RegionRenderCache getRegionRenderCache(World world, BlockPos pos)
public static ChunkCache getRegionRenderCache(World world, BlockPos pos)
{
int x = pos.getX() & ~0xF;
int y = pos.getY() & ~0xF;
@@ -44,7 +44,7 @@ import net.minecraft.client.renderer.block.model.multipart.Multipart;
import net.minecraft.client.renderer.block.model.multipart.Selector;
import net.minecraft.client.renderer.block.statemap.BlockStateMapper;
import net.minecraft.client.renderer.block.statemap.IStateMapper;
import net.minecraft.client.renderer.texture.IIconCreator;
import net.minecraft.client.renderer.texture.ITextureMapPopulator;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
@@ -63,6 +63,7 @@ import net.minecraftforge.client.model.animation.ModelBlockAnimation;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.common.model.IModelPart;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.Models;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.common.model.animation.IClip;
import net.minecraftforge.common.property.IExtendedBlockState;
@@ -131,7 +132,7 @@ public final class ModelLoader extends ModelBakery
textures.remove(TextureMap.LOCATION_MISSING_TEXTURE);
textures.addAll(LOCATIONS_BUILTIN_TEXTURES);
textureMap.loadSprites(resourceManager, new IIconCreator()
textureMap.loadSprites(resourceManager, new ITextureMapPopulator()
{
public void registerSprites(TextureMap map)
{
@@ -182,7 +183,7 @@ public final class ModelLoader extends ModelBakery
@Override
protected void loadBlocks()
{
List<Block> blocks = Lists.newArrayList(Iterables.filter(Block.blockRegistry, new Predicate<Block>()
List<Block> blocks = Lists.newArrayList(Iterables.filter(Block.REGISTRY, new Predicate<Block>()
{
public boolean apply(Block block)
{
@@ -266,7 +267,7 @@ public final class ModelLoader extends ModelBakery
registerVariantNames();
List<Item> items = Lists.newArrayList(Iterables.filter(Item.itemRegistry, new Predicate<Item>()
List<Item> items = Lists.newArrayList(Iterables.filter(Item.REGISTRY, new Predicate<Item>()
{
public boolean apply(Item item)
{
@@ -336,7 +337,7 @@ public final class ModelLoader extends ModelBakery
}
// empty bucket
for(String s : getVariantNames(Items.bucket))
for(String s : getVariantNames(Items.BUCKET))
{
ModelResourceLocation memory = getInventoryVariant(s);
IModel model = ModelLoaderRegistry.getModelOrMissing(new ResourceLocation("forge", "item/bucket"));
@@ -347,23 +348,23 @@ public final class ModelLoader extends ModelBakery
}
}
setBucketModel(Items.water_bucket);
setBucketModel(Items.lava_bucket);
setBucketModel(Items.WATER_BUCKET);
setBucketModel(Items.LAVA_BUCKET);
// milk bucket only replaced if some mod adds milk
if(FluidRegistry.isFluidRegistered("milk"))
{
// can the milk be put into a bucket?
Fluid milk = FluidRegistry.getFluid("milk");
FluidStack milkStack = new FluidStack(milk, FluidContainerRegistry.BUCKET_VOLUME);
if(FluidContainerRegistry.getContainerCapacity(milkStack, new ItemStack(Items.bucket)) == FluidContainerRegistry.BUCKET_VOLUME)
if(FluidContainerRegistry.getContainerCapacity(milkStack, new ItemStack(Items.BUCKET)) == FluidContainerRegistry.BUCKET_VOLUME)
{
setBucketModel(Items.milk_bucket);
setBucketModel(Items.MILK_BUCKET);
}
}
else
{
// milk bucket if no milk fluid is present
for(String s : getVariantNames(Items.milk_bucket))
for(String s : getVariantNames(Items.MILK_BUCKET))
{
ModelResourceLocation memory = getInventoryVariant(s);
IModel model = ModelLoaderRegistry.getModelOrMissing(new ResourceLocation("forge", "item/bucket_milk"));
@@ -526,6 +527,10 @@ public final class ModelLoader extends ModelBakery
SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model, model.createOverrides())).setTexture(particle);
for(int i = 0; i < model.getElements().size(); i++)
{
if(modelState.apply(Optional.of(Models.getHiddenModelPart(ImmutableList.of(Integer.toString(i))))).isPresent())
{
continue;
}
BlockPart part = model.getElements().get(i);
TRSRTransformation transformation = baseState;
if(newTransforms.get(i) != null)
@@ -70,7 +70,7 @@ public class AnimationModelBase<T extends Entity> extends ModelBase implements I
lighter.setParent(new VertexBufferConsumer(VertexBuffer));
lighter.setWorld(entity.worldObj);
lighter.setState(Blocks.air.getDefaultState());
lighter.setState(Blocks.AIR.getDefaultState());
lighter.setBlockPos(pos);
boolean empty = true;
List<BakedQuad> quads = bakedModel.getQuads(null, null, 0);
@@ -19,7 +19,7 @@ public abstract class FastTESR<T extends TileEntity> extends TileEntitySpecialRe
{
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer VertexBuffer = tessellator.getBuffer();
this.bindTexture(TextureMap.locationBlocksTexture);
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
RenderHelper.disableStandardItemLighting();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.enableBlend();
@@ -47,6 +47,7 @@ import net.minecraftforge.client.model.b3d.B3DModel.Vertex;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import net.minecraftforge.common.model.IModelPart;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.Models;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.common.model.animation.IClip;
import net.minecraftforge.common.model.animation.IJoint;
@@ -209,7 +210,14 @@ public enum B3DLoader implements ICustomModelLoader
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
{
// TODO make more use of Optional
if(!part.isPresent()) return parent.apply(part);
if(!part.isPresent())
{
if(parent != null)
{
return parent.apply(part);
}
return Optional.absent();
}
if(!(part.get() instanceof NodeJoint))
{
return Optional.absent();
@@ -364,6 +372,10 @@ public enum B3DLoader implements ICustomModelLoader
}
}
/**
* @deprecated use AnimationProperty.
*/
@Deprecated
public static enum B3DFrameProperty implements IUnlistedProperty<B3DState>
{
INSTANCE;
@@ -679,26 +691,30 @@ public enum B3DLoader implements ICustomModelLoader
if(quads == null)
{
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
generateQuads(builder, node, this.state);
generateQuads(builder, node, this.state, ImmutableList.<String>of());
quads = builder.build();
}
// TODO: caching?
if(this.state != modelState)
{
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
generateQuads(builder, node, modelState);
generateQuads(builder, node, modelState, ImmutableList.<String>of());
return builder.build();
}
return quads;
}
private void generateQuads(ImmutableList.Builder<BakedQuad> builder, Node<?> node, final IModelState state)
private void generateQuads(ImmutableList.Builder<BakedQuad> builder, Node<?> node, final IModelState state, ImmutableList<String> path)
{
ImmutableList.Builder<String> pathBuilder = ImmutableList.builder();
pathBuilder.addAll(path);
pathBuilder.add(node.getName());
ImmutableList<String> newPath = pathBuilder.build();
for(Node<?> child : node.getNodes().values())
{
generateQuads(builder, child, state);
generateQuads(builder, child, state, newPath);
}
if(node.getKind() instanceof Mesh && meshes.contains(node.getName()))
if(node.getKind() instanceof Mesh && meshes.contains(node.getName()) && !state.apply(Optional.of(Models.getHiddenModelPart(newPath))).isPresent())
{
Mesh mesh = (Mesh)node.getKind();
Collection<Face> faces = mesh.bake(new Function<Node<?>, Matrix4f>()
@@ -32,16 +32,15 @@ import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.model.IModelCustomData;
import net.minecraftforge.client.model.IPerspectiveAwareModel;
import net.minecraftforge.client.model.IRetexturableModel;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.*;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import net.minecraftforge.common.model.IModelPart;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.Models;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.common.property.Properties;
import net.minecraftforge.fml.common.FMLLog;
import org.apache.commons.lang3.tuple.Pair;
@@ -1036,6 +1035,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
}
}
@Deprecated
public static class Group implements IModelPart
{
public static final String DEFAULT_NAME = "OBJModel.Default.Element.Name";
@@ -1092,6 +1092,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
}
}
@Deprecated
public static class OBJState implements IModelState
{
protected Map<String, Boolean> visibilityMap = Maps.newHashMap();
@@ -1230,6 +1231,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
}
}
@Deprecated
public enum OBJProperty implements IUnlistedProperty<OBJState>
{
INSTANCE;
@@ -1262,7 +1264,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
private final OBJModel model;
private IModelState state;
private final VertexFormat format;
private Set<BakedQuad> quads;
private ImmutableList<BakedQuad> quads;
private ImmutableMap<String, TextureAtlasSprite> textures;
private TextureAtlasSprite sprite = ModelLoader.White.INSTANCE;
@@ -1277,98 +1279,122 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
public void scheduleRebake()
{
this.quads = null;
}
// FIXME: merge with getQuads
@Override
public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, long rand)
{
if(side != null) return ImmutableList.of();
if (side != null) return ImmutableList.of();
if (quads == null)
{
quads = Collections.synchronizedSet(new LinkedHashSet<BakedQuad>());
Set<Face> faces = Collections.synchronizedSet(new LinkedHashSet<Face>());
Optional<TRSRTransformation> transform = Optional.absent();
for (Group g : this.model.getMatLib().getGroups().values())
quads = buildQuads(this.state);
}
if (blockState instanceof IExtendedBlockState)
{
IExtendedBlockState exState = (IExtendedBlockState) blockState;
if (exState.getUnlistedNames().contains(Properties.AnimationProperty))
{
// g.minUVBounds = this.model.getMatLib().minUVBounds;
// g.maxUVBounds = this.model.getMatLib().maxUVBounds;
// FMLLog.info("Group: %s u: [%f, %f] v: [%f, %f]", g.name, g.minUVBounds[0], g.maxUVBounds[0], g.minUVBounds[1], g.maxUVBounds[1]);
if (this.state instanceof OBJState)
IModelState newState = exState.getValue(Properties.AnimationProperty);
if (newState != null)
{
OBJState state = (OBJState) this.state;
if (state.parent != null)
newState = new ModelStateComposition(this.state, newState);
return buildQuads(newState);
}
}
}
return quads;
}
private ImmutableList<BakedQuad> buildQuads(IModelState modelState)
{
List<BakedQuad> quads = Lists.newArrayList();
Collections.synchronizedSet(new LinkedHashSet<BakedQuad>());
Set<Face> faces = Collections.synchronizedSet(new LinkedHashSet<Face>());
Optional<TRSRTransformation> transform = Optional.absent();
for (Group g : this.model.getMatLib().getGroups().values())
{
// g.minUVBounds = this.model.getMatLib().minUVBounds;
// g.maxUVBounds = this.model.getMatLib().maxUVBounds;
// FMLLog.info("Group: %s u: [%f, %f] v: [%f, %f]", g.name, g.minUVBounds[0], g.maxUVBounds[0], g.minUVBounds[1], g.maxUVBounds[1]);
if(modelState.apply(Optional.of(Models.getHiddenModelPart(ImmutableList.of(g.getName())))).isPresent())
{
continue;
}
if (modelState instanceof OBJState)
{
OBJState state = (OBJState) modelState;
if (state.parent != null)
{
transform = state.parent.apply(Optional.<IModelPart>absent());
}
//TODO: can this be replaced by updateStateVisibilityMap(OBJState)?
if (state.getGroupNamesFromMap().contains(Group.ALL))
{
state.visibilityMap.clear();
for (String s : this.model.getMatLib().getGroups().keySet())
{
transform = state.parent.apply(Optional.<IModelPart>absent());
state.visibilityMap.put(s, state.operation.performOperation(true));
}
//TODO: can this be replaced by updateStateVisibilityMap(OBJState)?
if (state.getGroupNamesFromMap().contains(Group.ALL))
}
else if (state.getGroupNamesFromMap().contains(Group.ALL_EXCEPT))
{
List<String> exceptList = state.getGroupNamesFromMap().subList(1, state.getGroupNamesFromMap().size());
state.visibilityMap.clear();
for (String s : this.model.getMatLib().getGroups().keySet())
{
state.visibilityMap.clear();
for (String s : this.model.getMatLib().getGroups().keySet())
if (!exceptList.contains(s))
{
state.visibilityMap.put(s, state.operation.performOperation(true));
}
}
else if (state.getGroupNamesFromMap().contains(Group.ALL_EXCEPT))
{
List<String> exceptList = state.getGroupNamesFromMap().subList(1, state.getGroupNamesFromMap().size());
state.visibilityMap.clear();
for (String s : this.model.getMatLib().getGroups().keySet())
{
if (!exceptList.contains(s))
{
state.visibilityMap.put(s, state.operation.performOperation(true));
}
}
}
else
{
for (String s : state.visibilityMap.keySet())
{
state.visibilityMap.put(s, state.operation.performOperation(state.visibilityMap.get(s)));
}
}
if (state.getGroupsWithVisibility(true).contains(g.getName()))
{
faces.addAll(g.applyTransform(transform));
}
}
else
{
transform = state.apply(Optional.<IModelPart>absent());
for (String s : state.visibilityMap.keySet())
{
state.visibilityMap.put(s, state.operation.performOperation(state.visibilityMap.get(s)));
}
}
if (state.getGroupsWithVisibility(true).contains(g.getName()))
{
faces.addAll(g.applyTransform(transform));
}
}
for (Face f : faces)
else
{
if (this.model.getMatLib().materials.get(f.getMaterialName()).isWhite())
{
for (Vertex v : f.getVertices())
{//update material in each vertex
if (!v.getMaterial().equals(this.model.getMatLib().getMaterial(v.getMaterial().getName())))
{
v.setMaterial(this.model.getMatLib().getMaterial(v.getMaterial().getName()));
}
}
sprite = ModelLoader.White.INSTANCE;
} else sprite = this.textures.get(f.getMaterialName());
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
builder.setContractUVs(true);
builder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z));
builder.setTexture(sprite);
Normal faceNormal = f.getNormal();
putVertexData(builder, f.verts[0], faceNormal, TextureCoordinate.getDefaultUVs()[0], sprite);
putVertexData(builder, f.verts[1], faceNormal, TextureCoordinate.getDefaultUVs()[1], sprite);
putVertexData(builder, f.verts[2], faceNormal, TextureCoordinate.getDefaultUVs()[2], sprite);
putVertexData(builder, f.verts[3], faceNormal, TextureCoordinate.getDefaultUVs()[3], sprite);
quads.add(builder.build());
transform = modelState.apply(Optional.<IModelPart>absent());
faces.addAll(g.applyTransform(transform));
}
}
List<BakedQuad> quadList = Collections.synchronizedList(Lists.newArrayList(quads));
return quadList;
for (Face f : faces)
{
if (this.model.getMatLib().materials.get(f.getMaterialName()).isWhite())
{
for (Vertex v : f.getVertices())
{//update material in each vertex
if (!v.getMaterial().equals(this.model.getMatLib().getMaterial(v.getMaterial().getName())))
{
v.setMaterial(this.model.getMatLib().getMaterial(v.getMaterial().getName()));
}
}
sprite = ModelLoader.White.INSTANCE;
}
else sprite = this.textures.get(f.getMaterialName());
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
builder.setContractUVs(true);
builder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z));
builder.setTexture(sprite);
Normal faceNormal = f.getNormal();
putVertexData(builder, f.verts[0], faceNormal, TextureCoordinate.getDefaultUVs()[0], sprite);
putVertexData(builder, f.verts[1], faceNormal, TextureCoordinate.getDefaultUVs()[1], sprite);
putVertexData(builder, f.verts[2], faceNormal, TextureCoordinate.getDefaultUVs()[2], sprite);
putVertexData(builder, f.verts[3], faceNormal, TextureCoordinate.getDefaultUVs()[3], sprite);
quads.add(builder.build());
}
return ImmutableList.copyOf(quads);
}
private final void putVertexData(UnpackedBakedQuad.Builder builder, Vertex v, Normal faceNormal, TextureCoordinate defUV, TextureAtlasSprite sprite)
@@ -11,7 +11,7 @@ public enum KeyModifier {
@Override
public boolean matches(int keyCode)
{
if (Minecraft.isRunningOnMac)
if (Minecraft.IS_RUNNING_ON_MAC)
{
return keyCode == Keyboard.KEY_LMETA || keyCode == Keyboard.KEY_RMETA;
}
@@ -31,7 +31,7 @@ public enum KeyModifier {
public String getLocalizedComboName(int keyCode)
{
String keyName = GameSettings.getKeyDisplayString(keyCode);
String localizationFormatKey = Minecraft.isRunningOnMac ? "forge.controlsgui.control.mac" : "forge.controlsgui.control";
String localizationFormatKey = Minecraft.IS_RUNNING_ON_MAC ? "forge.controlsgui.control.mac" : "forge.controlsgui.control";
return I18n.format(localizationFormatKey, keyName);
}
},
@@ -115,7 +115,7 @@ public class BiomeDictionary
private static HashMap<ResourceLocation, BiomeInfo> biomeInfoMap = new HashMap<ResourceLocation, BiomeInfo>();
@SuppressWarnings("unchecked")
private static ArrayList<BiomeGenBase>[] typeInfoList = new ArrayList[Type.values().length];
private static ArrayList<Biome>[] typeInfoList = new ArrayList[Type.values().length];
private static class BiomeInfo
{
@@ -143,17 +143,17 @@ public class BiomeDictionary
* @param types the types to register the biome as
* @return returns true if the biome was registered successfully
*/
public static boolean registerBiomeType(BiomeGenBase biome, Type ... types)
public static boolean registerBiomeType(Biome biome, Type ... types)
{
types = listSubTags(types);
if(BiomeGenBase.biomeRegistry.getNameForObject(biome) != null)
if(Biome.REGISTRY.getNameForObject(biome) != null)
{
for(Type type : types)
{
if(typeInfoList[type.ordinal()] == null)
{
typeInfoList[type.ordinal()] = new ArrayList<BiomeGenBase>();
typeInfoList[type.ordinal()] = new ArrayList<Biome>();
}
typeInfoList[type.ordinal()].add(biome);
@@ -161,7 +161,7 @@ public class BiomeDictionary
if(!isBiomeRegistered(biome))
{
ResourceLocation location = BiomeGenBase.biomeRegistry.getNameForObject(biome);
ResourceLocation location = Biome.REGISTRY.getNameForObject(biome);
biomeInfoMap.put(location, new BiomeInfo(types));
}
else
@@ -184,14 +184,14 @@ public class BiomeDictionary
* @param type the Type to look for
* @return a list of biomes of the specified type, null if there are none
*/
public static BiomeGenBase[] getBiomesForType(Type type)
public static Biome[] getBiomesForType(Type type)
{
if(typeInfoList[type.ordinal()] != null)
{
return typeInfoList[type.ordinal()].toArray(new BiomeGenBase[0]);
return typeInfoList[type.ordinal()].toArray(new Biome[0]);
}
return new BiomeGenBase[0];
return new Biome[0];
}
/**
@@ -200,10 +200,10 @@ public class BiomeDictionary
* @param biome the biome to check
* @return the list of types, null if there are none
*/
public static Type[] getTypesForBiome(BiomeGenBase biome)
public static Type[] getTypesForBiome(Biome biome)
{
checkRegistration(biome);
return getBiomeInfo(biome).typeList.toArray(new Type[0]);
checkRegistration(biome);
return getBiomeInfo(biome).typeList.toArray(new Type[0]);
}
/**
@@ -213,17 +213,17 @@ public class BiomeDictionary
* @param biomeB
* @return returns true if a common type is found, false otherwise
*/
public static boolean areBiomesEquivalent(BiomeGenBase biomeA, BiomeGenBase biomeB)
public static boolean areBiomesEquivalent(Biome biomeA, Biome biomeB)
{
checkRegistration(biomeA);
checkRegistration(biomeB);
for(Type type : getTypesForBiome(biomeA))
{
if(containsType(getBiomeInfo(biomeB), type))
{
return true;
}
if(containsType(getBiomeInfo(biomeB), type))
{
return true;
}
}
return false;
@@ -236,7 +236,7 @@ public class BiomeDictionary
* @param type the type to check for
* @return returns true if the biome is registered as being of type type, false otherwise
*/
public static boolean isBiomeOfType(BiomeGenBase biome, Type type)
public static boolean isBiomeOfType(Biome biome, Type type)
{
checkRegistration(biome);
return containsType(getBiomeInfo(biome), type);
@@ -247,9 +247,9 @@ public class BiomeDictionary
* @param biome the biome to consider
* @return returns true if the biome has been registered, false otherwise
*/
public static boolean isBiomeRegistered(BiomeGenBase biome)
public static boolean isBiomeRegistered(Biome biome)
{
return biomeInfoMap.containsKey(BiomeGenBase.biomeRegistry.getNameForObject(biome));
return biomeInfoMap.containsKey(Biome.REGISTRY.getNameForObject(biome));
}
public static void registerAllBiomes()
@@ -265,10 +265,10 @@ public class BiomeDictionary
*/
public static void registerAllBiomesAndGenerateEvents()
{
for (ResourceLocation biomeResource : BiomeGenBase.biomeRegistry.getKeys())
{
BiomeGenBase biome = BiomeGenBase.biomeRegistry.getObject(biomeResource);
for (ResourceLocation biomeResource : Biome.REGISTRY.getKeys())
{
Biome biome = Biome.REGISTRY.getObject(biomeResource);
if (biome.theBiomeDecorator instanceof DeferredBiomeDecorator)
{
DeferredBiomeDecorator decorator = (DeferredBiomeDecorator) biome.theBiomeDecorator;
@@ -286,7 +286,7 @@ public class BiomeDictionary
*
* @param biome the biome to be considered
*/
public static void makeBestGuess(BiomeGenBase biome)
public static void makeBestGuess(Biome biome)
{
if (biome.theBiomeDecorator.treesPerChunk >= 3)
{
@@ -373,32 +373,32 @@ public class BiomeDictionary
BiomeDictionary.registerBiomeType(biome, SNOWY);
}
if (biome.topBlock != Blocks.sand && biome.getTemperature() >= 1.0f && biome.getRainfall() < 0.2f)
if (biome.topBlock != Blocks.SAND && biome.getTemperature() >= 1.0f && biome.getRainfall() < 0.2f)
{
BiomeDictionary.registerBiomeType(biome, SAVANNA);
}
if (biome.topBlock == Blocks.sand )
if (biome.topBlock == Blocks.SAND)
{
BiomeDictionary.registerBiomeType(biome, SANDY);
}
else if (biome.topBlock == Blocks.mycelium)
else if (biome.topBlock == Blocks.MYCELIUM)
{
BiomeDictionary.registerBiomeType(biome, MUSHROOM);
}
if (biome.fillerBlock == Blocks.hardened_clay)
if (biome.fillerBlock == Blocks.HARDENED_CLAY)
{
BiomeDictionary.registerBiomeType(biome, MESA);
}
}
//Internal implementation
private static BiomeInfo getBiomeInfo(BiomeGenBase biome)
private static BiomeInfo getBiomeInfo(Biome biome)
{
return biomeInfoMap.get(BiomeGenBase.biomeRegistry.getNameForObject(biome));
return biomeInfoMap.get(Biome.REGISTRY.getNameForObject(biome));
}
private static void checkRegistration(BiomeGenBase biome)
private static void checkRegistration(Biome biome)
{
if(!isBiomeRegistered(biome))
{
@@ -436,45 +436,45 @@ public class BiomeDictionary
private static void registerVanillaBiomes()
{
registerBiomeType(Biomes.ocean, OCEAN );
registerBiomeType(Biomes.plains, PLAINS );
registerBiomeType(Biomes.desert, HOT, DRY, SANDY );
registerBiomeType(Biomes.extremeHills, MOUNTAIN, HILLS );
registerBiomeType(Biomes.forest, FOREST );
registerBiomeType(Biomes.taiga, COLD, CONIFEROUS, FOREST );
registerBiomeType(Biomes.taigaHills, COLD, CONIFEROUS, FOREST, HILLS );
registerBiomeType(Biomes.swampland, WET, SWAMP );
registerBiomeType(Biomes.river, RIVER );
registerBiomeType(Biomes.frozenOcean, COLD, OCEAN, SNOWY );
registerBiomeType(Biomes.frozenRiver, COLD, RIVER, SNOWY );
registerBiomeType(Biomes.icePlains, COLD, SNOWY, WASTELAND );
registerBiomeType(Biomes.iceMountains, COLD, SNOWY, MOUNTAIN );
registerBiomeType(Biomes.beach, BEACH );
registerBiomeType(Biomes.desertHills, HOT, DRY, SANDY, HILLS );
registerBiomeType(Biomes.jungle, HOT, WET, DENSE, JUNGLE );
registerBiomeType(Biomes.jungleHills, HOT, WET, DENSE, JUNGLE, HILLS);
registerBiomeType(Biomes.forestHills, FOREST, HILLS );
registerBiomeType(Biomes.sky, COLD, DRY, END );
registerBiomeType(Biomes.hell, HOT, DRY, NETHER );
registerBiomeType(Biomes.mushroomIsland, MUSHROOM );
registerBiomeType(Biomes.extremeHillsEdge, MOUNTAIN );
registerBiomeType(Biomes.mushroomIslandShore, MUSHROOM, BEACH );
registerBiomeType(Biomes.jungleEdge, HOT, WET, JUNGLE, FOREST );
registerBiomeType(Biomes.deepOcean, OCEAN );
registerBiomeType(Biomes.stoneBeach, BEACH );
registerBiomeType(Biomes.coldBeach, COLD, BEACH, SNOWY );
registerBiomeType(Biomes.birchForest, FOREST );
registerBiomeType(Biomes.birchForestHills, FOREST, HILLS );
registerBiomeType(Biomes.roofedForest, SPOOKY, DENSE, FOREST );
registerBiomeType(Biomes.coldTaiga, COLD, CONIFEROUS, FOREST, SNOWY );
registerBiomeType(Biomes.coldTaigaHills, COLD, CONIFEROUS, FOREST, SNOWY, HILLS);
registerBiomeType(Biomes.megaTaiga, COLD, CONIFEROUS, FOREST );
registerBiomeType(Biomes.megaTaigaHills, COLD, CONIFEROUS, FOREST, HILLS );
registerBiomeType(Biomes.extremeHillsPlus, MOUNTAIN, FOREST, SPARSE );
registerBiomeType(Biomes.savanna, HOT, SAVANNA, PLAINS, SPARSE );
registerBiomeType(Biomes.savannaPlateau, HOT, SAVANNA, PLAINS, SPARSE );
registerBiomeType(Biomes.mesa, MESA, SANDY );
registerBiomeType(Biomes.mesaPlateau_F, MESA, SPARSE, SANDY );
registerBiomeType(Biomes.mesaPlateau, MESA, SANDY );
registerBiomeType(Biomes.OCEAN, OCEAN );
registerBiomeType(Biomes.PLAINS, PLAINS );
registerBiomeType(Biomes.DESERT, HOT, DRY, SANDY );
registerBiomeType(Biomes.EXTREME_HILLS, MOUNTAIN, HILLS );
registerBiomeType(Biomes.FOREST, FOREST );
registerBiomeType(Biomes.TAIGA, COLD, CONIFEROUS, FOREST );
registerBiomeType(Biomes.TAIGA_HILLS, COLD, CONIFEROUS, FOREST, HILLS );
registerBiomeType(Biomes.SWAMPLAND, WET, SWAMP );
registerBiomeType(Biomes.RIVER, RIVER );
registerBiomeType(Biomes.FROZEN_OCEAN, COLD, OCEAN, SNOWY );
registerBiomeType(Biomes.FROZEN_RIVER, COLD, RIVER, SNOWY );
registerBiomeType(Biomes.ICE_PLAINS, COLD, SNOWY, WASTELAND );
registerBiomeType(Biomes.ICE_MOUNTAINS, COLD, SNOWY, MOUNTAIN );
registerBiomeType(Biomes.BEACH, BEACH );
registerBiomeType(Biomes.DESERT_HILLS, HOT, DRY, SANDY, HILLS );
registerBiomeType(Biomes.JUNGLE, HOT, WET, DENSE, JUNGLE );
registerBiomeType(Biomes.JUNGLE_HILLS, HOT, WET, DENSE, JUNGLE, HILLS);
registerBiomeType(Biomes.FOREST_HILLS, FOREST, HILLS );
registerBiomeType(Biomes.SKY, COLD, DRY, END );
registerBiomeType(Biomes.HELL, HOT, DRY, NETHER );
registerBiomeType(Biomes.MUSHROOM_ISLAND, MUSHROOM );
registerBiomeType(Biomes.EXTREME_HILLS_EDGE, MOUNTAIN );
registerBiomeType(Biomes.MUSHROOM_ISLAND_SHORE, MUSHROOM, BEACH );
registerBiomeType(Biomes.JUNGLE_EDGE, HOT, WET, JUNGLE, FOREST );
registerBiomeType(Biomes.DEEP_OCEAN, OCEAN );
registerBiomeType(Biomes.STONE_BEACH, BEACH );
registerBiomeType(Biomes.COLD_BEACH, COLD, BEACH, SNOWY );
registerBiomeType(Biomes.BIRCH_FOREST, FOREST );
registerBiomeType(Biomes.BIRCH_FOREST_HILLS, FOREST, HILLS );
registerBiomeType(Biomes.ROOFED_FOREST, SPOOKY, DENSE, FOREST );
registerBiomeType(Biomes.COLD_TAIGA, COLD, CONIFEROUS, FOREST, SNOWY );
registerBiomeType(Biomes.COLD_TAIGA_HILLS, COLD, CONIFEROUS, FOREST, SNOWY, HILLS);
registerBiomeType(Biomes.REDWOOD_TAIGA, COLD, CONIFEROUS, FOREST );
registerBiomeType(Biomes.REDWOOD_TAIGA_HILLS, COLD, CONIFEROUS, FOREST, HILLS );
registerBiomeType(Biomes.EXTREME_HILLS_WITH_TREES, MOUNTAIN, FOREST, SPARSE );
registerBiomeType(Biomes.SAVANNA, HOT, SAVANNA, PLAINS, SPARSE );
registerBiomeType(Biomes.SAVANNA_PLATEAU, HOT, SAVANNA, PLAINS, SPARSE );
registerBiomeType(Biomes.MESA, MESA, SANDY );
registerBiomeType(Biomes.MESA_ROCK, MESA, SPARSE, SANDY );
registerBiomeType(Biomes.MESA_CLEAR_ROCK, MESA, SANDY );
}
}
@@ -9,7 +9,7 @@ import com.google.common.collect.ImmutableList;
import net.minecraft.init.Biomes;
import net.minecraft.util.WeightedRandom;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeProvider;
import net.minecraft.world.gen.structure.MapGenVillage;
import net.minecraftforge.common.util.EnumHelper;
@@ -18,16 +18,16 @@ public class BiomeManager
{
private static TrackedList<BiomeEntry>[] biomes = setupBiomes();
public static List<BiomeGenBase> oceanBiomes = new ArrayList<BiomeGenBase>();
public static List<Biome> oceanBiomes = new ArrayList<Biome>();
public static ArrayList<BiomeGenBase> strongHoldBiomes = new ArrayList<BiomeGenBase>();
public static ArrayList<BiomeGenBase> strongHoldBiomesBlackList = new ArrayList<BiomeGenBase>();
public static ArrayList<Biome> strongHoldBiomes = new ArrayList<Biome>();
public static ArrayList<Biome> strongHoldBiomesBlackList = new ArrayList<Biome>();
static
{
oceanBiomes.add(Biomes.ocean);
oceanBiomes.add(Biomes.deepOcean);
oceanBiomes.add(Biomes.frozenOcean);
oceanBiomes.add(Biomes.OCEAN);
oceanBiomes.add(Biomes.DEEP_OCEAN);
oceanBiomes.add(Biomes.FROZEN_OCEAN);
}
private static TrackedList<BiomeEntry>[] setupBiomes()
@@ -36,26 +36,26 @@ public class BiomeManager
TrackedList<BiomeEntry>[] currentBiomes = new TrackedList[BiomeType.values().length];
List<BiomeEntry> list = new ArrayList<BiomeEntry>();
list.add(new BiomeEntry(Biomes.forest, 10));
list.add(new BiomeEntry(Biomes.roofedForest, 10));
list.add(new BiomeEntry(Biomes.extremeHills, 10));
list.add(new BiomeEntry(Biomes.plains, 10));
list.add(new BiomeEntry(Biomes.birchForest, 10));
list.add(new BiomeEntry(Biomes.swampland, 10));
list.add(new BiomeEntry(Biomes.FOREST, 10));
list.add(new BiomeEntry(Biomes.ROOFED_FOREST, 10));
list.add(new BiomeEntry(Biomes.EXTREME_HILLS, 10));
list.add(new BiomeEntry(Biomes.PLAINS, 10));
list.add(new BiomeEntry(Biomes.BIRCH_FOREST, 10));
list.add(new BiomeEntry(Biomes.SWAMPLAND, 10));
currentBiomes[BiomeType.WARM.ordinal()] = new TrackedList<BiomeEntry>(list);
list.clear();
list.add(new BiomeEntry(Biomes.forest, 10));
list.add(new BiomeEntry(Biomes.extremeHills, 10));
list.add(new BiomeEntry(Biomes.taiga, 10));
list.add(new BiomeEntry(Biomes.plains, 10));
list.add(new BiomeEntry(Biomes.FOREST, 10));
list.add(new BiomeEntry(Biomes.EXTREME_HILLS, 10));
list.add(new BiomeEntry(Biomes.TAIGA, 10));
list.add(new BiomeEntry(Biomes.PLAINS, 10));
currentBiomes[BiomeType.COOL.ordinal()] = new TrackedList<BiomeEntry>(list);
list.clear();
list.add(new BiomeEntry(Biomes.icePlains, 30));
list.add(new BiomeEntry(Biomes.coldTaiga, 10));
list.add(new BiomeEntry(Biomes.ICE_PLAINS, 30));
list.add(new BiomeEntry(Biomes.COLD_TAIGA, 10));
currentBiomes[BiomeType.ICY.ordinal()] = new TrackedList<BiomeEntry>(list);
list.clear();
@@ -65,27 +65,27 @@ public class BiomeManager
return currentBiomes;
}
public static void addVillageBiome(BiomeGenBase biome, boolean canSpawn)
public static void addVillageBiome(Biome biome, boolean canSpawn)
{
if (!MapGenVillage.villageSpawnBiomes.contains(biome))
if (!MapGenVillage.VILLAGE_SPAWN_BIOMES.contains(biome))
{
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
ArrayList<Biome> biomes = new ArrayList<Biome>(MapGenVillage.VILLAGE_SPAWN_BIOMES);
biomes.add(biome);
MapGenVillage.villageSpawnBiomes = biomes;
MapGenVillage.VILLAGE_SPAWN_BIOMES = biomes;
}
}
public static void removeVillageBiome(BiomeGenBase biome)
public static void removeVillageBiome(Biome biome)
{
if (MapGenVillage.villageSpawnBiomes.contains(biome))
if (MapGenVillage.VILLAGE_SPAWN_BIOMES.contains(biome))
{
ArrayList<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>(MapGenVillage.villageSpawnBiomes);
ArrayList<Biome> biomes = new ArrayList<Biome>(MapGenVillage.VILLAGE_SPAWN_BIOMES);
biomes.remove(biome);
MapGenVillage.villageSpawnBiomes = biomes;
MapGenVillage.VILLAGE_SPAWN_BIOMES = biomes;
}
}
public static void addStrongholdBiome(BiomeGenBase biome)
public static void addStrongholdBiome(Biome biome)
{
if (!strongHoldBiomes.contains(biome))
{
@@ -93,7 +93,7 @@ public class BiomeManager
}
}
public static void removeStrongholdBiome(BiomeGenBase biome)
public static void removeStrongholdBiome(Biome biome)
{
if (!strongHoldBiomesBlackList.contains(biome))
{
@@ -101,7 +101,7 @@ public class BiomeManager
}
}
public static void addSpawnBiome(BiomeGenBase biome)
public static void addSpawnBiome(Biome biome)
{
if (!BiomeProvider.allowedBiomes.contains(biome))
{
@@ -109,7 +109,7 @@ public class BiomeManager
}
}
public static void removeSpawnBiome(BiomeGenBase biome)
public static void removeSpawnBiome(Biome biome)
{
if (BiomeProvider.allowedBiomes.contains(biome))
{
@@ -179,9 +179,9 @@ public class BiomeManager
public static class BiomeEntry extends WeightedRandom.Item
{
public final BiomeGenBase biome;
public final Biome biome;
public BiomeEntry(BiomeGenBase biome, int weight)
public BiomeEntry(Biome biome, int weight)
{
super(weight);
@@ -23,7 +23,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.world.DimensionType;
import net.minecraft.world.MinecraftException;
import net.minecraft.world.World;
import net.minecraft.world.WorldManager;
import net.minecraft.world.ServerWorldEventHandler;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldServerMulti;
@@ -209,7 +209,7 @@ public class DimensionManager
//WorldSettings worldSettings = new WorldSettings(overworld.getWorldInfo());
WorldServer world = (dim == 0 ? overworld : (WorldServer)(new WorldServerMulti(mcServer, savehandler, dim, overworld, mcServer.theProfiler).init()));
world.addEventListener(new WorldManager(mcServer, world));
world.addEventListener(new ServerWorldEventHandler(mcServer, world));
MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(world));
if (!mcServer.isSinglePlayer())
{
@@ -22,8 +22,8 @@ import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ClassInheritanceMultiMap;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
@@ -90,7 +90,7 @@ public class ForgeChunkManager
private static Map<String, LoadingCallback> callbacks = Maps.newHashMap();
private static Map<World, ImmutableSetMultimap<ChunkCoordIntPair,Ticket>> forcedChunks = new MapMaker().weakKeys().makeMap();
private static Map<World, ImmutableSetMultimap<ChunkPos,Ticket>> forcedChunks = new MapMaker().weakKeys().makeMap();
private static BiMap<UUID,Ticket> pendingEntities = HashBiMap.create();
private static Map<World,Cache<Long, Chunk>> dormantChunkCache = new MapMaker().weakKeys().makeMap();
@@ -112,13 +112,13 @@ public class ForgeChunkManager
public static Iterator<Chunk> getPersistentChunksIterableFor(final World world, Iterator<Chunk> chunkIterator)
{
final ImmutableSetMultimap<ChunkCoordIntPair, Ticket> persistentChunksFor = getPersistentChunksFor(world);
final ImmutableSetMultimap<ChunkPos, Ticket> persistentChunksFor = getPersistentChunksFor(world);
final ImmutableSet.Builder<Chunk> builder = ImmutableSet.builder();
world.theProfiler.startSection("forcedChunkLoading");
builder.addAll(Iterators.transform(persistentChunksFor.keys().iterator(), new Function<ChunkCoordIntPair, Chunk>() {
builder.addAll(Iterators.transform(persistentChunksFor.keys().iterator(), new Function<ChunkPos, Chunk>() {
@Nullable
@Override
public Chunk apply(@Nullable ChunkCoordIntPair input)
public Chunk apply(@Nullable ChunkPos input)
{
return world.getChunkFromChunkCoords(input.chunkXPos, input.chunkZPos);
}
@@ -216,7 +216,7 @@ public class ForgeChunkManager
{
private String modId;
private Type ticketType;
private LinkedHashSet<ChunkCoordIntPair> requestedChunks;
private LinkedHashSet<ChunkPos> requestedChunks;
private NBTTagCompound modData;
public final World world;
private int maxDepth;
@@ -363,7 +363,7 @@ public class ForgeChunkManager
/**
* Gets a list of requested chunks for this ticket.
*/
public ImmutableSet<ChunkCoordIntPair> getChunkList()
public ImmutableSet<ChunkPos> getChunkList()
{
return ImmutableSet.copyOf(requestedChunks);
}
@@ -371,9 +371,9 @@ public class ForgeChunkManager
public static class ForceChunkEvent extends Event {
private final Ticket ticket;
private final ChunkCoordIntPair location;
private final ChunkPos location;
public ForceChunkEvent(Ticket ticket, ChunkCoordIntPair location)
public ForceChunkEvent(Ticket ticket, ChunkPos location)
{
this.ticket = ticket;
this.location = location;
@@ -384,7 +384,7 @@ public class ForgeChunkManager
return ticket;
}
public ChunkCoordIntPair getLocation()
public ChunkPos getLocation()
{
return location;
}
@@ -392,9 +392,9 @@ public class ForgeChunkManager
public static class UnforceChunkEvent extends Event {
private final Ticket ticket;
private final ChunkCoordIntPair location;
private final ChunkPos location;
public UnforceChunkEvent(Ticket ticket, ChunkCoordIntPair location)
public UnforceChunkEvent(Ticket ticket, ChunkPos location)
{
this.ticket = ticket;
this.location = location;
@@ -405,7 +405,7 @@ public class ForgeChunkManager
return ticket;
}
public ChunkCoordIntPair getLocation()
public ChunkPos getLocation()
{
return location;
}
@@ -444,7 +444,7 @@ public class ForgeChunkManager
ArrayListMultimap<String, Ticket> newTickets = ArrayListMultimap.create();
tickets.put(world, newTickets);
forcedChunks.put(world, ImmutableSetMultimap.<ChunkCoordIntPair,Ticket>of());
forcedChunks.put(world, ImmutableSetMultimap.<ChunkPos,Ticket>of());
if (!(world instanceof WorldServer))
{
@@ -743,7 +743,7 @@ public class ForgeChunkManager
}
if (ticket.requestedChunks!=null)
{
for (ChunkCoordIntPair chunk : ImmutableSet.copyOf(ticket.requestedChunks))
for (ChunkPos chunk : ImmutableSet.copyOf(ticket.requestedChunks))
{
unforceChunk(ticket, chunk);
}
@@ -767,7 +767,7 @@ public class ForgeChunkManager
* @param ticket The ticket registering the chunk
* @param chunk The chunk to force
*/
public static void forceChunk(Ticket ticket, ChunkCoordIntPair chunk)
public static void forceChunk(Ticket ticket, ChunkPos chunk)
{
if (ticket == null || chunk == null)
{
@@ -785,11 +785,11 @@ public class ForgeChunkManager
ticket.requestedChunks.add(chunk);
MinecraftForge.EVENT_BUS.post(new ForceChunkEvent(ticket, chunk));
ImmutableSetMultimap<ChunkCoordIntPair, Ticket> newMap = ImmutableSetMultimap.<ChunkCoordIntPair,Ticket>builder().putAll(forcedChunks.get(ticket.world)).put(chunk, ticket).build();
ImmutableSetMultimap<ChunkPos, Ticket> newMap = ImmutableSetMultimap.<ChunkPos,Ticket>builder().putAll(forcedChunks.get(ticket.world)).put(chunk, ticket).build();
forcedChunks.put(ticket.world, newMap);
if (ticket.maxDepth > 0 && ticket.requestedChunks.size() > ticket.maxDepth)
{
ChunkCoordIntPair removed = ticket.requestedChunks.iterator().next();
ChunkPos removed = ticket.requestedChunks.iterator().next();
unforceChunk(ticket,removed);
}
}
@@ -802,7 +802,7 @@ public class ForgeChunkManager
* @param ticket The ticket holding the chunk list
* @param chunk The chunk you wish to push to the end (so that it would be unloaded last)
*/
public static void reorderChunk(Ticket ticket, ChunkCoordIntPair chunk)
public static void reorderChunk(Ticket ticket, ChunkPos chunk)
{
if (ticket == null || chunk == null || !ticket.requestedChunks.contains(chunk))
{
@@ -817,7 +817,7 @@ public class ForgeChunkManager
* @param ticket The ticket holding the chunk
* @param chunk The chunk to unforce
*/
public static void unforceChunk(Ticket ticket, ChunkCoordIntPair chunk)
public static void unforceChunk(Ticket ticket, ChunkPos chunk)
{
if (ticket == null || chunk == null)
{
@@ -825,9 +825,9 @@ public class ForgeChunkManager
}
ticket.requestedChunks.remove(chunk);
MinecraftForge.EVENT_BUS.post(new UnforceChunkEvent(ticket, chunk));
LinkedHashMultimap<ChunkCoordIntPair, Ticket> copy = LinkedHashMultimap.create(forcedChunks.get(ticket.world));
LinkedHashMultimap<ChunkPos, Ticket> copy = LinkedHashMultimap.create(forcedChunks.get(ticket.world));
copy.remove(chunk, ticket);
ImmutableSetMultimap<ChunkCoordIntPair, Ticket> newMap = ImmutableSetMultimap.copyOf(copy);
ImmutableSetMultimap<ChunkPos, Ticket> newMap = ImmutableSetMultimap.copyOf(copy);
forcedChunks.put(ticket.world,newMap);
}
@@ -857,9 +857,9 @@ public class ForgeChunkManager
* @param world
* @return the list of persistent chunks in the world
*/
public static ImmutableSetMultimap<ChunkCoordIntPair, Ticket> getPersistentChunksFor(World world)
public static ImmutableSetMultimap<ChunkPos, Ticket> getPersistentChunksFor(World world)
{
return forcedChunks.containsKey(world) ? forcedChunks.get(world) : ImmutableSetMultimap.<ChunkCoordIntPair,Ticket>of();
return forcedChunks.containsKey(world) ? forcedChunks.get(world) : ImmutableSetMultimap.<ChunkPos,Ticket>of();
}
static void saveWorld(World world)
@@ -176,11 +176,11 @@ public class ForgeHooks
if (!canHarvestBlock(state.getBlock(), player, world, pos))
{
return player.getBreakSpeed(state, pos) / hardness / 100F;
return player.getDigSpeed(state, pos) / hardness / 100F;
}
else
{
return player.getBreakSpeed(state, pos) / hardness / 30F;
return player.getDigSpeed(state, pos) / hardness / 30F;
}
}
@@ -222,20 +222,21 @@ public class ForgeHooks
block.setHarvestLevel("axe", 0);
}
Blocks.obsidian.setHarvestLevel("pickaxe", 3);
Blocks.OBSIDIAN.setHarvestLevel("pickaxe", 3);
Blocks.ENCHANTING_TABLE.setHarvestLevel("pickaxe", 0);
Block[] oreBlocks = new Block[] {
Blocks.emerald_ore, Blocks.emerald_block, Blocks.diamond_ore, Blocks.diamond_block,
Blocks.gold_ore, Blocks.gold_block, Blocks.redstone_ore, Blocks.lit_redstone_ore
Blocks.EMERALD_ORE, Blocks.EMERALD_BLOCK, Blocks.DIAMOND_ORE, Blocks.DIAMOND_BLOCK,
Blocks.GOLD_ORE, Blocks.GOLD_BLOCK, Blocks.REDSTONE_ORE, Blocks.LIT_REDSTONE_ORE
};
for (Block block : oreBlocks)
{
block.setHarvestLevel("pickaxe", 2);
}
Blocks.iron_ore.setHarvestLevel("pickaxe", 1);
Blocks.iron_block.setHarvestLevel("pickaxe", 1);
Blocks.lapis_ore.setHarvestLevel("pickaxe", 1);
Blocks.lapis_block.setHarvestLevel("pickaxe", 1);
Blocks.quartz_ore.setHarvestLevel("pickaxe", 0);
Blocks.IRON_ORE.setHarvestLevel("pickaxe", 1);
Blocks.IRON_BLOCK.setHarvestLevel("pickaxe", 1);
Blocks.LAPIS_ORE.setHarvestLevel("pickaxe", 1);
Blocks.LAPIS_BLOCK.setHarvestLevel("pickaxe", 1);
Blocks.QUARTZ_ORE.setHarvestLevel("pickaxe", 0);
}
public static int getTotalArmorValue(EntityPlayer player)
@@ -258,11 +259,11 @@ public class ForgeHooks
static
{
seedList.add(new SeedEntry(new ItemStack(Items.wheat_seeds), 10)
seedList.add(new SeedEntry(new ItemStack(Items.WHEAT_SEEDS), 10)
{
public ItemStack getStack(Random rand, int fortune)
{
return new ItemStack(Items.wheat_seeds, 1 + rand.nextInt(fortune * 2 + 1));
return new ItemStack(Items.WHEAT_SEEDS, 1 + rand.nextInt(fortune * 2 + 1));
}
});
initTools();
@@ -422,7 +423,7 @@ public class ForgeHooks
if (target.typeOfHit == RayTraceResult.Type.BLOCK)
{
s1 = Block.blockRegistry.getNameForObject(world.getBlockState(target.getBlockPos()).getBlock()).toString();
s1 = Block.REGISTRY.getNameForObject(world.getBlockState(target.getBlockPos()).getBlock()).toString();
}
else if (target.typeOfHit == RayTraceResult.Type.ENTITY)
{
@@ -440,7 +441,7 @@ public class ForgeHooks
if (isCreative)
{
player.inventory.func_184434_a(result);
player.inventory.setPickedItemStack(result);
Minecraft.getMinecraft().playerController.sendSlotPacket(player.getHeldItem(EnumHand.MAIN_HAND), 36 + player.inventory.currentItem);
return true;
}
@@ -636,9 +637,9 @@ public class ForgeHooks
// Set the click event and append the link.
ClickEvent click = new ClickEvent(ClickEvent.Action.OPEN_URL, url);
link.getChatStyle().setChatClickEvent(click);
link.getChatStyle().setUnderlined(true);
link.getChatStyle().setColor(TextFormatting.BLUE);
link.getStyle().setClickEvent(click);
link.getStyle().setUnderlined(true);
link.getStyle().setColor(TextFormatting.BLUE);
if (ichat == null)
ichat = link;
else
@@ -685,8 +686,8 @@ public class ForgeHooks
if (world.getTileEntity(pos) == null)
{
SPacketBlockChange packet = new SPacketBlockChange(world, pos);
packet.blockState = Blocks.air.getDefaultState();
entityPlayer.playerNetServerHandler.sendPacket(packet);
packet.blockState = Blocks.AIR.getDefaultState();
entityPlayer.connection.sendPacket(packet);
}
// Post the block break event
@@ -699,16 +700,16 @@ public class ForgeHooks
if (event.isCanceled())
{
// Let the client know the block still exists
entityPlayer.playerNetServerHandler.sendPacket(new SPacketBlockChange(world, pos));
entityPlayer.connection.sendPacket(new SPacketBlockChange(world, pos));
// Update any tile entity data for this block
TileEntity tileentity = world.getTileEntity(pos);
if (tileentity != null)
{
Packet<?> pkt = tileentity.getDescriptionPacket();
Packet<?> pkt = tileentity.getUpdatePacket();
if (pkt != null)
{
entityPlayer.playerNetServerHandler.sendPacket(pkt);
entityPlayer.connection.sendPacket(pkt);
}
}
}
@@ -798,7 +799,7 @@ public class ForgeHooks
world.markAndNotifyBlock(snap.getPos(), null, oldBlock, newBlock, updateFlag);
}
player.addStat(StatList.func_188060_a(itemstack.getItem()));
player.addStat(StatList.getCraftStats(itemstack.getItem()));
}
}
world.capturedBlockSnapshots.clear();
@@ -14,12 +14,20 @@ import java.net.URL;
import java.security.cert.Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.logging.log4j.Level;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.ICrashReportDetail;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.stats.StatList;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.classloading.FMLForgePlugin;
@@ -36,6 +44,7 @@ import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.server.command.ForgeCommand;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
@@ -44,10 +53,13 @@ import net.minecraftforge.fml.client.FMLFolderResourcePack;
import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent;
import net.minecraftforge.fml.common.DummyModContainer;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ICrashCallable;
import net.minecraftforge.fml.common.LoadController;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModMetadata;
import net.minecraftforge.fml.common.WorldAccessContainer;
import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
import net.minecraftforge.fml.common.event.FMLConstructionEvent;
import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent;
import net.minecraftforge.fml.common.event.FMLModIdMappingEvent;
@@ -322,6 +334,36 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
List<String> all = Lists.newArrayList();
for (ASMData asm : evt.getASMHarvestedData().getAll(ICrashReportDetail.class.getName().replace('.', '/')))
all.add(asm.getClassName());
for (ASMData asm : evt.getASMHarvestedData().getAll(ICrashCallable.class.getName().replace('.', '/')))
all.add(asm.getClassName());
Iterator<String> itr = all.iterator();
while (itr.hasNext())
{
String cls = itr.next();
if (!cls.startsWith("net/minecraft/") &&
!cls.startsWith("net/minecraftforge/"))
itr.remove();
}
FMLLog.log("Forge", Level.DEBUG, "Preloading CrashReport Classes");
Collections.sort(all); //Sort it because I like pretty output ;)
for (String name : all)
{
FMLLog.log("Forge", Level.DEBUG, "\t" + name);
try
{
Class.forName(name.replace('/', '.'), false, MinecraftForge.class.getClassLoader());
}
catch (Exception e)
{
e.printStackTrace();
}
}
NetworkRegistry.INSTANCE.register(this, this.getClass(), "*", evt.getASMHarvestedData());
ForgeNetworkHandler.registerChannel(this, evt.getSide());
}
@@ -393,6 +435,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
public void mappingChanged(FMLModIdMappingEvent evt)
{
OreDictionary.rebakeMap();
StatList.reinit();
}
@@ -462,4 +505,5 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
{
return updateJSONUrl;
}
}
@@ -33,15 +33,15 @@ public class ForgeVersion
//This number is incremented every time we remove deprecated code/major API changes, never reset
public static final int majorVersion = 12;
//This number is incremented every minecraft release, never reset
public static final int minorVersion = 16;
public static final int minorVersion = 17;
//This number is incremented every time a interface changes or new major feature is added, and reset every Minecraft version
public static final int revisionVersion = 1;
public static final int revisionVersion = 0;
//This number is incremented every time Jenkins builds Forge, and never reset. Should always be 0 in the repo code.
public static final int buildVersion = 0;
// This is the minecraft version we're building for - used in various places in Forge/FML code
public static final String mcVersion = "1.9";
public static final String mcVersion = "1.9.4";
// This is the MCP data version we're using
public static final String mcpVersion = "9.23";
public static final String mcpVersion = "9.28";
@SuppressWarnings("unused")
private static Status status = PENDING;
@SuppressWarnings("unused")
@@ -1,15 +1,22 @@
package net.minecraftforge.common;
import java.util.concurrent.Callable;
import com.google.common.collect.ObjectArrays;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ICrashCallable;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.discovery.ASMDataTable;
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
import net.minecraftforge.fml.common.eventhandler.EventBus;
import net.minecraftforge.fml.relauncher.Side;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.apache.logging.log4j.Level;
import com.google.common.collect.Lists;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.ICrashReportDetail;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeHooks.SeedEntry;
import net.minecraftforge.fluids.FluidRegistry;
@@ -59,121 +66,45 @@ public class MinecraftForge
OreDictionary.getOreName(0);
//Force these classes to be defined, Should prevent derp error hiding.
@SuppressWarnings("unused")
CrashReport fake = new CrashReport("ThisIsFake", new Exception("Not real"));
//Lets init World's crash report inner classes to prevent them from hiding errors.
String[] handlers = {
"net.minecraft.world.World$1",
"net.minecraft.world.World$2",
"net.minecraft.world.World$3",
"net.minecraft.world.World$4",
"net.minecraft.world.chunk.Chunk$1",
"net.minecraft.world.chunk.Chunk$2",
"net.minecraft.world.chunk.Chunk$3",
"net.minecraft.command.server.CommandBlockLogic$1",
"net.minecraft.command.server.CommandBlockLogic$2",
"net.minecraft.crash.CrashReportCategory$1",
"net.minecraft.crash.CrashReportCategory$2",
"net.minecraft.crash.CrashReportCategory$3",
"net.minecraft.crash.CrashReportCategory$4",
"net.minecraft.crash.CrashReportCategory$5",
"net.minecraft.crash.CrashReportCategory$Entry",
"net.minecraft.entity.Entity$1",
"net.minecraft.entity.Entity$2",
"net.minecraft.entity.Entity$3",
"net.minecraft.entity.Entity$4",
"net.minecraft.entity.EntityTracker$1",
"net.minecraft.world.gen.layer.GenLayer$1",
"net.minecraft.world.gen.layer.GenLayer$2",
"net.minecraft.entity.player.InventoryPlayer$1",
"net.minecraft.world.gen.structure.MapGenStructure$1",
"net.minecraft.world.gen.structure.MapGenStructure$2",
"net.minecraft.world.gen.structure.MapGenStructure$3",
"net.minecraft.server.MinecraftServer$3",
"net.minecraft.server.MinecraftServer$4",
"net.minecraft.server.MinecraftServer$5",
"net.minecraft.nbt.NBTTagCompound$1",
"net.minecraft.nbt.NBTTagCompound$2",
"net.minecraft.network.NetHandlerPlayServer$2",
"net.minecraft.network.NetworkSystem$3",
"net.minecraft.tileentity.TileEntity$1",
"net.minecraft.tileentity.TileEntity$2",
"net.minecraft.tileentity.TileEntity$3",
"net.minecraft.world.storage.WorldInfo$1",
"net.minecraft.world.storage.WorldInfo$2",
"net.minecraft.world.storage.WorldInfo$3",
"net.minecraft.world.storage.WorldInfo$4",
"net.minecraft.world.storage.WorldInfo$5",
"net.minecraft.world.storage.WorldInfo$6",
"net.minecraft.world.storage.WorldInfo$7",
"net.minecraft.world.storage.WorldInfo$8",
"net.minecraft.world.storage.WorldInfo$9"
};
String[] client = {
"net.minecraft.client.Minecraft$3",
"net.minecraft.client.Minecraft$4",
"net.minecraft.client.Minecraft$5",
"net.minecraft.client.Minecraft$6",
"net.minecraft.client.Minecraft$7",
"net.minecraft.client.Minecraft$8",
"net.minecraft.client.Minecraft$9",
"net.minecraft.client.Minecraft$10",
"net.minecraft.client.Minecraft$11",
"net.minecraft.client.Minecraft$12",
"net.minecraft.client.Minecraft$13",
"net.minecraft.client.Minecraft$14",
"net.minecraft.client.Minecraft$15",
"net.minecraft.client.multiplayer.WorldClient$1",
"net.minecraft.client.multiplayer.WorldClient$2",
"net.minecraft.client.multiplayer.WorldClient$3",
"net.minecraft.client.multiplayer.WorldClient$4",
"net.minecraft.client.particle,EffectRenderer$1",
"net.minecraft.client.particle,EffectRenderer$2",
"net.minecraft.client.particle,EffectRenderer$3",
"net.minecraft.client.particle,EffectRenderer$4",
"net.minecraft.client.renderer.EntityRenderer$1",
"net.minecraft.client.renderer.EntityRenderer$2",
"net.minecraft.client.renderer.EntityRenderer$3",
"net.minecraft.server.integrated.IntegratedServer$1",
"net.minecraft.server.integrated.IntegratedServer$2",
"net.minecraft.client.renderer.RenderGlobal$1",
"net.minecraft.client.renderer.entity.RenderItem$1",
"net.minecraft.client.renderer.entity.RenderItem$2",
"net.minecraft.client.renderer.entity.RenderItem$3",
"net.minecraft.client.renderer.entity.RenderItem$4",
"net.minecraft.client.renderer.texture.TextureAtlasSprite$1",
"net.minecraft.client.renderer.texture.TextureManager$1",
"net.minecraft.client.renderer.texture.TextureMap$1",
"net.minecraft.client.renderer.texture.TextureMap$2",
"net.minecraft.client.renderer.texture.TextureMap$3"
};
String[] server = {
"net.minecraft.server.dedicated.DedicatedServer$3",
"net.minecraft.server.dedicated.DedicatedServer$4"
};
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
handlers = ObjectArrays.concat(handlers, client, String.class);
else
handlers = ObjectArrays.concat(handlers, server, String.class);
//FMLLog.info("Preloading CrashReport classes", ForgeVersion.getVersion());
for (String s : handlers)
{
//FMLLog.info("\t" + s);
try
{
Class<?> cls = Class.forName(s, false, MinecraftForge.class.getClassLoader());
if (cls != null && !Callable.class.isAssignableFrom(cls))
{
//FMLLog.info("\t% s is not a instance of callable!", s);
}
}
catch (Exception e){}
}
UsernameCache.load();
// Load before all the mods, so MC owns the MC fluids
FluidRegistry.validateFluidRegistry();
ForgeHooks.initTools();
//For all the normal CrashReport classes to be defined. We're in MC's classloader so this should all be fine
new CrashReport("ThisIsFake", new Exception("Not real"));
}
public static void preloadCrashClasses(ASMDataTable table, String modID, Set<String> classes)
{
//Find all ICrashReportDetail's handlers and preload them.
List<String> all = Lists.newArrayList();
for (ASMData asm : table.getAll(ICrashReportDetail.class.getName().replace('.', '/')))
all.add(asm.getClassName());
for (ASMData asm : table.getAll(ICrashCallable.class.getName().replace('.', '/')))
all.add(asm.getClassName());
all.retainAll(classes);
if (all.size() == 0)
return;
FMLLog.log(modID, Level.DEBUG, "Preloading CrashReport Classes");
Collections.sort(all); //Sort it because I like pretty output ;)
for (String name : all)
{
FMLLog.log(modID, Level.DEBUG, "\t" + name);
try
{
Class.forName(name.replace('/', '.'), false, MinecraftForge.class.getClassLoader());
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
@@ -19,7 +19,7 @@ public class VanillaBrewingRecipe implements IBrewingRecipe {
public boolean isInput(ItemStack stack)
{
Item item = stack.getItem();
return item == Items.potionitem || item == Items.splash_potion || item == Items.lingering_potion || item == Items.glass_bottle;
return item == Items.POTIONITEM || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE;
}
/**
@@ -114,4 +114,11 @@ public final class CapabilityDispatcher implements INBTSerializable<NBTTagCompou
}
}
}
public boolean areCompatible(CapabilityDispatcher other) //Called from ItemStack to compare equality.
{ // Only compares serializeable caps.
if (other == null) return this.writers.length == 0; // Done this way so we can do some pre-checks before doing the costly NBT serialization and compare
if (this.writers.length == 0) return other.writers.length == 0;
return this.serializeNBT().equals(other.serializeNBT());
}
}
@@ -1,10 +1,10 @@
package net.minecraftforge.common.chunkio;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.AnvilChunkLoader;
import net.minecraft.world.gen.ChunkProviderServer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.ChunkPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.ChunkDataEvent;
@@ -78,8 +78,7 @@ class ChunkIOProvider implements Runnable
MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(this.chunk, this.nbt)); // Don't call ChunkDataEvent.Load async
this.chunk.setLastSaveTime(provider.worldObj.getTotalWorldTime());
provider.id2ChunkMap.add(ChunkCoordIntPair.chunkXZ2Int(this.chunkInfo.x, this.chunkInfo.z), this.chunk);
provider.loadedChunks.add(this.chunk);
provider.id2ChunkMap.put(ChunkPos.chunkXZ2Int(this.chunkInfo.x, this.chunkInfo.z), this.chunk);
this.chunk.onChunkLoad();
if (provider.chunkGenerator != null)
@@ -117,7 +117,7 @@ public class Configuration
File fileBak = new File(file.getAbsolutePath() + "_" +
new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".errored");
FMLLog.severe("An exception occurred while loading config file %s. This file will be renamed to %s " +
"and a new config file will be generated.", file.getName(), fileBak.getName());
"and a new config file will be generated.", file.getName(), fileBak.getName());
e.printStackTrace();
file.renameTo(fileBak);
@@ -691,11 +691,6 @@ public class Configuration
*/
public Property get(String category, String key, String defaultValue, String comment, Property.Type type)
{
if (!caseSensitiveCustomCategories)
{
category = category.toLowerCase(Locale.ENGLISH);
}
ConfigCategory cat = getCategory(category);
if (cat.containsKey(key))
@@ -739,11 +734,6 @@ public class Configuration
*/
public Property get(String category, String key, String[] defaultValues, String comment, Property.Type type)
{
if (!caseSensitiveCustomCategories)
{
category = category.toLowerCase(Locale.ENGLISH);
}
ConfigCategory cat = getCategory(category);
if (cat.containsKey(key))
@@ -783,11 +773,15 @@ public class Configuration
public boolean hasCategory(String category)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
return categories.get(category) != null;
}
public boolean hasKey(String category, String key)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
ConfigCategory cat = categories.get(category);
return cat != null && cat.containsKey(key);
}
@@ -909,6 +903,8 @@ public class Configuration
if (tmpList != null) // allow special characters as part of string lists
break;
name = line.substring(nameStart, nameEnd + 1);
if (!caseSensitiveCustomCategories)
name = name.toLowerCase(Locale.ENGLISH);
String qualifiedName = ConfigCategory.getQualifiedName(name, currentCat);
ConfigCategory cat = categories.get(qualifiedName);
@@ -1122,6 +1118,9 @@ public class Configuration
public ConfigCategory getCategory(String category)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
ConfigCategory ret = categories.get(category);
if (ret == null)
@@ -1191,8 +1190,6 @@ public class Configuration
*/
public Configuration setCategoryComment(String category, String comment)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
getCategory(category).setComment(comment);
return this;
}
@@ -1210,8 +1207,6 @@ public class Configuration
*/
public Configuration setCategoryLanguageKey(String category, String langKey)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
getCategory(category).setLanguageKey(langKey);
return this;
}
@@ -1230,9 +1225,6 @@ public class Configuration
*/
public Configuration setCategoryConfigEntryClass(String category, Class<? extends IConfigEntry> clazz)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
getCategory(category).setConfigEntryClass(clazz);
return this;
}
@@ -1244,8 +1236,6 @@ public class Configuration
*/
public Configuration setCategoryRequiresWorldRestart(String category, boolean requiresWorldRestart)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
getCategory(category).setRequiresWorldRestart(requiresWorldRestart);
return this;
}
@@ -1258,8 +1248,6 @@ public class Configuration
*/
public Configuration setCategoryRequiresMcRestart(String category, boolean requiresMcRestart)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
getCategory(category).setRequiresMcRestart(requiresMcRestart);
return this;
}
@@ -1270,8 +1258,6 @@ public class Configuration
*/
public Configuration setCategoryPropertyOrder(String category, List<String> propOrder)
{
if (!caseSensitiveCustomCategories)
category = category.toLowerCase(Locale.ENGLISH);
getCategory(category).setPropertyOrder(propOrder);
return this;
}
@@ -0,0 +1,18 @@
package net.minecraftforge.common.model;
import com.google.common.collect.ImmutableList;
final class HiddenModelPart implements IModelPart
{
private final ImmutableList<String> path;
HiddenModelPart(ImmutableList<String> path)
{
this.path = path;
}
ImmutableList<String> getPath()
{
return path;
}
}
@@ -0,0 +1,24 @@
package net.minecraftforge.common.model;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterators;
import com.google.common.collect.UnmodifiableIterator;
public enum Models
{
;
public static IModelPart getHiddenModelPart(ImmutableList<String> path)
{
return new HiddenModelPart(path);
}
public static UnmodifiableIterator<String> getParts(IModelPart part)
{
if(part instanceof HiddenModelPart)
{
return ((HiddenModelPart) part).getPath().iterator();
}
return Iterators.emptyIterator();
}
}
@@ -78,7 +78,7 @@ public class ExtendedBlockState extends BlockStateContainer
{
if (!property.getAllowedValues().contains(value))
{
throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block " + Block.blockRegistry.getNameForObject(getBlock()) + ", it is not an allowed value");
throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block " + Block.REGISTRY.getNameForObject(getBlock()) + ", it is not an allowed value");
} else
{
if (this.getProperties().get(property) == value)
@@ -106,7 +106,7 @@ public class ExtendedBlockState extends BlockStateContainer
}
if(!property.isValid(value))
{
throw new IllegalArgumentException("Cannot set unlisted property " + property + " to " + value + " on block " + Block.blockRegistry.getNameForObject(getBlock()) + ", it is not an allowed value");
throw new IllegalArgumentException("Cannot set unlisted property " + property + " to " + value + " on block " + Block.REGISTRY.getNameForObject(getBlock()) + ", it is not an allowed value");
}
Map<IUnlistedProperty<?>, Optional<?>> newMap = new HashMap<IUnlistedProperty<?>, Optional<?>>(unlistedProperties);
newMap.put(property, Optional.fromNullable(value));
@@ -139,7 +139,7 @@ public class BlockSnapshot implements Serializable
public TileEntity getTileEntity()
{
if (getNbt() != null)
return TileEntity.createTileEntity(getWorld().getMinecraftServer(), getNbt());
return TileEntity.create(getNbt());
else return null;
}
@@ -1,10 +1,10 @@
package net.minecraftforge.common.util;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.util.math.ChunkPos;
// Sorter to load nearby chunks first
public class ChunkCoordComparator implements java.util.Comparator<ChunkCoordIntPair>
public class ChunkCoordComparator implements java.util.Comparator<ChunkPos>
{
private int x;
private int z;
@@ -15,7 +15,7 @@ public class ChunkCoordComparator implements java.util.Comparator<ChunkCoordIntP
z = (int) entityplayer.posZ >> 4;
}
public int compare(ChunkCoordIntPair a, ChunkCoordIntPair b)
public int compare(ChunkPos a, ChunkPos b)
{
if (a.equals(b))
{
@@ -13,7 +13,7 @@ import net.minecraft.enchantment.EnumEnchantmentType;
import net.minecraft.entity.EnumCreatureAttribute;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.item.EntityPainting.EnumArt;
import net.minecraft.entity.player.EntityPlayer.EnumStatus;
import net.minecraft.entity.player.EntityPlayer.SleepResult;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item.ToolMaterial;
@@ -38,7 +38,7 @@ public class EnumHelper
private static Class<?>[][] commonTypes =
{
{EnumAction.class},
{ArmorMaterial.class, String.class, int.class, int[].class, int.class, SoundEvent.class},
{ArmorMaterial.class, String.class, int.class, int[].class, int.class, SoundEvent.class, float.class},
{EnumArt.class, String.class, int.class, int.class, int.class, int.class},
{EnumCreatureAttribute.class},
{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class},
@@ -47,7 +47,7 @@ public class EnumHelper
{Sensitivity.class},
{RayTraceResult.Type.class},
{EnumSkyBlock.class, int.class},
{EnumStatus.class},
{SleepResult.class},
{ToolMaterial.class, int.class, int.class, float.class, float.class, int.class},
{EnumRarity.class, TextFormatting.class, String.class}
};
@@ -56,9 +56,9 @@ public class EnumHelper
{
return addEnum(EnumAction.class, name);
}
public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip)
public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip, float toughness)
{
return addEnum(ArmorMaterial.class, name, textureName, durability, reductionAmounts, enchantability, soundOnEquip);
return addEnum(ArmorMaterial.class, name, textureName, durability, reductionAmounts, enchantability, soundOnEquip, toughness);
}
public static EnumArt addArt(String name, String tile, int sizeX, int sizeY, int offsetX, int offsetY)
{
@@ -92,9 +92,9 @@ public class EnumHelper
{
return addEnum(EnumSkyBlock.class, name, lightValue);
}
public static EnumStatus addStatus(String name)
public static SleepResult addStatus(String name)
{
return addEnum(EnumStatus.class, name);
return addEnum(SleepResult.class, name);
}
public static ToolMaterial addToolMaterial(String name, int harvestLevel, int maxUses, float efficiency, float damage, int enchantability)
{
@@ -181,13 +181,13 @@ public class EnumHelper
blankField(enumClass, "enumConstants");
}
public static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
private static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
{
setup();
return addEnum(commonTypes, enumType, enumName, paramValues);
}
public static <T extends Enum<? >> T addEnum(Class<?>[][] map, Class<T> enumType, String enumName, Object... paramValues)
protected static <T extends Enum<? >> T addEnum(Class<?>[][] map, Class<T> enumType, String enumName, Object... paramValues)
{
for (Class<?>[] lookup : map)
{
@@ -353,4 +353,4 @@ public class EnumHelper
setup();
}
}
}
}
@@ -14,7 +14,7 @@ import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayer.EnumStatus;
import net.minecraft.entity.player.EntityPlayer.SleepResult;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -35,7 +35,7 @@ import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.ChunkPrimer;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.storage.IPlayerFileData;
@@ -135,6 +135,8 @@ public class ForgeEventFactory
public static Result canEntitySpawn(EntityLiving entity, World world, float x, float y, float z)
{
if (entity == null)
return Result.DEFAULT;
LivingSpawnEvent.CheckSpawn event = new LivingSpawnEvent.CheckSpawn(entity, world, x, y, z);
MinecraftForge.EVENT_BUS.post(event);
return event.getResult();
@@ -162,7 +164,7 @@ public class ForgeEventFactory
return event.getDroppedExperience();
}
public static List<BiomeGenBase.SpawnListEntry> getPotentialSpawns(WorldServer world, EnumCreatureType type, BlockPos pos, List<BiomeGenBase.SpawnListEntry> oldList)
public static List<Biome.SpawnListEntry> getPotentialSpawns(WorldServer world, EnumCreatureType type, BlockPos pos, List<Biome.SpawnListEntry> oldList)
{
WorldEvent.PotentialSpawns event = new WorldEvent.PotentialSpawns(world, type, pos, oldList);
if (MinecraftForge.EVENT_BUS.post(event))
@@ -308,7 +310,7 @@ public class ForgeEventFactory
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, event.getFilledBucket());
if (!player.inventory.addItemStackToInventory(event.getFilledBucket()))
player.dropPlayerItemWithRandomChoice(event.getFilledBucket(), false);
player.dropItem(event.getFilledBucket(), false);
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
}
@@ -369,7 +371,7 @@ public class ForgeEventFactory
return true;
}
public static EnumStatus onPlayerSleepInBed(EntityPlayer player, BlockPos pos)
public static SleepResult onPlayerSleepInBed(EntityPlayer player, BlockPos pos)
{
PlayerSleepInBedEvent event = new PlayerSleepInBedEvent(player, pos);
MinecraftForge.EVENT_BUS.post(event);
@@ -456,12 +458,12 @@ public class ForgeEventFactory
public static boolean renderFireOverlay(EntityPlayer player, float renderPartialTicks)
{
return renderBlockOverlay(player, renderPartialTicks, OverlayType.FIRE, Blocks.fire.getDefaultState(), new BlockPos(player));
return renderBlockOverlay(player, renderPartialTicks, OverlayType.FIRE, Blocks.FIRE.getDefaultState(), new BlockPos(player));
}
public static boolean renderWaterOverlay(EntityPlayer player, float renderPartialTicks)
{
return renderBlockOverlay(player, renderPartialTicks, OverlayType.WATER, Blocks.water.getDefaultState(), new BlockPos(player));
return renderBlockOverlay(player, renderPartialTicks, OverlayType.WATER, Blocks.WATER.getDefaultState(), new BlockPos(player));
}
public static boolean renderBlockOverlay(EntityPlayer player, float renderPartialTicks, OverlayType type, IBlockState block, BlockPos pos)
@@ -10,8 +10,8 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.world.World;
/**
* LivingSpawnEvent is fired whenever a living Entity is spawned. <br>
* If a method utilizes this {@link Event} as its parameter, the method will
* LivingSpawnEvent is fired for any events associated with Living Enttnies spawn status. <br>
* If a method utilizes this {@link Event} as its parameter, the method will
* receive every child event of this class.<br>
* <br>
* {@link #world} contains the world in which this living Entity is being spawned.<br>
@@ -27,7 +27,7 @@ public class LivingSpawnEvent extends LivingEvent
private final float x;
private final float y;
private final float z;
public LivingSpawnEvent(EntityLiving entity, World world, float x, float y, float z)
{
super(entity);
@@ -43,7 +43,7 @@ public class LivingSpawnEvent extends LivingEvent
public float getZ() { return z; }
/**
* Fires before mob spawn events.
*
*
* Result is significant:
* DEFAULT: use vanilla spawn rules
* ALLOW: allow the spawn
@@ -60,9 +60,8 @@ public class LivingSpawnEvent extends LivingEvent
}
/**
* SpecialSpawn is fired when an Entity is to be spawned from a mob spawner.<br>
* This event is fired whenever an Entity is spawned in a mob spawner in<br>
* {@link WorldEntitySpawner#findChunksForSpawning(WorldServer, boolean, boolean, boolean)}.<br>
* SpecialSpawn is fired when an Entity is to be spawned.<br>
* This allows you to do special inializers in the new entity.<br>
* <br>
* This event is fired via the {@link ForgeEventFactory#doSpecialSpawn(EntityLiving, World, float, float, float)}.<br>
* <br>
@@ -81,17 +80,17 @@ public class LivingSpawnEvent extends LivingEvent
super(entity, world, x, y, z);
}
}
/**
* Fired each tick for despawnable mobs to allow control over despawning.
* {@link Result#DEFAULT} will pass the mob on to vanilla despawn mechanics.
* {@link Result#ALLOW} will force the mob to despawn.
* {@link Result#DENY} will force the mob to remain.
* This is fired every tick for every despawnable entity. Be efficient in your handlers.
*
*
* Note: this is not fired <em>if</em> the mob is definitely going to otherwise despawn. It is fired to check if
* the mob can be allowed to despawn. See {@link EntityLiving#despawnEntity}
*
*
* @author cpw
*
*/
@@ -102,6 +101,6 @@ public class LivingSpawnEvent extends LivingEvent
{
super(entity, entity.worldObj, (float)entity.posX, (float)entity.posY, (float)entity.posZ);
}
}
}
@@ -4,7 +4,7 @@ import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.play.client.CPacketPlayerBlockPlacement;
import net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock;
import net.minecraft.network.play.client.CPacketPlayerTryUseItem;
import net.minecraft.server.management.PlayerInteractionManager;
import net.minecraft.util.EnumFacing;
@@ -27,8 +27,8 @@ import net.minecraft.util.EnumHand;
* {@link EntityPlayer#damageShield(float)},
* {@link ForgeHooks#getContainerItem(ItemStack)},
* {@link PlayerInteractionManager#processRightClick(EntityPlayer, World, ItemStack, EnumHand)},
* {@link NetHandlerPlayServer#processPlayerBlockPlacement(CPacketPlayerBlockPlacement)}
* and {@link NetHandlerPlayServer#processRightClickBlock(CPacketPlayerTryUseItem)}.<br>
* {@link NetHandlerPlayServer#processPlayerBlockPlacement(CPacketPlayerTryUseItem)}
* and {@link NetHandlerPlayServer#processRightClickBlock(CPacketPlayerTryUseItemOnBlock)}.<br>
* <br>
* {@link #original} contains the original ItemStack before the item was destroyed. <br>
* (@link #hand) contains the hand that the current item was held in.<br>
@@ -1,7 +1,7 @@
package net.minecraftforge.event.entity.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayer.EnumStatus;
import net.minecraft.entity.player.EntityPlayer.SleepResult;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
@@ -22,7 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
**/
public class PlayerSleepInBedEvent extends PlayerEvent
{
private EnumStatus result = null;
private SleepResult result = null;
private final BlockPos pos;
public PlayerSleepInBedEvent(EntityPlayer player, BlockPos pos)
@@ -31,12 +31,12 @@ public class PlayerSleepInBedEvent extends PlayerEvent
this.pos = pos;
}
public EnumStatus getResultStatus()
public SleepResult getResultStatus()
{
return result;
}
public void setResult(EnumStatus result)
public void setResult(SleepResult result)
{
this.result = result;
}
@@ -5,25 +5,26 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.block.state.IBlockState;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
/**
* BiomeEvent is fired whenever an event involving biomes occurs.<br>
* If a method utilizes this {@link Event} as its parameter, the method will
* receive every child event of this class.<br>
* <br>
* All children of this event are fired on the {@link MinecraftForge#TERRAIN_GEN_BUS}.
* All children of this event are fired on the {@link MinecraftForge#TERRAIN_GEN_BUS}
* unless stated otherwise in their Javadocs.
**/
public class BiomeEvent extends Event
{
private final BiomeGenBase biome;
private final Biome biome;
public BiomeEvent(BiomeGenBase biome)
public BiomeEvent(Biome biome)
{
this.biome = biome;
}
public BiomeGenBase getBiome()
public Biome getBiome()
{
return biome;
}
@@ -47,7 +48,7 @@ public class BiomeEvent extends Event
private final BiomeDecorator originalBiomeDecorator;
private BiomeDecorator newBiomeDecorator;
public CreateDecorator(BiomeGenBase biome, BiomeDecorator original)
public CreateDecorator(Biome biome, BiomeDecorator original)
{
super(biome);
originalBiomeDecorator = original;
@@ -75,14 +76,14 @@ public class BiomeEvent extends Event
* If a method utilizes this {@link Event} as its parameter, the method will
* receive every child event of this class.<br>
* <br>
* All children of this event are fired on the {@link MinecraftForge#TERRAIN_GEN_BUS}.
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.
**/
public static class BiomeColor extends BiomeEvent
{
private final int originalColor;
private int newColor;
public BiomeColor(BiomeGenBase biome, int original)
public BiomeColor(Biome biome, int original)
{
super(biome);
originalColor = original;
@@ -117,7 +118,7 @@ public class BiomeEvent extends Event
private final IBlockState original;
private IBlockState replacement;
public GetVillageBlockID(BiomeGenBase biome, IBlockState original)
public GetVillageBlockID(Biome biome, IBlockState original)
{
super(biome);
this.original = original;
@@ -144,7 +145,7 @@ public class BiomeEvent extends Event
*/
public static class GetGrassColor extends BiomeColor
{
public GetGrassColor(BiomeGenBase biome, int original)
public GetGrassColor(Biome biome, int original)
{
super(biome, original);
}
@@ -155,7 +156,7 @@ public class BiomeEvent extends Event
*/
public static class GetFoliageColor extends BiomeColor
{
public GetFoliageColor(BiomeGenBase biome, int original)
public GetFoliageColor(Biome biome, int original)
{
super(biome, original);
}
@@ -166,7 +167,7 @@ public class BiomeEvent extends Event
*/
public static class GetWaterColor extends BiomeColor
{
public GetWaterColor(BiomeGenBase biome, int original)
public GetWaterColor(Biome biome, int original)
{
super(biome, original);
}
@@ -2,7 +2,7 @@ package net.minecraftforge.event.terraingen;
import java.util.Random;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
@@ -13,7 +13,7 @@ import net.minecraft.world.World;
/**DecorateBiomeEvent is fired when a BiomeDecorator is created.
* <br>
* This event is fired whenever a BiomeDecorator is created in
* {@link DeferredBiomeDecorator#fireCreateEventAndReplace(BiomeGenBase)}.<br>
* {@link DeferredBiomeDecorator#fireCreateEventAndReplace(Biome)}.<br>
* <br>
* {@link #world} contains the world that is being decorated. <br>
* {@link #rand} contains an instance of Random to be used. <br>
@@ -4,7 +4,7 @@ import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.MinecraftForge;
public class DeferredBiomeDecorator extends BiomeDecorator {
@@ -16,13 +16,13 @@ public class DeferredBiomeDecorator extends BiomeDecorator {
}
@Override
public void decorate(World par1World, Random par2Random, BiomeGenBase biome, BlockPos pos)
public void decorate(World par1World, Random par2Random, Biome biome, BlockPos pos)
{
fireCreateEventAndReplace(biome);
// On first call to decorate, we fire and substitute ourselves, if we haven't already done so
biome.theBiomeDecorator.decorate(par1World, par2Random, biome, pos);
}
public void fireCreateEventAndReplace(BiomeGenBase biome)
public void fireCreateEventAndReplace(Biome biome)
{
// Copy any configuration from us to the real instance.
wrapped.bigMushroomsPerChunk = bigMushroomsPerChunk;
@@ -101,13 +101,13 @@ public class BlockEvent extends Event
this.player = player;
if (state == null || !ForgeHooks.canHarvestBlock(state.getBlock(), player, world, pos) || // Handle empty block or player unable to break block scenario
(state.getBlock().canSilkHarvest(world, pos, world.getBlockState(pos), player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.silkTouch, player.getHeldItemMainhand()) > 0)) // If the block is being silk harvested, the exp dropped is 0
(state.getBlock().canSilkHarvest(world, pos, world.getBlockState(pos), player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, player.getHeldItemMainhand()) > 0)) // If the block is being silk harvested, the exp dropped is 0
{
this.exp = 0;
}
else
{
int bonusLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.fortune, player.getHeldItemMainhand());
int bonusLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, player.getHeldItemMainhand());
this.exp = state.getBlock().getExpDrop(state, world, pos, bonusLevel);
}
}
@@ -1,15 +1,15 @@
package net.minecraftforge.event.world;
import net.minecraft.server.management.PlayerManager;
import net.minecraft.server.management.PlayerChunkMapEntry;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.math.ChunkPos;
/**
* ChunkWatchEvent is fired when an event involving a chunk being watched occurs.<br>
* If a method utilizes this {@link Event} as its parameter, the method will
* If a method utilizes this {@link Event} as its parameter, the method will
* receive every child event of this class.<br>
* <br>
* {@link #chunk} contains the ChunkCoordIntPair of the Chunk this event is affecting.<br>
@@ -19,16 +19,16 @@ import net.minecraft.entity.player.EntityPlayerMP;
**/
public class ChunkWatchEvent extends Event
{
private final ChunkCoordIntPair chunk;
private final ChunkPos chunk;
private final EntityPlayerMP player;
public ChunkWatchEvent(ChunkCoordIntPair chunk, EntityPlayerMP player)
public ChunkWatchEvent(ChunkPos chunk, EntityPlayerMP player)
{
this.chunk = chunk;
this.player = player;
}
public ChunkCoordIntPair getChunk()
public ChunkPos getChunk()
{
return chunk;
}
@@ -51,13 +51,13 @@ public class ChunkWatchEvent extends Event
**/
public static class Watch extends ChunkWatchEvent
{
public Watch(ChunkCoordIntPair chunk, EntityPlayerMP player) { super(chunk, player); }
public Watch(ChunkPos chunk, EntityPlayerMP player) { super(chunk, player); }
}
/**
* ChunkWatchEvent.UnWatch is fired when an EntityPlayer stops watching a chunk.<br>
* This event is fired when a chunk is removed from the watched chunks of an EntityPlayer in
* {@link PlayerManager.PlayerInstance#removePlayer(EntityPlayerMP)}. <br>
* {@link PlayerChunkMapEntry#removePlayer(EntityPlayerMP)}. <br>
* <br>
* This event is not {@link Cancelable}.<br>
* <br>
@@ -67,6 +67,6 @@ public class ChunkWatchEvent extends Event
**/
public static class UnWatch extends ChunkWatchEvent
{
public UnWatch(ChunkCoordIntPair chunkLocation, EntityPlayerMP player) { super(chunkLocation, player); }
public UnWatch(ChunkPos chunkLocation, EntityPlayerMP player) { super(chunkLocation, player); }
}
}
@@ -17,11 +17,7 @@ import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.ForgeInternalHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraft.world.biome.Biome.SpawnListEntry;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
@@ -41,47 +41,47 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
static
{
defaultDisplacements.put(Blocks.oak_door, false);
defaultDisplacements.put(Blocks.spruce_door, false);
defaultDisplacements.put(Blocks.birch_door, false);
defaultDisplacements.put(Blocks.jungle_door, false);
defaultDisplacements.put(Blocks.acacia_door, false);
defaultDisplacements.put(Blocks.dark_oak_door, false);
defaultDisplacements.put(Blocks.trapdoor, false);
defaultDisplacements.put(Blocks.iron_trapdoor, false);
defaultDisplacements.put(Blocks.oak_fence, false);
defaultDisplacements.put(Blocks.spruce_fence, false);
defaultDisplacements.put(Blocks.birch_fence, false);
defaultDisplacements.put(Blocks.jungle_fence, false);
defaultDisplacements.put(Blocks.dark_oak_fence, false);
defaultDisplacements.put(Blocks.acacia_fence, false);
defaultDisplacements.put(Blocks.nether_brick_fence, false);
defaultDisplacements.put(Blocks.oak_fence_gate, false);
defaultDisplacements.put(Blocks.spruce_fence_gate, false);
defaultDisplacements.put(Blocks.birch_fence_gate, false);
defaultDisplacements.put(Blocks.jungle_fence_gate, false);
defaultDisplacements.put(Blocks.dark_oak_fence_gate, false);
defaultDisplacements.put(Blocks.acacia_fence_gate, false);
defaultDisplacements.put(Blocks.wooden_pressure_plate, false);
defaultDisplacements.put(Blocks.stone_pressure_plate, false);
defaultDisplacements.put(Blocks.light_weighted_pressure_plate, false);
defaultDisplacements.put(Blocks.heavy_weighted_pressure_plate, false);
defaultDisplacements.put(Blocks.ladder, false);
defaultDisplacements.put(Blocks.iron_bars, false);
defaultDisplacements.put(Blocks.glass_pane, false);
defaultDisplacements.put(Blocks.stained_glass_pane, false);
defaultDisplacements.put(Blocks.portal, false);
defaultDisplacements.put(Blocks.end_portal, false);
defaultDisplacements.put(Blocks.cobblestone_wall, false);
defaultDisplacements.put(Blocks.barrier, false);
defaultDisplacements.put(Blocks.standing_banner, false);
defaultDisplacements.put(Blocks.wall_banner, false);
defaultDisplacements.put(Blocks.cake, false);
defaultDisplacements.put(Blocks.OAK_DOOR, false);
defaultDisplacements.put(Blocks.SPRUCE_DOOR, false);
defaultDisplacements.put(Blocks.BIRCH_DOOR, false);
defaultDisplacements.put(Blocks.JUNGLE_DOOR, false);
defaultDisplacements.put(Blocks.ACACIA_DOOR, false);
defaultDisplacements.put(Blocks.DARK_OAK_DOOR, false);
defaultDisplacements.put(Blocks.TRAPDOOR, false);
defaultDisplacements.put(Blocks.IRON_TRAPDOOR, false);
defaultDisplacements.put(Blocks.OAK_FENCE, false);
defaultDisplacements.put(Blocks.SPRUCE_FENCE, false);
defaultDisplacements.put(Blocks.BIRCH_FENCE, false);
defaultDisplacements.put(Blocks.JUNGLE_FENCE, false);
defaultDisplacements.put(Blocks.DARK_OAK_FENCE, false);
defaultDisplacements.put(Blocks.ACACIA_FENCE, false);
defaultDisplacements.put(Blocks.NETHER_BRICK_FENCE, false);
defaultDisplacements.put(Blocks.OAK_FENCE_GATE, false);
defaultDisplacements.put(Blocks.SPRUCE_FENCE_GATE, false);
defaultDisplacements.put(Blocks.BIRCH_FENCE_GATE, false);
defaultDisplacements.put(Blocks.JUNGLE_FENCE_GATE, false);
defaultDisplacements.put(Blocks.DARK_OAK_FENCE_GATE, false);
defaultDisplacements.put(Blocks.ACACIA_FENCE_GATE, false);
defaultDisplacements.put(Blocks.WOODEN_PRESSURE_PLATE, false);
defaultDisplacements.put(Blocks.STONE_PRESSURE_PLATE, false);
defaultDisplacements.put(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, false);
defaultDisplacements.put(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, false);
defaultDisplacements.put(Blocks.LADDER, false);
defaultDisplacements.put(Blocks.IRON_BARS, false);
defaultDisplacements.put(Blocks.GLASS_PANE, false);
defaultDisplacements.put(Blocks.STAINED_GLASS_PANE, false);
defaultDisplacements.put(Blocks.PORTAL, false);
defaultDisplacements.put(Blocks.END_PORTAL, false);
defaultDisplacements.put(Blocks.COBBLESTONE_WALL, false);
defaultDisplacements.put(Blocks.BARRIER, false);
defaultDisplacements.put(Blocks.STANDING_BANNER, false);
defaultDisplacements.put(Blocks.WALL_BANNER, false);
defaultDisplacements.put(Blocks.CAKE, false);
defaultDisplacements.put(Blocks.iron_door, false);
defaultDisplacements.put(Blocks.standing_sign, false);
defaultDisplacements.put(Blocks.wall_sign, false);
defaultDisplacements.put(Blocks.reeds, false);
defaultDisplacements.put(Blocks.IRON_DOOR, false);
defaultDisplacements.put(Blocks.STANDING_SIGN, false);
defaultDisplacements.put(Blocks.WALL_SIGN, false);
defaultDisplacements.put(Blocks.REEDS, false);
}
protected Map<Block, Boolean> displacements = Maps.newHashMap();
@@ -212,7 +212,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
}
Material material = state.getMaterial();
if (material.blocksMovement() || material == Material.portal)
if (material.blocksMovement() || material == Material.PORTAL)
{
return false;
}
@@ -261,7 +261,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
}
Material material = state.getMaterial();
if (material.blocksMovement() || material == Material.portal)
if (material.blocksMovement() || material == Material.PORTAL)
{
return false;
}
@@ -298,7 +298,7 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock)
{
world.scheduleUpdate(pos, this, tickRate);
}
@@ -43,7 +43,7 @@ public class BlockFluidClassic extends BlockFluidBase
public int getQuantaValue(IBlockAccess world, BlockPos pos)
{
IBlockState state = world.getBlockState(pos);
if (state.getBlock() == Blocks.air)
if (state.getBlock() == Blocks.AIR)
{
return 0;
}
@@ -291,9 +291,9 @@ public class BlockFluidClassic extends BlockFluidBase
Material material = state.getMaterial();
if (material.blocksMovement() ||
material == Material.water ||
material == Material.lava ||
material == Material.portal)
material == Material.WATER ||
material == Material.LAVA ||
material == Material.PORTAL)
{
return false;
}
@@ -266,13 +266,13 @@ public class Fluid
{
if(fillSound == null)
{
if(getBlock() != null && getBlock().getDefaultState().getMaterial() == Material.lava)
if(getBlock() != null && getBlock().getDefaultState().getMaterial() == Material.LAVA)
{
fillSound = SoundEvents.item_bucket_fill_lava;
fillSound = SoundEvents.ITEM_BUCKET_FILL_LAVA;
}
else
{
fillSound = SoundEvents.item_bucket_fill;
fillSound = SoundEvents.ITEM_BUCKET_FILL;
}
}
@@ -283,13 +283,13 @@ public class Fluid
{
if(emptySound == null)
{
if(getBlock() != null && getBlock().getDefaultState().getMaterial() == Material.lava)
if(getBlock() != null && getBlock().getDefaultState().getMaterial() == Material.LAVA)
{
emptySound = SoundEvents.item_bucket_empty_lava;
emptySound = SoundEvents.ITEM_BUCKET_EMPTY_LAVA;
}
else
{
emptySound = SoundEvents.item_bucket_empty;
emptySound = SoundEvents.ITEM_BUCKET_EMPTY;
}
}
@@ -71,15 +71,15 @@ public abstract class FluidContainerRegistry
private static Set<ContainerKey> emptyContainers = Sets.newHashSet();
public static final int BUCKET_VOLUME = 1000;
public static final ItemStack EMPTY_BUCKET = new ItemStack(Items.bucket);
public static final ItemStack EMPTY_BOTTLE = new ItemStack(Items.glass_bottle);
private static final ItemStack NULL_EMPTYCONTAINER = new ItemStack(Items.bucket);
public static final ItemStack EMPTY_BUCKET = new ItemStack(Items.BUCKET);
public static final ItemStack EMPTY_BOTTLE = new ItemStack(Items.GLASS_BOTTLE);
private static final ItemStack NULL_EMPTYCONTAINER = new ItemStack(Items.BUCKET);
static
{
registerFluidContainer(FluidRegistry.WATER, new ItemStack(Items.water_bucket), EMPTY_BUCKET);
registerFluidContainer(FluidRegistry.LAVA, new ItemStack(Items.lava_bucket), EMPTY_BUCKET);
registerFluidContainer(FluidRegistry.WATER, new ItemStack(Items.potionitem), EMPTY_BOTTLE);
registerFluidContainer(FluidRegistry.WATER, new ItemStack(Items.WATER_BUCKET), EMPTY_BUCKET);
registerFluidContainer(FluidRegistry.LAVA, new ItemStack(Items.LAVA_BUCKET), EMPTY_BUCKET);
registerFluidContainer(FluidRegistry.WATER, new ItemStack(Items.POTIONITEM), EMPTY_BOTTLE);
}
private FluidContainerRegistry(){}
@@ -55,14 +55,14 @@ public abstract class FluidRegistry
public String getLocalizedName(FluidStack fs) {
return I18n.translateToLocal("tile.water.name");
}
}.setBlock(Blocks.water).setUnlocalizedName(Blocks.water.getUnlocalizedName());
}.setBlock(Blocks.WATER).setUnlocalizedName(Blocks.WATER.getUnlocalizedName());
public static final Fluid LAVA = new Fluid("lava", new ResourceLocation("blocks/lava_still"), new ResourceLocation("blocks/lava_flow")) {
@Override
public String getLocalizedName(FluidStack fs) {
return I18n.translateToLocal("tile.lava.name");
}
}.setBlock(Blocks.lava).setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1300).setUnlocalizedName(Blocks.lava.getUnlocalizedName());
}.setBlock(Blocks.LAVA).setLuminosity(15).setDensity(3000).setViscosity(6000).setTemperature(1300).setUnlocalizedName(Blocks.LAVA.getUnlocalizedName());
static
{
@@ -367,7 +367,7 @@ public class FluidUtil
max = fluidContainer.getCapacity(container);
}
FluidStack drained = fluidContainer.drain(container, max, false);
if (drained != null)
if (drained != null && tank.canFill(side, drained.getFluid()))
{
// check how much we can fill into the tank
int filled = tank.fill(side, drained, false);
@@ -20,10 +20,11 @@ public class TileFluidHandler extends TileEntity implements IFluidHandler
}
@Override
public void writeToNBT(NBTTagCompound tag)
public NBTTagCompound writeToNBT(NBTTagCompound tag)
{
super.writeToNBT(tag);
tag = super.writeToNBT(tag);
tank.writeToNBT(tag);
return tag;
}
/* IFluidHandler */
@@ -54,7 +54,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem
this.setMaxStackSize(1);
this.setCreativeTab(CreativeTabs.tabMisc);
this.setCreativeTab(CreativeTabs.MISC);
}
@SideOnly(Side.CLIENT)
@@ -107,7 +107,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem
}
// clicked on a block?
RayTraceResult mop = this.getMovingObjectPositionFromPlayer(world, player, false);
RayTraceResult mop = this.rayTrace(world, player, false);
if(mop == null || mop.typeOfHit != RayTraceResult.Type.BLOCK)
{
@@ -129,7 +129,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem
&& !player.capabilities.isCreativeMode)
{
// success!
player.addStat(StatList.func_188057_b(this));
player.addStat(StatList.getObjectUseStats(this));
itemstack.stackSize--;
ItemStack emptyStack = getEmpty() != null ? getEmpty().copy() : new ItemStack(this);
@@ -181,12 +181,12 @@ public class UniversalBucket extends Item implements IFluidContainerItem
}
// water goes poof?
if (worldIn.provider.doesWaterVaporize() && (block == Blocks.flowing_water || block == Blocks.water))
if (worldIn.provider.doesWaterVaporize() && (block == Blocks.FLOWING_WATER || block == Blocks.WATER))
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
worldIn.playSound(null, pos, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F,
worldIn.playSound(null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F,
2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
for (int l = 0; l < 8; ++l)
@@ -68,7 +68,7 @@ import net.minecraft.util.IThreadListener;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.storage.SaveFormatComparator;
import net.minecraft.world.storage.WorldSummary;
import net.minecraft.world.storage.SaveFormatOld;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
@@ -662,7 +662,7 @@ public class FMLClientHandler implements IFMLSidedHandler
@Override
public NetworkManager getClientToServerNetworkManager()
{
return this.client.getNetHandler()!=null ? this.client.getNetHandler().getNetworkManager() : null;
return this.client.getConnection()!=null ? this.client.getConnection().getNetworkManager() : null;
}
public void handleClientWorldClosing(WorldClient world)
@@ -683,7 +683,7 @@ public class FMLClientHandler implements IFMLSidedHandler
{
return new File(client.mcDataDir, "saves");
}
public void tryLoadExistingWorld(GuiWorldSelection selectWorldGUI, SaveFormatComparator comparator)
public void tryLoadExistingWorld(GuiWorldSelection selectWorldGUI, WorldSummary comparator)
{
File dir = new File(getSavesDir(), comparator.getFileName());
NBTTagCompound leveldat;
@@ -584,7 +584,7 @@ public class GuiModList extends GuiScreen
for (ITextComponent part : line) {
if (!(part instanceof TextComponentString))
continue;
k += GuiModList.this.fontRendererObj.getStringWidth(((TextComponentString)part).getChatComponentText_TextValue());
k += GuiModList.this.fontRendererObj.getStringWidth(((TextComponentString)part).getText());
if (k >= x)
{
GuiModList.this.handleComponentClick(part);
@@ -287,7 +287,7 @@ public abstract class GuiScrollingList
{
GlStateManager.disableLighting();
GlStateManager.disableFog();
this.client.renderEngine.bindTexture(Gui.optionsBackground);
this.client.renderEngine.bindTexture(Gui.OPTIONS_BACKGROUND);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
float scale = 32.0F;
worldr.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
@@ -47,7 +47,7 @@ public class GuiButtonExt extends GuiButton
{
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
int k = this.getHoverState(this.hovered);
GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition, this.yPosition, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
GuiUtils.drawContinuousTexturedBox(BUTTON_TEXTURES, this.xPosition, this.yPosition, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
this.mouseDragged(mc, mouseX, mouseY);
int color = 14737632;
@@ -40,7 +40,7 @@ public class GuiCheckBox extends GuiButton
if (this.visible)
{
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.boxWidth && mouseY < this.yPosition + this.height;
GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition, this.yPosition, 0, 46, this.boxWidth, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
GuiUtils.drawContinuousTexturedBox(BUTTON_TEXTURES, this.xPosition, this.yPosition, 0, 46, this.boxWidth, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
this.mouseDragged(mc, mouseX, mouseY);
int color = 14737632;
@@ -13,6 +13,7 @@
package net.minecraftforge.fml.client.config;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
/**
@@ -39,7 +40,7 @@ public class GuiUnicodeGlyphButton extends GuiButtonExt
{
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
int k = this.getHoverState(this.hovered);
GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition, this.yPosition, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
GuiUtils.drawContinuousTexturedBox(GuiButton.BUTTON_TEXTURES, this.xPosition, this.yPosition, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
this.mouseDragged(mc, mouseX, mouseY);
int color = 14737632;
@@ -366,7 +366,7 @@ public class FMLCommonHandler
{
for (ICrashCallable call: crashCallables)
{
category.addCrashSectionCallable(call.getLabel(), call);
category.setDetail(call.getLabel(), call);
}
}
@@ -27,6 +27,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.Mod.Metadata;
import net.minecraftforge.fml.common.asm.transformers.BlamingTransformer;
@@ -466,6 +467,10 @@ public class FMLModContainer implements ModContainer
ModClassLoader modClassLoader = event.getModClassLoader();
modClassLoader.addFile(source);
modClassLoader.clearNegativeCacheFor(candidate.getClassList());
//Only place I could think to add this...
MinecraftForge.preloadCrashClasses(event.getASMHarvestedData(), getModId(), candidate.getClassList());
Class<?> clazz = Class.forName(className, true, modClassLoader);
Certificate[] certificates = clazz.getProtectionDomain().getCodeSource().getCertificates();
@@ -5,16 +5,16 @@
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
*
* Contributors:
* cpw - implementation
*/
package net.minecraftforge.fml.common;
import java.util.concurrent.Callable;
import net.minecraft.crash.ICrashReportDetail;
public interface ICrashCallable extends Callable<String>
public interface ICrashCallable extends ICrashReportDetail<String>
{
String getLabel();
}
@@ -26,11 +26,14 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.ICrashReportDetail;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.fml.common.LoaderState.ModState;
import net.minecraftforge.fml.common.ModContainer.Disableable;
import net.minecraftforge.fml.common.ProgressManager.ProgressBar;
import net.minecraftforge.fml.common.discovery.ASMDataTable.ASMData;
import net.minecraftforge.fml.common.discovery.ModDiscoverer;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.event.FMLLoadEvent;
@@ -131,7 +131,14 @@ public class ModClassLoader extends URLClassLoader
"log4j-core-",
"lwjgl-",
"lwjgl_util-",
"twitch-"
"twitch-",
"jline-",
"jna-",
"platform-",
"oshi-core-",
"netty-",
"libraryjavasound-",
"fastutil-"
};
for (String s : prefixes)
{
@@ -15,6 +15,8 @@ import net.minecraftforge.fml.relauncher.FMLRelaunchLog;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.signature.SignatureReader;
import org.objectweb.asm.signature.SignatureWriter;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
@@ -97,8 +99,16 @@ public class ModAPITransformer implements IClassTransformer {
private void stripInterface(ClassNode classNode, String interfaceName, boolean stripRefs)
{
String ifaceName = interfaceName.replace('.', '/');
final String ifaceName = interfaceName.replace('.', '/');
boolean found = classNode.interfaces.remove(ifaceName);
if (found && classNode.signature != null)
{
SignatureReader sr = new SignatureReader(classNode.signature);
final RemovingSignatureWriter signatureWriter = new RemovingSignatureWriter(ifaceName);
sr.accept(signatureWriter);
classNode.signature = signatureWriter.toString();
if (logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s removed from type signature");
}
if (found && logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s removed", interfaceName);
if (!found && logDebugInfo) FMLRelaunchLog.finer("Optional removal - interface %s NOT removed - not found", interfaceName);
@@ -157,4 +167,25 @@ public class ModAPITransformer implements IClassTransformer {
}
}
private static class RemovingSignatureWriter extends SignatureWriter
{
private final String ifaceName;
RemovingSignatureWriter(String ifaceName)
{
this.ifaceName = ifaceName;
}
@Override
public void visitClassType(String name)
{
if (name.equals(ifaceName)) {
super.visitClassType("java/lang/Object");
}
else
{
super.visitClassType(name);
}
}
}
}
@@ -134,11 +134,15 @@ public class TerminalTransformer implements IClassTransformer
String callingClass = cause.length > 2 ? cause[3].getClassName() : "none";
String callingParent = cause.length > 3 ? cause[4].getClassName() : "none";
// FML is allowed to call system exit and the Minecraft applet (from the quit button), and the dedicated server (from itself)
if (!(callingClass.startsWith("net.minecraftforge.fml.") ||
("net.minecraft.client.Minecraft".equals(callingClass) && "net.minecraft.client.Minecraft".equals(callingParent)) ||
("net.minecraft.server.gui.MinecraftServerGui$1".equals(callingClass) && "java.awt.AWTEventMulticaster".equals(callingParent)) ||
("net.minecraft.server.dedicated.DedicatedServer".equals(callingClass) && "net.minecraft.server.MinecraftServer".equals(callingParent)))
)
boolean allowed = false;
allowed |= callingClass.startsWith("net.minecraftforge.fml.");
allowed |= callingClass.equals("net.minecraft.client.Minecraft") && callingParent.equals("net.minecraft.client.Minecraft");
allowed |= callingClass.equals("net.minecraft.server.gui.MinecraftServerGui$1") && callingParent.equals("java.awt.AWTEventMulticaster");
allowed |= callingClass.equals("net.minecraft.server.dedicated.DedicatedServer") && callingParent.equals("net.minecraft.server.MinecraftServer");
allowed |= callingClass.equals("net.minecraft.server.dedicated.ServerHangWatchdog");
allowed |= callingClass.equals("net.minecraft.server.dedicated.ServerHangWatchdog$1");
if (!allowed)
{
throw new ExitTrappedException();
}
@@ -86,7 +86,7 @@ public class DirectoryDiscoverer implements ITypeDiscoverer
if (file.isDirectory())
{
FMLLog.finer("Recursing into package %s", path + file.getName());
exploreFileSystem(path + file.getName() + ".", file, harvestedMods, candidate, mc);
exploreFileSystem(path + file.getName() + "/", file, harvestedMods, candidate, mc);
continue;
}
Matcher match = classFile.matcher(file.getName());
@@ -17,6 +17,7 @@ import java.io.InputStream;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.LoaderException;
@@ -30,6 +31,7 @@ import org.objectweb.asm.Type;
import com.google.common.base.Objects;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
public class ASMModParser
{
@@ -38,6 +40,7 @@ public class ASMModParser
private int classVersion;
private Type asmSuperType;
private LinkedList<ModAnnotation> annotations = Lists.newLinkedList();
private Set<String> interfaces = Sets.newHashSet();
private String baseModProperties;
static enum AnnotationType
@@ -59,11 +62,13 @@ public class ASMModParser
}
}
public void beginNewTypeName(String typeQName, int classVersion, String superClassQName)
public void beginNewTypeName(String typeQName, int classVersion, String superClassQName, String[] interfaces)
{
this.asmType = Type.getObjectType(typeQName);
this.classVersion = classVersion;
this.asmSuperType = !Strings.isNullOrEmpty(superClassQName) ? Type.getObjectType(superClassQName) : null;
for (String intf : interfaces)
this.interfaces.add(intf);
}
public void startClassAnnotation(String annotationName)
@@ -146,6 +151,11 @@ public class ASMModParser
{
table.addASMData(candidate, ma.asmType.getClassName(), this.asmType.getClassName(), ma.member, ma.values);
}
for (String intf : interfaces)
{
table.addASMData(candidate, intf, this.asmType.getInternalName(), null, null);
}
}
public void addAnnotationArray(String name)
@@ -32,7 +32,7 @@ public class ModClassVisitor extends ClassVisitor
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
{
discoverer.beginNewTypeName(name, version, superName);
discoverer.beginNewTypeName(name, version, superName, interfaces);
}
@Override
@@ -109,7 +109,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
public List<NetworkDispatcher> selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet)
{
EntityPlayerMP player = (EntityPlayerMP) args;
NetworkDispatcher dispatcher = player == null ? null : player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
NetworkDispatcher dispatcher = player == null ? null : player.connection.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
return dispatcher == null ? ImmutableList.<NetworkDispatcher>of() : ImmutableList.of(dispatcher);
}
},
@@ -130,7 +130,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.builder();
for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList())
{
NetworkDispatcher dispatcher = player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
NetworkDispatcher dispatcher = player.connection.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
if (dispatcher != null) builder.add(dispatcher);
}
return builder.build();
@@ -160,7 +160,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
{
if (dimension == player.dimension)
{
NetworkDispatcher dispatcher = player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
NetworkDispatcher dispatcher = player.connection.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
// Null dispatchers may exist for fake players - skip them
if (dispatcher != null) builder.add(dispatcher);
}
@@ -200,7 +200,7 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
if (d4 * d4 + d5 * d5 + d6 * d6 < tp.range * tp.range)
{
NetworkDispatcher dispatcher = player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
NetworkDispatcher dispatcher = player.connection.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
if (dispatcher != null) builder.add(dispatcher);
}
}
@@ -189,13 +189,13 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
completeServerSideConnection(ConnectionType.MODDED);
}
// FORGE: sometimes the netqueue will tick while login is occurring, causing an NPE. We shouldn't tick until the connection is complete
if (this.playerEntity.playerNetServerHandler != this) return;
if (this.playerEntity.connection != this) return;
super.update();
}
};
this.netHandler = serverHandler;
// NULL the play server here - we restore it further on. If not, there are packets sent before the login
player.playerNetServerHandler = null;
player.connection = null;
// manually for the manager into the PLAY state, so we can send packets later
this.manager.setConnectionState(EnumConnectionState.PLAY);
@@ -95,7 +95,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler<FMLMessage.E
}
}
EntityTracker.func_187254_a(entity, spawnMsg.rawX, spawnMsg.rawY, spawnMsg.rawZ);
EntityTracker.updateServerPosition(entity, spawnMsg.rawX, spawnMsg.rawY, spawnMsg.rawZ);
EntityPlayerSP clientPlayer = FMLClientHandler.instance().getClientPlayerEntity();
if (entity instanceof IThrowableEntity)
@@ -90,7 +90,7 @@ public class FMLNetworkHandler
embeddedChannel.writeOutbound(openGui);
entityPlayerMP.openContainer = remoteGuiContainer;
entityPlayerMP.openContainer.windowId = windowId;
entityPlayerMP.openContainer.onCraftGuiOpened(entityPlayerMP);
entityPlayerMP.openContainer.addListener(entityPlayerMP);
}
}
else if (entityPlayer instanceof FakePlayer)
@@ -22,8 +22,8 @@ import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityTracker;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biome.SpawnListEntry;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader;
@@ -113,7 +113,6 @@ public class EntityRegistry
private static final EntityRegistry INSTANCE = new EntityRegistry();
private BitSet availableIndices;
private ListMultimap<ModContainer, EntityRegistration> entityRegistrations = ArrayListMultimap.create();
private Map<String,ModContainer> entityNames = Maps.newHashMap();
private BiMap<Class<? extends Entity>, EntityRegistration> entityClassRegistrations = HashBiMap.create();
@@ -125,12 +124,6 @@ public class EntityRegistry
private EntityRegistry()
{
availableIndices = new BitSet(256);
availableIndices.set(1,255);
for (Object id : EntityList.idToClassMapping.keySet())
{
availableIndices.clear((Integer)id);
}
}
/**
@@ -177,11 +170,11 @@ public class EntityRegistry
{
entityClassRegistrations.put(entityClass, er);
entityNames.put(entityName, mc);
if (!EntityList.classToStringMapping.containsKey(entityClass))
if (!EntityList.CLASS_TO_NAME.containsKey(entityClass))
{
String entityModName = String.format("%s.%s", mc.getModId(), entityName);
EntityList.classToStringMapping.put(entityClass, entityModName);
EntityList.stringToClassMapping.put(entityModName, entityClass);
EntityList.CLASS_TO_NAME.put(entityClass, entityModName);
EntityList.NAME_TO_CLASS.put(entityModName, entityClass);
FMLLog.finer("Automatically registered mod %s entity %s as %s", mc.getModId(), entityName, entityModName);
}
else
@@ -214,10 +207,10 @@ public class EntityRegistry
public static void registerEgg(Class<? extends Entity> entityClass, int primary, int secondary)
{
if (EntityList.classToStringMapping.containsKey(entityClass))
if (EntityList.CLASS_TO_NAME.containsKey(entityClass))
{
String name = EntityList.classToStringMapping.get(entityClass);
EntityList.entityEggs.put(name, new EntityList.EntityEggInfo(name, primary, secondary));
String name = EntityList.CLASS_TO_NAME.get(entityClass);
EntityList.ENTITY_EGGS.put(name, new EntityList.EntityEggInfo(name, primary, secondary));
FMLLog.fine("Registering entity egg '%s' for %s", name, entityClass);
}
else
@@ -225,97 +218,6 @@ public class EntityRegistry
FMLLog.fine("Failed registering entity egg %s (No entity found)", entityClass.getName());
}
}
/**
* Registers in the minecraft Entity ID list. This is generally not a good idea and shouldn't be used.
* Simply use {@link #registerModEntity(Class, String, int, Object, int, int, boolean, int, int)} instead.
*
* @param entityClass Class of the entity being registered
* @param entityName Name for the entity being registered
* @param id A globally unique ID for the entity
*/
@Deprecated
public static void registerGlobalEntityID(Class <? extends Entity > entityClass, String entityName, int id)
{
if (EntityList.classToStringMapping.containsKey(entityClass))
{
ModContainer activeModContainer = Loader.instance().activeModContainer();
String modId = "unknown";
if (activeModContainer != null)
{
modId = activeModContainer.getModId();
}
else
{
FMLLog.severe("There is a rogue mod failing to register entities from outside the context of mod loading. This is incredibly dangerous and should be stopped.");
}
FMLLog.warning("The mod %s tried to register the entity class %s which was already registered - if you wish to override default naming for FML mod entities, register it here first", modId, entityClass);
return;
}
id = instance().validateAndClaimId(id);
EntityList.addMapping(entityClass, entityName, id);
}
/**
* Registers in the minecraft Entity ID list. This is generally not a good idea, and shouldn't be used.
* Simply use {@link #registerModEntity(Class, String, int, Object, int, int, boolean)} instead.
* @param entityClass The class of the entity being registered
* @param entityName The name of the entity being registered
* @param id The globally unique ID of the entity
* @param backgroundEggColour An RGB colour value for the spawn egg background colour
* @param foregroundEggColour An RGB colour value for the spawn egg foreground colour
*/
@Deprecated
public static void registerGlobalEntityID(Class <? extends Entity > entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour)
{
if (EntityList.classToStringMapping.containsKey(entityClass))
{
ModContainer activeModContainer = Loader.instance().activeModContainer();
String modId = "unknown";
if (activeModContainer != null)
{
modId = activeModContainer.getModId();
}
else
{
FMLLog.severe("There is a rogue mod failing to register entities from outside the context of mod loading. This is incredibly dangerous and should be stopped.");
}
FMLLog.warning("The mod %s tried to register the entity class %s which was already registered - if you wish to override default naming for FML mod entities, register it here first", modId, entityClass);
return;
}
instance().validateAndClaimId(id);
EntityList.addMapping(entityClass, entityName, id, backgroundEggColour, foregroundEggColour);
}
private int validateAndClaimId(int id)
{
// workaround for broken ML
int realId = id;
if (id < Byte.MIN_VALUE)
{
FMLLog.warning("Compensating for modloader out of range compensation by mod : entityId %d for mod %s is now %d", id, Loader.instance().activeModContainer().getModId(), realId);
realId += 3000;
}
if (realId < 0)
{
realId += Byte.MAX_VALUE;
}
try
{
UnsignedBytes.checkedCast(realId);
}
catch (IllegalArgumentException e)
{
FMLLog.log(Level.ERROR, "The entity ID %d for mod %s is not an unsigned byte and may not work", id, Loader.instance().activeModContainer().getModId());
}
if (!availableIndices.get(realId))
{
FMLLog.severe("The mod %s has attempted to register an entity ID %d which is already reserved. This could cause severe problems", Loader.instance().activeModContainer().getModId(), id);
}
availableIndices.clear(realId);
return realId;
}
/**
* Add a spawn entry for the supplied entity in the supplied {@link BiomeGenBase} list
@@ -326,12 +228,13 @@ public class EntityRegistry
* @param typeOfCreature Type of spawn
* @param biomes List of biomes
*/
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
public static void addSpawn(Class <? extends EntityLiving > entityClass, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, Biome... biomes)
{
for (BiomeGenBase biome : biomes)
for (Biome biome : biomes)
{
List<SpawnListEntry> spawns = biome.getSpawnableList(typeOfCreature);
boolean found = false;
for (SpawnListEntry entry : spawns)
{
//Adjusting an existing spawn entry
@@ -340,11 +243,13 @@ public class EntityRegistry
entry.itemWeight = weightedProb;
entry.minGroupCount = min;
entry.maxGroupCount = max;
found = true;
break;
}
}
spawns.add(new SpawnListEntry(entityClass, weightedProb, min, max));
if (!found)
spawns.add(new SpawnListEntry(entityClass, weightedProb, min, max));
}
}
@@ -358,9 +263,9 @@ public class EntityRegistry
* @param biomes List of biomes
*/
@SuppressWarnings("unchecked")
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, Biome... biomes)
{
Class <? extends Entity > entityClazz = EntityList.stringToClassMapping.get(entityName);
Class <? extends Entity > entityClazz = EntityList.NAME_TO_CLASS.get(entityName);
if (EntityLiving.class.isAssignableFrom(entityClazz))
{
@@ -374,9 +279,9 @@ public class EntityRegistry
* @param typeOfCreature type of spawn
* @param biomes Biomes to remove from
*/
public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
public static void removeSpawn(Class <? extends EntityLiving > entityClass, EnumCreatureType typeOfCreature, Biome... biomes)
{
for (BiomeGenBase biome : biomes)
for (Biome biome : biomes)
{
Iterator<SpawnListEntry> spawns = biome.getSpawnableList(typeOfCreature).iterator();
@@ -398,9 +303,9 @@ public class EntityRegistry
* @param biomes Biomes to remove from
*/
@SuppressWarnings("unchecked")
public static void removeSpawn(String entityName, EnumCreatureType typeOfCreature, BiomeGenBase... biomes)
public static void removeSpawn(String entityName, EnumCreatureType typeOfCreature, Biome... biomes)
{
Class <? extends Entity > entityClazz = EntityList.stringToClassMapping.get(entityName);
Class <? extends Entity > entityClazz = EntityList.NAME_TO_CLASS.get(entityName);
if (EntityLiving.class.isAssignableFrom(entityClazz))
{
@@ -408,23 +313,6 @@ public class EntityRegistry
}
}
/**
* Utility function to try and obtain a globally unique entity ID. Not useful as it requires syncing between
* client and server. Use {@link #registerModEntity(Class, String, int, Object, int, int, boolean)} instead,
* for a much better experience.
* @return A theoretically globally unique ID
*/
@Deprecated
public static int findGlobalUniqueEntityId()
{
int res = instance().availableIndices.nextSetBit(0);
if (res < 0)
{
throw new RuntimeException("No more entity indices left");
}
return res;
}
public EntityRegistration lookupModSpawn(Class<? extends Entity> clazz, boolean keepLooking)
{
Class<?> localClazz = clazz;
@@ -157,7 +157,7 @@ public class FMLControlledNamespacedRegistry<I extends IForgeRegistryEntry<I>> e
this.dummiedLocations.clear();
this.dummiedLocations.addAll(otherRegistry.dummiedLocations);
underlyingIntegerMap.func_186812_a();
underlyingIntegerMap.clear();
registryObjects.clear();
for (I thing : otherRegistry.typeSafeIterable())
@@ -6,7 +6,7 @@ import net.minecraft.item.Item;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionType;
import net.minecraft.util.SoundEvent;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
/**
@@ -21,7 +21,7 @@ public class ForgeRegistries
public static final IForgeRegistry<Block> BLOCKS = GameRegistry.findRegistry(Block.class);
public static final IForgeRegistry<Item> ITEMS = GameRegistry.findRegistry(Item.class);
public static final IForgeRegistry<Potion> POTIONS = GameRegistry.findRegistry(Potion.class);
public static final IForgeRegistry<BiomeGenBase> BIOMES = GameRegistry.findRegistry(BiomeGenBase.class);
public static final IForgeRegistry<Biome> BIOMES = GameRegistry.findRegistry(Biome.class);
public static final IForgeRegistry<SoundEvent> SOUND_EVENTS = GameRegistry.findRegistry(SoundEvent.class);
public static final IForgeRegistry<PotionType> POTION_TYPES = GameRegistry.findRegistry(PotionType.class);
public static final IForgeRegistry<Enchantment> ENCHANTMENTS = GameRegistry.findRegistry(Enchantment.class);
@@ -26,7 +26,7 @@ import net.minecraft.util.ObjectIntIdentityMap;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.registry.RegistryNamespaced;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
@@ -49,7 +49,7 @@ public class GameData
private static final int MIN_POTIONTYPE_ID = 0; // Int
private static final int MAX_POTIONTYPE_ID = Integer.MAX_VALUE >> 5; // Int (SPacketEffect)
private static final int MIN_ENCHANTMENT_ID = 0; // Int
private static final int MAX_ENCHANTMENT_ID = Integer.MAX_VALUE >> 5; // Int - not serialized as an ID?
private static final int MAX_ENCHANTMENT_ID = Short.MAX_VALUE - 1; // Short - serialized as a short in ItemStack NBTs.
private static final ResourceLocation BLOCK_TO_ITEM = new ResourceLocation("minecraft:blocktoitemmap");
private static final ResourceLocation BLOCKSTATE_TO_ID = new ResourceLocation("minecraft:blockstatetoid");
@@ -61,7 +61,7 @@ public class GameData
iBlockRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BLOCKS, Block.class, new ResourceLocation("minecraft:air"), MIN_BLOCK_ID, MAX_BLOCK_ID, true, BlockCallbacks.INSTANCE, BlockCallbacks.INSTANCE, BlockCallbacks.INSTANCE);
iItemRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ITEMS, Item.class, null, MIN_ITEM_ID, MAX_ITEM_ID, true, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE, ItemCallbacks.INSTANCE);
iPotionRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONS, Potion.class, null, MIN_POTION_ID, MAX_POTION_ID, false, PotionCallbacks.INSTANCE, PotionCallbacks.INSTANCE, PotionCallbacks.INSTANCE);
iBiomeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BIOMES, BiomeGenBase.class, null, MIN_BIOME_ID, MAX_BIOME_ID, false, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE);
iBiomeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.BIOMES, Biome.class, null, MIN_BIOME_ID, MAX_BIOME_ID, false, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE, BiomeCallbacks.INSTANCE);
iSoundEventRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.SOUNDEVENTS, SoundEvent.class, null, MIN_SOUND_ID, MAX_SOUND_ID, false, null, null, null);
ResourceLocation WATER = new ResourceLocation("water");
iPotionTypeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONTYPES, PotionType.class, WATER, MIN_POTIONTYPE_ID, MAX_POTIONTYPE_ID, false, null, null, null);
@@ -71,7 +71,7 @@ public class GameData
private final FMLControlledNamespacedRegistry<Block> iBlockRegistry;
private final FMLControlledNamespacedRegistry<Item> iItemRegistry;
private final FMLControlledNamespacedRegistry<Potion> iPotionRegistry;
private final FMLControlledNamespacedRegistry<BiomeGenBase> iBiomeRegistry;
private final FMLControlledNamespacedRegistry<Biome> iBiomeRegistry;
private final FMLControlledNamespacedRegistry<SoundEvent> iSoundEventRegistry;
private final FMLControlledNamespacedRegistry<PotionType> iPotionTypeRegistry;
private final FMLControlledNamespacedRegistry<Enchantment> iEnchantmentRegistry;
@@ -98,7 +98,7 @@ public class GameData
/** INTERNAL ONLY */
@Deprecated
public static FMLControlledNamespacedRegistry<BiomeGenBase> getBiomeRegistry() { return getMain().iBiomeRegistry; }
public static FMLControlledNamespacedRegistry<Biome> getBiomeRegistry() { return getMain().iBiomeRegistry; }
/** INTERNAL ONLY */
@Deprecated
@@ -356,12 +356,12 @@ public class GameData
// no op for the minute?
}
}
private static class BiomeCallbacks implements IForgeRegistry.AddCallback<BiomeGenBase>,IForgeRegistry.ClearCallback<BiomeGenBase>,IForgeRegistry.CreateCallback<BiomeGenBase>
private static class BiomeCallbacks implements IForgeRegistry.AddCallback<Biome>,IForgeRegistry.ClearCallback<Biome>,IForgeRegistry.CreateCallback<Biome>
{
static final BiomeCallbacks INSTANCE = new BiomeCallbacks();
@Override
public void onAdd(BiomeGenBase potion, int id, Map<ResourceLocation, ?> slaves) {
public void onAdd(Biome potion, int id, Map<ResourceLocation, ?> slaves) {
// no op for the minute?
}
@@ -50,8 +50,8 @@ class ObjectHolderRef {
}
else
{
ResourceLocation tmp = isBlock ? GameData.getBlockRegistry().getNameForObject((Block)existing) :
isItem ? GameData.getItemRegistry().getNameForObject((Item)existing) : null;
ResourceLocation tmp = isBlock ? ForgeRegistries.BLOCKS.getKey((Block)existing) :
isItem ? ForgeRegistries.ITEMS.getKey((Item)existing) : null;
this.injectedObject = tmp;
}
} catch (Exception e)
@@ -104,15 +104,15 @@ class ObjectHolderRef {
Object thing;
if (isBlock)
{
thing = GameData.getBlockRegistry().getObject(injectedObject);
if (thing == Blocks.air)
thing = ForgeRegistries.BLOCKS.getValue(injectedObject);
if (thing == Blocks.AIR)
{
thing = null;
}
}
else if (isItem)
{
thing = GameData.getItemRegistry().getObject(injectedObject);
thing = ForgeRegistries.ITEMS.getValue(injectedObject);
}
else
{
@@ -70,7 +70,7 @@ public enum ObjectHolderRegistry {
{
try
{
clazz = Class.forName(className, true, getClass().getClassLoader());
clazz = Class.forName(className, extractFromValue, getClass().getClassLoader());
classCache.put(className, clazz);
}
catch (Exception ex)
@@ -336,196 +336,6 @@ public class VillagerRegistry
//This field is moved from EntityVillager over to here.
//Moved to inner class to stop static initializer issues.
//It is nasty I know but it's vanilla.
private static final ITradeList[][][][] trades =
{
{
{
{
new EmeraldForItems(Items.wheat, new PriceInfo(18, 22)),
new EmeraldForItems(Items.potato, new PriceInfo(15, 19)),
new EmeraldForItems(Items.carrot, new PriceInfo(15, 19)),
new ListItemForEmeralds(Items.bread, new PriceInfo(-4, -2))
},
{
new EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new PriceInfo(8, 13)),
new ListItemForEmeralds(Items.pumpkin_pie, new PriceInfo(-3, -2))
},
{
new EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new PriceInfo(7, 12)),
new ListItemForEmeralds(Items.apple, new PriceInfo(-5, -7))
},
{
new ListItemForEmeralds(Items.cookie, new PriceInfo(-6, -10)),
new ListItemForEmeralds(Items.cake, new PriceInfo(1, 1))
}
},
{
{
new EmeraldForItems(Items.string, new PriceInfo(15, 20)),
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
new ItemAndEmeraldToItem(Items.fish, new PriceInfo(6, 6), Items.cooked_fish, new PriceInfo(6, 6))
},
{
new ListEnchantedItemForEmeralds(Items.fishing_rod, new PriceInfo(7, 8))
}
},
{
{
new EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new PriceInfo(16, 22)),
new ListItemForEmeralds(Items.shears, new PriceInfo(3, 4))
},
{
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 0), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 1), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 2), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 3), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 4), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 5), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 6), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 7), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 8), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 9), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 10), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 11), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 12), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 13), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 14), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 15), new PriceInfo(1, 2))
}
},
{
{
new EmeraldForItems(Items.string, new PriceInfo(15, 20)),
new ListItemForEmeralds(Items.arrow, new PriceInfo(-12, -8))
},
{
new ListItemForEmeralds(Items.bow, new PriceInfo(2, 3)),
new ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new PriceInfo(10, 10), Items.flint, new PriceInfo(6, 10))
}
}
},
{
{
{
new EmeraldForItems(Items.paper, new PriceInfo(24, 36)),
new ListEnchantedBookForEmeralds()
},
{
new EmeraldForItems(Items.book, new PriceInfo(8, 10)),
new ListItemForEmeralds(Items.compass, new PriceInfo(10, 12)),
new ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new PriceInfo(3, 4))
},
{
new EmeraldForItems(Items.written_book, new PriceInfo(2, 2)),
new ListItemForEmeralds(Items.clock, new PriceInfo(10, 12)),
new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new PriceInfo(-5, -3))
},
{
new ListEnchantedBookForEmeralds()
},
{
new ListEnchantedBookForEmeralds()
},
{
new ListItemForEmeralds(Items.name_tag, new PriceInfo(20, 22))
}
}
},
{
{
{
new EmeraldForItems(Items.rotten_flesh, new PriceInfo(36, 40)),
new EmeraldForItems(Items.gold_ingot, new PriceInfo(8, 10))
},
{
new ListItemForEmeralds(Items.redstone, new PriceInfo(-4, -1)),
new ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new PriceInfo(-2, -1))
},
{
new ListItemForEmeralds(Items.ender_pearl, new PriceInfo(4, 7)),
new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new PriceInfo(-3, -1))
},
{
new ListItemForEmeralds(Items.experience_bottle, new PriceInfo(3, 11))
}
}
},
{
{
{
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
new ListItemForEmeralds(Items.iron_helmet, new PriceInfo(4, 6))
},
{
new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)),
new ListItemForEmeralds(Items.iron_chestplate, new PriceInfo(10, 14))
},
{
new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)),
new ListEnchantedItemForEmeralds(Items.diamond_chestplate, new PriceInfo(16, 19))
},
{
new ListItemForEmeralds(Items.chainmail_boots, new PriceInfo(5, 7)),
new ListItemForEmeralds(Items.chainmail_leggings, new PriceInfo(9, 11)),
new ListItemForEmeralds(Items.chainmail_helmet, new PriceInfo(5, 7)),
new ListItemForEmeralds(Items.chainmail_chestplate, new PriceInfo(11, 15))
}
},
{
{
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
new ListItemForEmeralds(Items.iron_axe, new PriceInfo(6, 8))
},
{
new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)),
new ListEnchantedItemForEmeralds(Items.iron_sword, new PriceInfo(9, 10))
},
{
new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)),
new ListEnchantedItemForEmeralds(Items.diamond_sword, new PriceInfo(12, 15)),
new ListEnchantedItemForEmeralds(Items.diamond_axe, new PriceInfo(9, 12))
}
},
{
{
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
new ListEnchantedItemForEmeralds(Items.iron_shovel, new PriceInfo(5, 7))
},
{
new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)),
new ListEnchantedItemForEmeralds(Items.iron_pickaxe, new PriceInfo(9, 11))
},
{
new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)),
new ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new PriceInfo(12, 15))
}
}
},
{
{
{
new EmeraldForItems(Items.porkchop, new PriceInfo(14, 18)),
new EmeraldForItems(Items.chicken, new PriceInfo(14, 18))
},
{
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
new ListItemForEmeralds(Items.cooked_porkchop, new PriceInfo(-7, -5)),
new ListItemForEmeralds(Items.cooked_chicken, new PriceInfo(-8, -6))
}
},
{
{
new EmeraldForItems(Items.leather, new PriceInfo(9, 12)),
new ListItemForEmeralds(Items.leather_leggings, new PriceInfo(2, 4))
},
{
new ListEnchantedItemForEmeralds(Items.leather_chestplate, new PriceInfo(7, 12))
},
{
new ListItemForEmeralds(Items.saddle, new PriceInfo(8, 10))
}
}
}
};
private static final ITradeList[][][][] trades = EntityVillager.GET_TRADES_DONT_USE();
}
}
@@ -20,13 +20,13 @@ import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import net.minecraft.command.ServerCommand;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.network.INetHandler;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.NetworkManager;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.dedicated.PendingCommand;
import net.minecraft.util.IThreadListener;
import net.minecraft.util.text.translation.LanguageMap;
import net.minecraft.world.storage.SaveFormatOld;
@@ -183,7 +183,7 @@ public class FMLServerHandler implements IFMLSidedHandler
// rudimentary command processing, check for fml confirm/cancel and stop commands
synchronized (dedServer.pendingCommandList)
{
for (Iterator<ServerCommand> it = GenericIterableFactory.newCastingIterable(dedServer.pendingCommandList, ServerCommand.class).iterator(); it.hasNext(); )
for (Iterator<PendingCommand> it = GenericIterableFactory.newCastingIterable(dedServer.pendingCommandList, PendingCommand.class).iterator(); it.hasNext(); )
{
String cmd = it.next().command.trim().toLowerCase();
@@ -158,7 +158,7 @@ public class ItemHandlerHelper
if (remainder == null || remainder.stackSize != stack.stackSize)
{
world.playSound(player, player.posX, player.posY, player.posZ,
SoundEvents.entity_item_pickup, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
}
// drop remaining itemstack into the world
@@ -57,196 +57,196 @@ public class OreDictionary
if (!hasInit)
{
// tree- and wood-related things
registerOre("logWood", new ItemStack(Blocks.log, 1, WILDCARD_VALUE));
registerOre("logWood", new ItemStack(Blocks.log2, 1, WILDCARD_VALUE));
registerOre("plankWood", new ItemStack(Blocks.planks, 1, WILDCARD_VALUE));
registerOre("slabWood", new ItemStack(Blocks.wooden_slab, 1, WILDCARD_VALUE));
registerOre("stairWood", Blocks.oak_stairs);
registerOre("stairWood", Blocks.spruce_stairs);
registerOre("stairWood", Blocks.birch_stairs);
registerOre("stairWood", Blocks.jungle_stairs);
registerOre("stairWood", Blocks.acacia_stairs);
registerOre("stairWood", Blocks.dark_oak_stairs);
registerOre("stickWood", Items.stick);
registerOre("treeSapling", new ItemStack(Blocks.sapling, 1, WILDCARD_VALUE));
registerOre("treeLeaves", new ItemStack(Blocks.leaves, 1, WILDCARD_VALUE));
registerOre("treeLeaves", new ItemStack(Blocks.leaves2, 1, WILDCARD_VALUE));
registerOre("vine", Blocks.vine);
registerOre("logWood", new ItemStack(Blocks.LOG, 1, WILDCARD_VALUE));
registerOre("logWood", new ItemStack(Blocks.LOG2, 1, WILDCARD_VALUE));
registerOre("plankWood", new ItemStack(Blocks.PLANKS, 1, WILDCARD_VALUE));
registerOre("slabWood", new ItemStack(Blocks.WOODEN_SLAB, 1, WILDCARD_VALUE));
registerOre("stairWood", Blocks.OAK_STAIRS);
registerOre("stairWood", Blocks.SPRUCE_STAIRS);
registerOre("stairWood", Blocks.BIRCH_STAIRS);
registerOre("stairWood", Blocks.JUNGLE_STAIRS);
registerOre("stairWood", Blocks.ACACIA_STAIRS);
registerOre("stairWood", Blocks.DARK_OAK_STAIRS);
registerOre("stickWood", Items.STICK);
registerOre("treeSapling", new ItemStack(Blocks.SAPLING, 1, WILDCARD_VALUE));
registerOre("treeLeaves", new ItemStack(Blocks.LEAVES, 1, WILDCARD_VALUE));
registerOre("treeLeaves", new ItemStack(Blocks.LEAVES2, 1, WILDCARD_VALUE));
registerOre("vine", Blocks.VINE);
// Ores
registerOre("oreGold", Blocks.gold_ore);
registerOre("oreIron", Blocks.iron_ore);
registerOre("oreLapis", Blocks.lapis_ore);
registerOre("oreDiamond", Blocks.diamond_ore);
registerOre("oreRedstone", Blocks.redstone_ore);
registerOre("oreEmerald", Blocks.emerald_ore);
registerOre("oreQuartz", Blocks.quartz_ore);
registerOre("oreCoal", Blocks.coal_ore);
registerOre("oreGold", Blocks.GOLD_ORE);
registerOre("oreIron", Blocks.IRON_ORE);
registerOre("oreLapis", Blocks.LAPIS_ORE);
registerOre("oreDiamond", Blocks.DIAMOND_ORE);
registerOre("oreRedstone", Blocks.REDSTONE_ORE);
registerOre("oreEmerald", Blocks.EMERALD_ORE);
registerOre("oreQuartz", Blocks.QUARTZ_ORE);
registerOre("oreCoal", Blocks.COAL_ORE);
// ingots/nuggets
registerOre("ingotIron", Items.iron_ingot);
registerOre("ingotGold", Items.gold_ingot);
registerOre("ingotBrick", Items.brick);
registerOre("ingotBrickNether", Items.netherbrick);
registerOre("nuggetGold", Items.gold_nugget);
registerOre("ingotIron", Items.IRON_INGOT);
registerOre("ingotGold", Items.GOLD_INGOT);
registerOre("ingotBrick", Items.BRICK);
registerOre("ingotBrickNether", Items.NETHERBRICK);
registerOre("nuggetGold", Items.GOLD_NUGGET);
// gems and dusts
registerOre("gemDiamond", Items.diamond);
registerOre("gemEmerald", Items.emerald);
registerOre("gemQuartz", Items.quartz);
registerOre("gemPrismarine", Items.prismarine_shard);
registerOre("dustPrismarine", Items.prismarine_crystals);
registerOre("dustRedstone", Items.redstone);
registerOre("dustGlowstone", Items.glowstone_dust);
registerOre("gemLapis", new ItemStack(Items.dye, 1, 4));
registerOre("gemDiamond", Items.DIAMOND);
registerOre("gemEmerald", Items.EMERALD);
registerOre("gemQuartz", Items.QUARTZ);
registerOre("gemPrismarine", Items.PRISMARINE_SHARD);
registerOre("dustPrismarine", Items.PRISMARINE_CRYSTALS);
registerOre("dustRedstone", Items.REDSTONE);
registerOre("dustGlowstone", Items.GLOWSTONE_DUST);
registerOre("gemLapis", new ItemStack(Items.DYE, 1, 4));
// storage blocks
registerOre("blockGold", Blocks.gold_block);
registerOre("blockIron", Blocks.iron_block);
registerOre("blockLapis", Blocks.lapis_block);
registerOre("blockDiamond", Blocks.diamond_block);
registerOre("blockRedstone", Blocks.redstone_block);
registerOre("blockEmerald", Blocks.emerald_block);
registerOre("blockQuartz", Blocks.quartz_block);
registerOre("blockCoal", Blocks.coal_block);
registerOre("blockGold", Blocks.GOLD_BLOCK);
registerOre("blockIron", Blocks.IRON_BLOCK);
registerOre("blockLapis", Blocks.LAPIS_BLOCK);
registerOre("blockDiamond", Blocks.DIAMOND_BLOCK);
registerOre("blockRedstone", Blocks.REDSTONE_BLOCK);
registerOre("blockEmerald", Blocks.EMERALD_BLOCK);
registerOre("blockQuartz", Blocks.QUARTZ_BLOCK);
registerOre("blockCoal", Blocks.COAL_BLOCK);
// crops
registerOre("cropWheat", Items.wheat);
registerOre("cropPotato", Items.potato);
registerOre("cropCarrot", Items.carrot);
registerOre("cropNetherWart", Items.nether_wart);
registerOre("sugarcane", Items.reeds);
registerOre("blockCactus", Blocks.cactus);
registerOre("cropWheat", Items.WHEAT);
registerOre("cropPotato", Items.POTATO);
registerOre("cropCarrot", Items.CARROT);
registerOre("cropNetherWart", Items.NETHER_WART);
registerOre("sugarcane", Items.REEDS);
registerOre("blockCactus", Blocks.CACTUS);
// misc materials
registerOre("dye", new ItemStack(Items.dye, 1, WILDCARD_VALUE));
registerOre("paper", new ItemStack(Items.paper));
registerOre("dye", new ItemStack(Items.DYE, 1, WILDCARD_VALUE));
registerOre("paper", new ItemStack(Items.PAPER));
// mob drops
registerOre("slimeball", Items.slime_ball);
registerOre("enderpearl", Items.ender_pearl);
registerOre("bone", Items.bone);
registerOre("gunpowder", Items.gunpowder);
registerOre("string", Items.string);
registerOre("netherStar", Items.nether_star);
registerOre("leather", Items.leather);
registerOre("feather", Items.feather);
registerOre("egg", Items.egg);
registerOre("slimeball", Items.SLIME_BALL);
registerOre("enderpearl", Items.ENDER_PEARL);
registerOre("bone", Items.BONE);
registerOre("gunpowder", Items.GUNPOWDER);
registerOre("string", Items.STRING);
registerOre("netherStar", Items.NETHER_STAR);
registerOre("leather", Items.LEATHER);
registerOre("feather", Items.FEATHER);
registerOre("egg", Items.EGG);
// records
registerOre("record", Items.record_13);
registerOre("record", Items.record_cat);
registerOre("record", Items.record_blocks);
registerOre("record", Items.record_chirp);
registerOre("record", Items.record_far);
registerOre("record", Items.record_mall);
registerOre("record", Items.record_mellohi);
registerOre("record", Items.record_stal);
registerOre("record", Items.record_strad);
registerOre("record", Items.record_ward);
registerOre("record", Items.record_11);
registerOre("record", Items.record_wait);
registerOre("record", Items.RECORD_13);
registerOre("record", Items.RECORD_CAT);
registerOre("record", Items.RECORD_BLOCKS);
registerOre("record", Items.RECORD_CHIRP);
registerOre("record", Items.RECORD_FAR);
registerOre("record", Items.RECORD_MALL);
registerOre("record", Items.RECORD_MELLOHI);
registerOre("record", Items.RECORD_STAL);
registerOre("record", Items.RECORD_STRAD);
registerOre("record", Items.RECORD_WARD);
registerOre("record", Items.RECORD_11);
registerOre("record", Items.RECORD_WAIT);
// blocks
registerOre("dirt", Blocks.dirt);
registerOre("grass", Blocks.grass);
registerOre("stone", Blocks.stone);
registerOre("cobblestone", Blocks.cobblestone);
registerOre("gravel", Blocks.gravel);
registerOre("sand", new ItemStack(Blocks.sand, 1, WILDCARD_VALUE));
registerOre("sandstone", new ItemStack(Blocks.sandstone, 1, WILDCARD_VALUE));
registerOre("sandstone", new ItemStack(Blocks.red_sandstone, 1, WILDCARD_VALUE));
registerOre("netherrack", Blocks.netherrack);
registerOre("obsidian", Blocks.obsidian);
registerOre("glowstone", Blocks.glowstone);
registerOre("endstone", Blocks.end_stone);
registerOre("torch", Blocks.torch);
registerOre("workbench", Blocks.crafting_table);
registerOre("blockSlime", Blocks.slime_block);
registerOre("blockPrismarine", new ItemStack(Blocks.prismarine, 1, BlockPrismarine.EnumType.ROUGH.getMetadata()));
registerOre("blockPrismarineBrick", new ItemStack(Blocks.prismarine, 1, BlockPrismarine.EnumType.BRICKS.getMetadata()));
registerOre("blockPrismarineDark", new ItemStack(Blocks.prismarine, 1, BlockPrismarine.EnumType.DARK.getMetadata()));
registerOre("stoneGranite", new ItemStack(Blocks.stone, 1, 1));
registerOre("stoneGranitePolished", new ItemStack(Blocks.stone, 1, 2));
registerOre("stoneDiorite", new ItemStack(Blocks.stone, 1, 3));
registerOre("stoneDioritePolished", new ItemStack(Blocks.stone, 1, 4));
registerOre("stoneAndesite", new ItemStack(Blocks.stone, 1, 5));
registerOre("stoneAndesitePolished", new ItemStack(Blocks.stone, 1, 6));
registerOre("blockGlassColorless", Blocks.glass);
registerOre("blockGlass", Blocks.glass);
registerOre("blockGlass", new ItemStack(Blocks.stained_glass, 1, WILDCARD_VALUE));
registerOre("dirt", Blocks.DIRT);
registerOre("grass", Blocks.GRASS);
registerOre("stone", Blocks.STONE);
registerOre("cobblestone", Blocks.COBBLESTONE);
registerOre("gravel", Blocks.GRAVEL);
registerOre("sand", new ItemStack(Blocks.SAND, 1, WILDCARD_VALUE));
registerOre("sandstone", new ItemStack(Blocks.SANDSTONE, 1, WILDCARD_VALUE));
registerOre("sandstone", new ItemStack(Blocks.RED_SANDSTONE, 1, WILDCARD_VALUE));
registerOre("netherrack", Blocks.NETHERRACK);
registerOre("obsidian", Blocks.OBSIDIAN);
registerOre("glowstone", Blocks.GLOWSTONE);
registerOre("endstone", Blocks.END_STONE);
registerOre("torch", Blocks.TORCH);
registerOre("workbench", Blocks.CRAFTING_TABLE);
registerOre("blockSlime", Blocks.SLIME_BLOCK);
registerOre("blockPrismarine", new ItemStack(Blocks.PRISMARINE, 1, BlockPrismarine.EnumType.ROUGH.getMetadata()));
registerOre("blockPrismarineBrick", new ItemStack(Blocks.PRISMARINE, 1, BlockPrismarine.EnumType.BRICKS.getMetadata()));
registerOre("blockPrismarineDark", new ItemStack(Blocks.PRISMARINE, 1, BlockPrismarine.EnumType.DARK.getMetadata()));
registerOre("stoneGranite", new ItemStack(Blocks.STONE, 1, 1));
registerOre("stoneGranitePolished", new ItemStack(Blocks.STONE, 1, 2));
registerOre("stoneDiorite", new ItemStack(Blocks.STONE, 1, 3));
registerOre("stoneDioritePolished", new ItemStack(Blocks.STONE, 1, 4));
registerOre("stoneAndesite", new ItemStack(Blocks.STONE, 1, 5));
registerOre("stoneAndesitePolished", new ItemStack(Blocks.STONE, 1, 6));
registerOre("blockGlassColorless", Blocks.GLASS);
registerOre("blockGlass", Blocks.GLASS);
registerOre("blockGlass", new ItemStack(Blocks.STAINED_GLASS, 1, WILDCARD_VALUE));
//blockGlass{Color} is added below with dyes
registerOre("paneGlassColorless", Blocks.glass_pane);
registerOre("paneGlass", Blocks.glass_pane);
registerOre("paneGlass", new ItemStack(Blocks.stained_glass_pane, 1, WILDCARD_VALUE));
registerOre("paneGlassColorless", Blocks.GLASS_PANE);
registerOre("paneGlass", Blocks.GLASS_PANE);
registerOre("paneGlass", new ItemStack(Blocks.STAINED_GLASS_PANE, 1, WILDCARD_VALUE));
//paneGlass{Color} is added below with dyes
// chests
registerOre("chest", Blocks.chest);
registerOre("chest", Blocks.ender_chest);
registerOre("chest", Blocks.trapped_chest);
registerOre("chestWood", Blocks.chest);
registerOre("chestEnder", Blocks.ender_chest);
registerOre("chestTrapped", Blocks.trapped_chest);
registerOre("chest", Blocks.CHEST);
registerOre("chest", Blocks.ENDER_CHEST);
registerOre("chest", Blocks.TRAPPED_CHEST);
registerOre("chestWood", Blocks.CHEST);
registerOre("chestEnder", Blocks.ENDER_CHEST);
registerOre("chestTrapped", Blocks.TRAPPED_CHEST);
}
// Build our list of items to replace with ore tags
Map<ItemStack, String> replacements = new HashMap<ItemStack, String>();
// wood-related things
replacements.put(new ItemStack(Items.stick), "stickWood");
replacements.put(new ItemStack(Blocks.planks), "plankWood");
replacements.put(new ItemStack(Blocks.planks, 1, WILDCARD_VALUE), "plankWood");
replacements.put(new ItemStack(Blocks.wooden_slab, 1, WILDCARD_VALUE), "slabWood");
replacements.put(new ItemStack(Items.STICK), "stickWood");
replacements.put(new ItemStack(Blocks.PLANKS), "plankWood");
replacements.put(new ItemStack(Blocks.PLANKS, 1, WILDCARD_VALUE), "plankWood");
replacements.put(new ItemStack(Blocks.WOODEN_SLAB, 1, WILDCARD_VALUE), "slabWood");
// ingots/nuggets
replacements.put(new ItemStack(Items.gold_ingot), "ingotGold");
replacements.put(new ItemStack(Items.iron_ingot), "ingotIron");
replacements.put(new ItemStack(Items.GOLD_INGOT), "ingotGold");
replacements.put(new ItemStack(Items.IRON_INGOT), "ingotIron");
// gems and dusts
replacements.put(new ItemStack(Items.diamond), "gemDiamond");
replacements.put(new ItemStack(Items.emerald), "gemEmerald");
replacements.put(new ItemStack(Items.prismarine_shard), "gemPrismarine");
replacements.put(new ItemStack(Items.prismarine_crystals), "dustPrismarine");
replacements.put(new ItemStack(Items.redstone), "dustRedstone");
replacements.put(new ItemStack(Items.glowstone_dust), "dustGlowstone");
replacements.put(new ItemStack(Items.DIAMOND), "gemDiamond");
replacements.put(new ItemStack(Items.EMERALD), "gemEmerald");
replacements.put(new ItemStack(Items.PRISMARINE_SHARD), "gemPrismarine");
replacements.put(new ItemStack(Items.PRISMARINE_CRYSTALS), "dustPrismarine");
replacements.put(new ItemStack(Items.REDSTONE), "dustRedstone");
replacements.put(new ItemStack(Items.GLOWSTONE_DUST), "dustGlowstone");
// crops
replacements.put(new ItemStack(Items.reeds), "sugarcane");
replacements.put(new ItemStack(Blocks.cactus), "blockCactus");
replacements.put(new ItemStack(Items.REEDS), "sugarcane");
replacements.put(new ItemStack(Blocks.CACTUS), "blockCactus");
// misc materials
replacements.put(new ItemStack(Items.paper), "paper");
replacements.put(new ItemStack(Items.PAPER), "paper");
// mob drops
replacements.put(new ItemStack(Items.slime_ball), "slimeball");
replacements.put(new ItemStack(Items.string), "string");
replacements.put(new ItemStack(Items.leather), "leather");
replacements.put(new ItemStack(Items.ender_pearl), "enderpearl");
replacements.put(new ItemStack(Items.gunpowder), "gunpowder");
replacements.put(new ItemStack(Items.nether_star), "netherStar");
replacements.put(new ItemStack(Items.feather), "feather");
replacements.put(new ItemStack(Items.bone), "bone");
replacements.put(new ItemStack(Items.egg), "egg");
replacements.put(new ItemStack(Items.SLIME_BALL), "slimeball");
replacements.put(new ItemStack(Items.STRING), "string");
replacements.put(new ItemStack(Items.LEATHER), "leather");
replacements.put(new ItemStack(Items.ENDER_PEARL), "enderpearl");
replacements.put(new ItemStack(Items.GUNPOWDER), "gunpowder");
replacements.put(new ItemStack(Items.NETHER_STAR), "netherStar");
replacements.put(new ItemStack(Items.FEATHER), "feather");
replacements.put(new ItemStack(Items.BONE), "bone");
replacements.put(new ItemStack(Items.EGG), "egg");
// blocks
replacements.put(new ItemStack(Blocks.stone), "stone");
replacements.put(new ItemStack(Blocks.cobblestone), "cobblestone");
replacements.put(new ItemStack(Blocks.cobblestone, 1, WILDCARD_VALUE), "cobblestone");
replacements.put(new ItemStack(Blocks.glowstone), "glowstone");
replacements.put(new ItemStack(Blocks.glass), "blockGlassColorless");
replacements.put(new ItemStack(Blocks.prismarine), "prismarine");
replacements.put(new ItemStack(Blocks.stone, 1, 1), "stoneGranite");
replacements.put(new ItemStack(Blocks.stone, 1, 2), "stoneGranitePolished");
replacements.put(new ItemStack(Blocks.stone, 1, 3), "stoneDiorite");
replacements.put(new ItemStack(Blocks.stone, 1, 4), "stoneDioritePolished");
replacements.put(new ItemStack(Blocks.stone, 1, 5), "stoneAndesite");
replacements.put(new ItemStack(Blocks.stone, 1, 6), "stoneAndesitePolished");
replacements.put(new ItemStack(Blocks.STONE), "stone");
replacements.put(new ItemStack(Blocks.COBBLESTONE), "cobblestone");
replacements.put(new ItemStack(Blocks.COBBLESTONE, 1, WILDCARD_VALUE), "cobblestone");
replacements.put(new ItemStack(Blocks.GLOWSTONE), "glowstone");
replacements.put(new ItemStack(Blocks.GLASS), "blockGlassColorless");
replacements.put(new ItemStack(Blocks.PRISMARINE), "prismarine");
replacements.put(new ItemStack(Blocks.STONE, 1, 1), "stoneGranite");
replacements.put(new ItemStack(Blocks.STONE, 1, 2), "stoneGranitePolished");
replacements.put(new ItemStack(Blocks.STONE, 1, 3), "stoneDiorite");
replacements.put(new ItemStack(Blocks.STONE, 1, 4), "stoneDioritePolished");
replacements.put(new ItemStack(Blocks.STONE, 1, 5), "stoneAndesite");
replacements.put(new ItemStack(Blocks.STONE, 1, 6), "stoneAndesitePolished");
// chests
replacements.put(new ItemStack(Blocks.chest), "chestWood");
replacements.put(new ItemStack(Blocks.ender_chest), "chestEnder");
replacements.put(new ItemStack(Blocks.trapped_chest), "chestTrapped");
replacements.put(new ItemStack(Blocks.CHEST), "chestWood");
replacements.put(new ItemStack(Blocks.ENDER_CHEST), "chestEnder");
replacements.put(new ItemStack(Blocks.TRAPPED_CHEST), "chestTrapped");
// Register dyes
String[] dyes =
@@ -271,9 +271,9 @@ public class OreDictionary
for(int i = 0; i < 16; i++)
{
ItemStack dye = new ItemStack(Items.dye, 1, i);
ItemStack block = new ItemStack(Blocks.stained_glass, 1, 15 - i);
ItemStack pane = new ItemStack(Blocks.stained_glass_pane, 1, 15 - i);
ItemStack dye = new ItemStack(Items.DYE, 1, i);
ItemStack block = new ItemStack(Blocks.STAINED_GLASS, 1, 15 - i);
ItemStack pane = new ItemStack(Blocks.STAINED_GLASS_PANE, 1, 15 - i);
if (!hasInit)
{
registerOre("dye" + dyes[i], dye);
@@ -291,32 +291,32 @@ public class OreDictionary
// Ignore recipes for the following items
ItemStack[] exclusions = new ItemStack[]
{
new ItemStack(Blocks.lapis_block),
new ItemStack(Items.cookie),
new ItemStack(Blocks.stonebrick),
new ItemStack(Blocks.stone_slab, 1, WILDCARD_VALUE),
new ItemStack(Blocks.stone_stairs),
new ItemStack(Blocks.cobblestone_wall),
new ItemStack(Blocks.oak_fence),
new ItemStack(Blocks.oak_fence_gate),
new ItemStack(Blocks.oak_stairs),
new ItemStack(Blocks.spruce_fence),
new ItemStack(Blocks.spruce_fence_gate),
new ItemStack(Blocks.spruce_stairs),
new ItemStack(Blocks.birch_fence),
new ItemStack(Blocks.birch_fence_gate),
new ItemStack(Blocks.birch_stairs),
new ItemStack(Blocks.jungle_fence),
new ItemStack(Blocks.jungle_fence_gate),
new ItemStack(Blocks.jungle_stairs),
new ItemStack(Blocks.acacia_fence),
new ItemStack(Blocks.acacia_fence_gate),
new ItemStack(Blocks.acacia_stairs),
new ItemStack(Blocks.dark_oak_fence),
new ItemStack(Blocks.dark_oak_fence_gate),
new ItemStack(Blocks.dark_oak_stairs),
new ItemStack(Blocks.wooden_slab),
new ItemStack(Blocks.glass_pane),
new ItemStack(Blocks.LAPIS_BLOCK),
new ItemStack(Items.COOKIE),
new ItemStack(Blocks.STONEBRICK),
new ItemStack(Blocks.STONE_SLAB, 1, WILDCARD_VALUE),
new ItemStack(Blocks.STONE_STAIRS),
new ItemStack(Blocks.COBBLESTONE_WALL),
new ItemStack(Blocks.OAK_FENCE),
new ItemStack(Blocks.OAK_FENCE_GATE),
new ItemStack(Blocks.OAK_STAIRS),
new ItemStack(Blocks.SPRUCE_FENCE),
new ItemStack(Blocks.SPRUCE_FENCE_GATE),
new ItemStack(Blocks.SPRUCE_STAIRS),
new ItemStack(Blocks.BIRCH_STAIRS),
new ItemStack(Blocks.BIRCH_FENCE_GATE),
new ItemStack(Blocks.BIRCH_STAIRS),
new ItemStack(Blocks.JUNGLE_FENCE),
new ItemStack(Blocks.JUNGLE_FENCE_GATE),
new ItemStack(Blocks.JUNGLE_STAIRS),
new ItemStack(Blocks.ACACIA_FENCE),
new ItemStack(Blocks.ACACIA_FENCE_GATE),
new ItemStack(Blocks.ACACIA_STAIRS),
new ItemStack(Blocks.DARK_OAK_FENCE),
new ItemStack(Blocks.DARK_OAK_FENCE_GATE),
new ItemStack(Blocks.DARK_OAK_STAIRS),
new ItemStack(Blocks.WOODEN_SLAB),
new ItemStack(Blocks.GLASS_PANE),
null //So the above can have a comma and we don't have to keep editing extra lines.
};