Skip to content

Instantly share code, notes, and snippets.

View gist:8887801
class Walker_Nav_Menu_Append extends Walker_Nav_Menu {
var $appendage = '';
function __construct($appendage = ''){
$this->appendage = $appendage;
}
View Directions.java
/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered.org <http://www.spongepowered.org>
* Copyright (c) contributors
*
* 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
View StoneSoup.java
package org.spongepowered;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
import org.spongepowered.api.Game;
import org.spongepowered.api.GameRegistry;
import org.spongepowered.api.data.DataManipulatorBuilder;
import org.spongepowered.api.data.manipulators.DisplayNameData;
import org.spongepowered.api.data.manipulators.entities.CareerData;
View DataManipulator.java
@Override
public Optional<FoodOverrideData> from(DataContainer container) {
Optional<Integer> hunger = container.getInt(QHUNGER);
Optional<Double> saturation = container.getDouble(QSATURATION);
//Not sure this is right... if the query fails, should it return Optional.absent?
return Optional.of(new FoodOverrideData(hunger, saturation)); //Constructor constructs the default values for missing values
/**
* if(hunger.isPresent() && saturation.isPresent()) return Optional.of(new FoodOverrideData(hunger, saturation);
View HungerOverrideData.java
@Override
public Optional<HungerOverrideData> fill(DataHolder dataHolder, DataPriority overlap) {
HungerOverrideData man = new HungerOverrideData(this);
HungerOverrideData hold = dataHolder.getData(HungerOverrideData.class).orNull();
HungerOverrideData out = null;
switch (overlap){
case DATA_HOLDER:
out = hold;
break;
@ryantheleach
ryantheleach / nether\dim-1\world.conf
Created Jun 8, 2015
Default Sponge(CoreMod) Configuration
View nether\dim-1\world.conf
# 1.0
#
# # If you need help with the configuration or have any questions related to Sponge,
# # join us at the IRC or drop by our forums and leave a post.
#
# # IRC: #sponge @ irc.esper.net ( http://webchat.esper.net/?channel=sponge )
# # Forums: https://forums.spongepowered.org/
#
sponge {
View gist:b51c50f03eb4058ab714
//https://www.reddit.com/r/minecraftsuggestions/comments/3d5l3p/jumping_into_water_while_on_fire_plays_a/
@Listener(order = Order.POST)
public void onPlayerExtinguish(final IgniteEntityEvent event) {
logger.log(Level.WARNING, "Entity Ignited: "+event.getTargetEntity());
int ticksToGo = event.getFireTicks();
Entity entity = event.getTargetEntity();
Sponge.getScheduler().createTaskBuilder()
.intervalTicks(1)
.execute(task -> trackFireEntities(task, entity))
View Example BlockPredicate DSL.
Types
Traits[]
Data{}
Properties<>
Types
minecraft:leaves //Matches original vanilla leaves.
minecraft:leaves,minecraft:leaves2 //Matches new leaves or old leaves.
minecraft: //matches any vanilla block
buildcraft: // matches any block with buildcraft as the prefix.
View SF Master
[Player776: Set own game mode to Creative Mode]
[07:00:47] [Client thread/INFO]: [CHAT] Your game mode has been updated
[07:00:56] [Server thread/INFO]: <Player776> TNT - Flint and Steel
[07:00:57] [Client thread/INFO]: [CHAT] <Player776> TNT - Flint and Steel
[07:01:03] [Server thread/INFO] [modwiztesting.modwiztesting]: Cause[{Name=Source, Object={BlockSpawnCause{SpawnType=SpongeSpawnType{id=DroppedItem, name=DroppedItem}, BlockSnapshot=SpongeBlockSnapshot{worldUniqueId=0e84b5cb-7357-4bdb-916b-66e911780fd5, position=(263, 66, 271), blockState=minecraft:grass[snowy=false], extendedState=minecraft:grass[snowy=false]}}}}, {Name=Owner, Object={EntityPlayerMP['Player776'/168, l='BedTest', x=262.37, y=75.77, z=269.26]}}]
[07:01:03] [Server thread/INFO] [modwiztesting.modwiztesting]: Cause[{Name=Source, Object={BlockSpawnCause{SpawnType=SpongeSpawnType{id=DroppedItem, name=DroppedItem}, BlockSnapshot=SpongeBlockSnapshot{worldUniqueId=0e84b5cb-7357-4bdb-916b-66e911780fd5, position=(265, 66, 271), blockState=minecra
View gist:ce365dccbced5cf2f7a64efde2d01523
private void spawnTrapHorse(SpawnEntityEvent event) {
event.filterEntities(
entity -> !entity.get(Keys.HORSE_VARIANT)
.filter(HorseVariants.SKELETON_HORSE::equals)
.isPresent()
);
}