Skip to content

Commit

Permalink
1.18 Port
Browse files Browse the repository at this point in the history
  • Loading branch information
Buuz135 committed Jan 24, 2022
1 parent 8ac2a35 commit d3d2fe4
Show file tree
Hide file tree
Showing 46 changed files with 382 additions and 337 deletions.
40 changes: 40 additions & 0 deletions .gihub/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish action

on:
create:
tag:
- '*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: checkout repository
uses: actions/checkout@v2
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk 17
uses: actions/setup-java@v1
with:
java-version: "17"
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
- name: Publish Minecraft Mods Forge
uses: Kir-Antipov/[email protected]
with:
curseforge-id: 291493
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
files-primary: build/libs/!(*-@(dev|sources)).jar
files-secondary: build/libs/*-@(dev|sources).jar
version-type: beta
loaders: forge
game-versions: 1.18.1
java: 17
name: ""
changelog: "https://github.com/InnovativeOnlineIndustries/Portality/commits/1.18"
dependencies: |
titanium | depends
10 changes: 7 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,13 @@ repositories {
}

dependencies {
minecraft 'net.minecraftforge:forge:1.18.1-39.0.8'
implementation fg.deobf("curse.maven:titanium-287342:3346366")
//runtimeOnly fg.deobf("team.chisel.ctm:CTM:MC1.16.1-+")
minecraft 'net.minecraftforge:forge:1.18.1-39.0.59'
if (findProject(':titanium') != null) {
implementation project(':titanium')
} else {
implementation fg.deobf (project.dependencies.create('com.hrznstudio:titanium:1.18-3.4.0-27'))
}
runtimeOnly fg.deobf("team.chisel.ctm:CTM:1.18-+")
}

afterEvaluate {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modGroup=com.buuz135.portality.Portality
api_version=3.2.5
api_version=3.3.0
modBaseName=portality
forgeVersion=1.12.2-14.23.4.2759
mcpVersion=stable_39
Expand Down
49 changes: 22 additions & 27 deletions src/main/java/com/buuz135/portality/Portality.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,22 @@
*/
package com.buuz135.portality;

import com.buuz135.portality.block.ControllerBlock;
import com.buuz135.portality.block.FrameBlock;
import com.buuz135.portality.block.GeneratorBlock;
import com.buuz135.portality.block.InterdimensionalModuleBlock;
import com.buuz135.portality.block.module.CapabilityEnergyModuleBlock;
import com.buuz135.portality.block.module.CapabilityFluidModuleBlock;
import com.buuz135.portality.block.module.CapabilityItemModuleBlock;
import com.buuz135.portality.item.TeleportationTokenItem;
import com.buuz135.portality.network.*;
import com.buuz135.portality.proxy.CommonProxy;
import com.buuz135.portality.proxy.PortalitySoundHandler;
import com.buuz135.portality.proxy.client.ClientProxy;
import com.buuz135.portality.proxy.client.render.AuraRender;
import com.buuz135.portality.tile.BasicFrameTile;
import com.hrznstudio.titanium.TitaniumClient;
import com.hrznstudio.titanium.event.handler.EventManager;
import com.hrznstudio.titanium.module.Feature;
import com.hrznstudio.titanium.module.Module;
import com.hrznstudio.titanium.module.ModuleController;
import com.hrznstudio.titanium.network.NetworkHandler;
import com.hrznstudio.titanium.reward.Reward;
Expand Down Expand Up @@ -66,7 +73,7 @@ public class Portality extends ModuleController {
public static final CreativeModeTab TAB = new CreativeModeTab(MOD_ID) {
@Override
public ItemStack makeIcon() {
return new ItemStack(CommonProxy.BLOCK_CONTROLLER);
return new ItemStack(CommonProxy.BLOCK_CONTROLLER.get());
}
};

Expand All @@ -88,9 +95,6 @@ public Portality() {
RewardGiver giver = RewardManager.get().getGiver(UUID.fromString("d28b7061-fb92-4064-90fb-7e02b95a72a6"), "Buuz135");
try {
giver.addReward(new Reward(new ResourceLocation(Portality.MOD_ID, "aura"), new URL("https://raw.githubusercontent.com/Buuz135/Industrial-Foregoing/master/contributors.json"), () -> dist -> {
if (dist == Dist.CLIENT) {
registerAura();
}
}, Arrays.stream(AuraType.values()).map(Enum::toString).collect(Collectors.toList()).toArray(new String[]{})));
} catch (MalformedURLException e) {
e.printStackTrace();
Expand All @@ -99,27 +103,25 @@ public Portality() {

@Override
protected void initModules() {
addModule(Module.builder("core").force()
.feature(Feature.builder("core")
.content(Block.class, CommonProxy.BLOCK_CONTROLLER)
.content(Block.class, CommonProxy.BLOCK_FRAME)
.content(Block.class, CommonProxy.BLOCK_CAPABILITY_ENERGY_MODULE)
.content(Block.class, CommonProxy.BLOCK_CAPABILITY_FLUID_MODULE)
.content(Block.class, CommonProxy.BLOCK_CAPABILITY_ITEM_MODULE)
.content(Block.class, CommonProxy.BLOCK_INTERDIMENSIONAL_MODULE)
.content(Block.class, CommonProxy.BLOCK_GENERATOR)
.content(Item.class, CommonProxy.TELEPORTATION_TOKEN_ITEM)
.content(SoundEvent.class, PortalitySoundHandler.PORTAL)
.content(SoundEvent.class, PortalitySoundHandler.PORTAL_TP)
.force()));
CommonProxy.BLOCK_CONTROLLER = getRegistries().register(Block.class, "controller", ControllerBlock::new);
CommonProxy.BLOCK_FRAME = getRegistries().register(Block.class, "frame", () -> new FrameBlock<BasicFrameTile>("frame", BasicFrameTile.class));
CommonProxy.BLOCK_CAPABILITY_ENERGY_MODULE = getRegistries().register(Block.class, "module_energy", CapabilityEnergyModuleBlock::new);
CommonProxy.BLOCK_CAPABILITY_FLUID_MODULE = getRegistries().register(Block.class, "module_fluids", CapabilityFluidModuleBlock::new);
CommonProxy.BLOCK_CAPABILITY_ITEM_MODULE = getRegistries().register(Block.class, "module_items", CapabilityItemModuleBlock::new);
CommonProxy.BLOCK_INTERDIMENSIONAL_MODULE = getRegistries().register(Block.class, "module_interdimensional", InterdimensionalModuleBlock::new);
CommonProxy.BLOCK_GENERATOR = getRegistries().register(Block.class, "generator", GeneratorBlock::new);
CommonProxy.TELEPORTATION_TOKEN_ITEM = getRegistries().register(Item.class, "teleportation_token", TeleportationTokenItem::new);

PortalitySoundHandler.PORTAL = getRegistries().register(SoundEvent.class, "portal", () -> new SoundEvent(new ResourceLocation(Portality.MOD_ID, "portal")));
PortalitySoundHandler.PORTAL_TP = getRegistries().register(SoundEvent.class, "portal_teleport", () -> new SoundEvent(new ResourceLocation(Portality.MOD_ID, "portal_teleport")));
}

public void onCommon(FMLCommonSetupEvent event) {
proxy.onCommon();
}

public void onClient(FMLClientSetupEvent event) {
proxy.onClient(event.getMinecraftSupplier().get());
proxy.onClient(Minecraft.getInstance());
}

public enum AuraType {
Expand Down Expand Up @@ -154,11 +156,4 @@ public boolean isEnableBlend() {
}
}

@OnlyIn(Dist.CLIENT)
private void registerAura() {
Minecraft instance = Minecraft.getInstance();
EntityRenderDispatcher manager = instance.getEntityRenderDispatcher();
manager.getSkinMap().get("default").addLayer(new AuraRender(TitaniumClient.getPlayerRenderer(instance)));
manager.getSkinMap().get("slim").addLayer(new AuraRender(TitaniumClient.getPlayerRenderer(instance)));
}
}
15 changes: 4 additions & 11 deletions src/main/java/com/buuz135/portality/block/ControllerBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import com.buuz135.portality.item.TeleportationTokenItem;
import com.buuz135.portality.proxy.CommonProxy;
import com.buuz135.portality.tile.ControllerTile;
import com.hrznstudio.titanium.api.IFactory;
import com.hrznstudio.titanium.block.RotatableBlock;
import net.minecraft.ChatFormatting;
import net.minecraft.client.Minecraft;
Expand All @@ -48,6 +47,7 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;

Expand All @@ -58,14 +58,13 @@
public class ControllerBlock extends RotatableBlock<ControllerTile> {

public ControllerBlock() {
super(Block.Properties.copy(Blocks.IRON_BLOCK), ControllerTile.class);
setRegistryName(Portality.MOD_ID, "controller");
super("controller", Block.Properties.copy(Blocks.IRON_BLOCK), ControllerTile.class);
setItemGroup(Portality.TAB);
}

@Override
public void setPlacedBy(Level worldIn, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) {
PortalInformation information = new PortalInformation(UUID.randomUUID(), placer.getUUID(), false, false, worldIn.dimension(), pos, "X: " + pos.getX() + " Y: " + pos.getY() + " Z: " + pos.getZ(), new ItemStack(CommonProxy.BLOCK_FRAME), false);
PortalInformation information = new PortalInformation(UUID.randomUUID(), placer.getUUID(), false, false, worldIn.dimension(), pos, "X: " + pos.getX() + " Y: " + pos.getY() + " Z: " + pos.getZ(), new ItemStack(CommonProxy.BLOCK_FRAME.get()), false);
PortalDataManager.addInformation(worldIn, information);
super.setPlacedBy(worldIn, pos, state, placer, stack);
}
Expand Down Expand Up @@ -132,7 +131,6 @@ public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Play
return super.use(state, worldIn, pos, playerIn, hand, ray);
}


@Override
public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
BlockEntity entity = worldIn.getBlockEntity(pos);
Expand All @@ -143,14 +141,9 @@ public void onRemove(BlockState state, Level worldIn, BlockPos pos, BlockState n
}

@Override
public IFactory<ControllerTile> getTileEntityFactory() {
public BlockEntityType.BlockEntitySupplier<?> getTileEntityFactory() {
return ControllerTile::new;
}

@Nullable
@Override
public BlockEntity newBlockEntity(BlockGetter worldIn) {
return new ControllerTile();
}

}
20 changes: 4 additions & 16 deletions src/main/java/com/buuz135/portality/block/FrameBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;

Expand All @@ -44,8 +45,7 @@
public class FrameBlock<T extends FrameTile<T>> extends RotatableBlock<T> {

public FrameBlock(String name, Class<T> tileClass) {
super(Block.Properties.copy(Blocks.IRON_BLOCK), tileClass);
setRegistryName(Portality.MOD_ID, name);
super(name, Block.Properties.copy(Blocks.IRON_BLOCK), tileClass);
setItemGroup(Portality.TAB);
}

Expand All @@ -68,20 +68,8 @@ public RotationType getRotationType() {
}

@Override
public IFactory<T> getTileEntityFactory() {
return new IFactory<T>() {
@Nonnull
@Override
public T create() {
return (T) new BasicFrameTile();
}
};
}

@Nullable
@Override
public BlockEntity newBlockEntity(BlockGetter worldIn) {
return new BasicFrameTile();
public BlockEntityType.BlockEntitySupplier<?> getTileEntityFactory() {
return BasicFrameTile::new;
}

@Override
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/com/buuz135/portality/block/GeneratorBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@

import com.buuz135.portality.Portality;
import com.buuz135.portality.tile.LowEfficiencyGeneratorTile;
import com.hrznstudio.titanium.api.IFactory;
import com.hrznstudio.titanium.block.RotatableBlock;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;

import javax.annotation.Nonnull;
Expand All @@ -38,13 +38,12 @@
public class GeneratorBlock extends RotatableBlock<LowEfficiencyGeneratorTile> {

public GeneratorBlock() {
super(Block.Properties.copy(Blocks.IRON_BLOCK), LowEfficiencyGeneratorTile.class);
setRegistryName(Portality.MOD_ID, "generator");
super("generator", Block.Properties.copy(Blocks.IRON_BLOCK), LowEfficiencyGeneratorTile.class);
setItemGroup(Portality.TAB);
}

@Override
public IFactory<LowEfficiencyGeneratorTile> getTileEntityFactory() {
public BlockEntityType.BlockEntitySupplier<?> getTileEntityFactory() {
return LowEfficiencyGeneratorTile::new;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
package com.buuz135.portality.block.module;

import com.buuz135.portality.tile.EnergyModuleTile;
import com.hrznstudio.titanium.api.IFactory;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage;
Expand Down Expand Up @@ -64,13 +64,8 @@ void internalWork(Level current, BlockPos myself, Level otherWorld, List<BlockPo
}

@Override
public IFactory<EnergyModuleTile> getTileEntityFactory() {
public BlockEntityType.BlockEntitySupplier<?> getTileEntityFactory() {
return EnergyModuleTile::new;
}

@Nullable
@Override
public BlockEntity newBlockEntity(BlockGetter worldIn) {
return new EnergyModuleTile();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
package com.buuz135.portality.block.module;

import com.buuz135.portality.tile.FluidModuleTile;
import com.hrznstudio.titanium.api.IFactory;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
Expand Down Expand Up @@ -66,13 +66,7 @@ void internalWork(Level current, BlockPos myself, Level otherWorld, List<BlockPo
}

@Override
public IFactory<FluidModuleTile> getTileEntityFactory() {
public BlockEntityType.BlockEntitySupplier<?> getTileEntityFactory() {
return FluidModuleTile::new;
}

@Nullable
@Override
public BlockEntity newBlockEntity(BlockGetter worldIn) {
return new FluidModuleTile();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
package com.buuz135.portality.block.module;

import com.buuz135.portality.tile.ItemModuleTile;
import com.hrznstudio.titanium.api.IFactory;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
Expand Down Expand Up @@ -73,13 +73,8 @@ void internalWork(Level current, BlockPos myself, Level otherWorld, List<BlockPo
}

@Override
public IFactory<ItemModuleTile> getTileEntityFactory() {
public BlockEntityType.BlockEntitySupplier<?> getTileEntityFactory() {
return ItemModuleTile::new;
}

@Nullable
@Override
public BlockEntity newBlockEntity(BlockGetter worldIn) {
return new ItemModuleTile();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockSt
}

@Override
public ItemStack getPickBlock(BlockState state, HitResult target, BlockGetter world, BlockPos pos, Player player) {
public ItemStack getCloneItemStack(BlockGetter p_49823_, BlockPos p_49824_, BlockState p_49825_) {
return new ItemStack(this, 1);
}

Expand Down
Loading

0 comments on commit d3d2fe4

Please sign in to comment.