Skip to content

Commit

Permalink
Initial backport of 1.07.01
Browse files Browse the repository at this point in the history
  • Loading branch information
falkreon committed Apr 24, 2017
1 parent 6e51893 commit 24e3131
Show file tree
Hide file tree
Showing 10 changed files with 211 additions and 203 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ apply plugin: 'net.minecraftforge.gradle.forge'

group = "io.github.elytra"
archivesBaseName = "Engination"
version = "MC1.11.2_ver1.07.01"
version = "MC1.10.2_ver1.07.01"

sourceCompatibility = 1.8
targetCompatibility = 1.8

minecraft {
version = "1.11.2-13.20.0.2226";
mappings = "snapshot_20170205";
version = "1.10.2-12.18.3.2281";
mappings = "stable_29";

runDir = "minecraft"

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/io/github/elytra/engination/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
*/
package io.github.elytra.engination;

import java.util.ArrayList;

import io.github.elytra.engination.block.BlockDisappearing;
import io.github.elytra.engination.entity.EntityTomato;
import io.github.elytra.engination.item.EnginationItems;
Expand All @@ -34,7 +36,6 @@
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
Expand All @@ -43,7 +44,7 @@ public class ClientProxy extends Proxy {
@Override
public void registerItemModel(Item item) {
ResourceLocation loc = Item.REGISTRY.getNameForObject(item);
NonNullList<ItemStack> variantList = NonNullList.create();
ArrayList<ItemStack> variantList = new ArrayList<>();
item.getSubItems(item, Engination.TAB_ENGINATION, variantList);
if (variantList.size()==1) {
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(loc, "inventory"));
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/io/github/elytra/engination/Engination.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package io.github.elytra.engination;

import java.io.File;
import java.util.ArrayList;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -56,7 +57,6 @@
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.common.config.Configuration;
Expand All @@ -79,14 +79,14 @@ public class Engination {

public static CreativeTabs TAB_ENGINATION = new CreativeTabs("engination") {
@Override
public ItemStack getTabIconItem() {
return new ItemStack(EnginationBlocks.CONVEYOR);
public Item getTabIconItem() {
return Item.getItemFromBlock(EnginationBlocks.CONVEYOR);
}
};
public static CreativeTabs TAB_COSMETIC = new CreativeTabs("engination.cosmetic") {
@Override
public ItemStack getTabIconItem() {
return new ItemStack(EnginationBlocks.COSMETIC_TOURIAN);
public Item getTabIconItem() {
return Item.getItemFromBlock(EnginationBlocks.COSMETIC_TOURIAN);
}
};

Expand Down Expand Up @@ -173,7 +173,7 @@ public void onPreInit(FMLPreInitializationEvent e) {
registerFood("food.celery", 0, 0, false);


EntityRegistry.registerModEntity(new ResourceLocation("engination", "tomato"), EntityTomato.class, "tomato", 0, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityTomato.class, "tomato", 0, this, 80, 3, true);

proxy.init();
}
Expand Down Expand Up @@ -352,7 +352,7 @@ public SoundEvent createSound(String loc) {
}

public void registerCraftingCircle(BlockCosmetic block) {
NonNullList<ItemStack> list = NonNullList.create();
ArrayList<ItemStack> list = new ArrayList<>();
block.getVarieties(Item.getItemFromBlock(block), list);
if (list.size()<2) return;
ItemStack first = list.remove(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
Expand Down Expand Up @@ -68,14 +67,14 @@ protected BlockCosmetic(Material material, MapColor color) {

@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item itemBlock, CreativeTabs tab, NonNullList<ItemStack> list) {
public void getSubBlocks(Item itemBlock, CreativeTabs tab, List<ItemStack> list) {
getVarieties(itemBlock, list);
}

/**
* Behaves like getSubBlocks, but is available on the server
*/
public void getVarieties(Item itemBlock, NonNullList<ItemStack> list) {
public void getVarieties(Item itemBlock, List<ItemStack> list) {
for(int i=0; i<16; i++) {
list.add(new ItemStack(itemBlock, 1, i));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class BlockCosmeticPillar extends BlockRotatedPillar {
public static PropertyInteger VARIATION = PropertyInteger.create("variant", 0, 3);
Expand All @@ -61,7 +62,12 @@ public BlockCosmeticPillar(String blockName, Material material, MapColor color)
}

@Override
public void getSubBlocks(Item itemBlock, CreativeTabs tab, NonNullList<ItemStack> list) {
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item itemBlock, CreativeTabs tab, List<ItemStack> list) {
getVarieties(itemBlock, list);
}

public void getVarieties(Item itemBlock, List<ItemStack> list) {
for(int i=0; i<4; i++) {
list.add(new ItemStack(itemBlock, 1, i));
}
Expand Down Expand Up @@ -91,9 +97,9 @@ public int damageDropped(IBlockState state) {
}

@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float x, float y, float z, int something, EntityLivingBase placer, EnumHand hand) {
return super.getStateForPlacement(world, pos, facing, x, y, z, something, placer, hand)
.withProperty(VARIATION, placer.getHeldItem(hand).getItemDamage());
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float x, float y, float z, int meta, EntityLivingBase placer, ItemStack stack) {
return super.getStateForPlacement(world, pos, facing, x, y, z, meta, placer, stack)
.withProperty(VARIATION, stack.getItemDamage());
}

public BlockCosmeticPillar setTip() { this.showTip=true; return this; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
Expand All @@ -68,7 +67,7 @@ public BlockDisappearing(String blockName) {
}

@Override
public void getSubBlocks(Item itemBlock, CreativeTabs tab, NonNullList<ItemStack> list) {
public void getVarieties(Item itemBlock, List<ItemStack> list) {
for(int i=0; i<7; i++) {
list.add(new ItemStack(itemBlock, 1, i));
}
Expand Down Expand Up @@ -120,17 +119,17 @@ public int tickRate(World world) {

@SuppressWarnings("deprecation")
@Override
public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB bounds, List<AxisAlignedBB> list, Entity entity, boolean something) {
public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB bounds, List<AxisAlignedBB> list, Entity entity) {
if (state.getValue(DISAPPEARED)) {
//Don't collide with it if disappear'd!
} else {
super.addCollisionBoxToList(state, world, pos, bounds, list, entity, something);
super.addCollisionBoxToList(state, world, pos, bounds, list, entity);
}
}

@SuppressWarnings("deprecation")
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos) {
if (state.getValue(DISAPPEARED)) {
return Block.NULL_AABB;
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2016-2017 Isaac Ellingson (Falkreon)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.github.elytra.engination.block;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class BlockDisappearingMelee extends BlockDisappearing {
public static final ChainReactionType CHAINTYPE_PUNCH = new ChainReactionType();

public BlockDisappearingMelee(String blockName) {
super("melee");
}

@Override
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) {
if (world.isRemote) return;
ItemStack heldItem = player.getHeldItemMainhand();
if (heldItem.isEmpty()) {
this.disappearChainReaction(world, pos);
}
}

@Override
public ChainReactionType getChainReactionType() {
return CHAINTYPE_PUNCH;
}

}
/**
* The MIT License (MIT)
*
* Copyright (c) 2016-2017 Isaac Ellingson (Falkreon)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.github.elytra.engination.block;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class BlockDisappearingMelee extends BlockDisappearing {
public static final ChainReactionType CHAINTYPE_PUNCH = new ChainReactionType();

public BlockDisappearingMelee(String blockName) {
super("melee");
}

@Override
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) {
if (world.isRemote) return;
ItemStack heldItem = player.getHeldItemMainhand();
if (heldItem==null) {
this.disappearChainReaction(world, pos);
}
}

@Override
public ChainReactionType getChainReactionType() {
return CHAINTYPE_PUNCH;
}

}
Loading

0 comments on commit 24e3131

Please sign in to comment.